From c83335c5a3cde721661c347a3d8e9cfdbd1db007 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 29 Jan 2017 18:54:13 -0800 Subject: Use 'make install' to install DUMA This serves two purposes: - installs its manpage - installs headers, without them it does not make sense to install a static library Unfortunately, there's no way to select shared-only build of DUMA. Hence, disable selection for static library. Also, allow user to select whether to use stock or ct-ng's wrapper. Signed-off-by: Alexey Neyman diff --git a/config/debug/duma.in b/config/debug/duma.in index 5f08087..9947ca2 100644 --- a/config/debug/duma.in +++ b/config/debug/duma.in @@ -7,17 +7,18 @@ ## help A memory bound checker, with additional features. ## help Formerly known as Electric Fence. -config DUMA_A - bool - prompt "Build a static library" - default y - config DUMA_SO bool prompt "Build a shared library" depends on SHARED_LIBS default y +config DUMA_CUSTOM_WRAPPER + bool + prompt "Install custom D.U.M.A wrapper" + default y + depends on DUMA_SO + choice bool prompt "D.U.M.A. version" diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh index 7196fcf..2a9b01f 100644 --- a/scripts/build/debug/200-duma.sh +++ b/scripts/build/debug/200-duma.sh @@ -22,42 +22,43 @@ do_debug_duma_extract() { } do_debug_duma_build() { + local -a make_args + CT_DoStep INFO "Installing D.U.M.A." CT_DoLog EXTRA "Copying sources" cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}/." "${CT_BUILD_DIR}/build-duma" CT_Pushd "${CT_BUILD_DIR}/build-duma" - DUMA_CPP= - [ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1 + make_args=( + prefix="${CT_DEBUGROOT_DIR}/usr" + HOSTCC="${CT_BUILD}-gcc" + CC="${CT_TARGET}-${CT_CC}" + CXX="${CT_TARGET}-g++" + RANLIB="${CT_TARGET}-ranlib" + OS="${CT_KERNEL}" + ) + [ "${CT_CC_LANG_CXX}" = "y" ] && make_args+=( DUMA_CPP=1 ) + [ "${CT_DUMA_SO}" = "y" ] || make_args+=( DUMASO= ) + + CT_DoLog EXTRA "Building D.U.M.A" + CT_DoExecLog ALL make "${make_args[@]}" all + CT_DoLog EXTRA "Installing D.U.M.A" + CT_DoExecLog ALL make "${make_args[@]}" install - # The shared library needs some love: some version have libduma.so.0.0, - # while others have libduma.so.0.0.0 - duma_so=$(make -n -p 2>&1 |grep -E '^libduma.so[^:]*:' |head -n 1 |cut -d : -f 1) + if [ "${CT_DUMA_CUSTOM_WRAPPER}" = "y" ]; then + # The shared library needs some love: some version have libduma.so.0.0, + # while others have libduma.so.0.0.0 + duma_so=$( make "${make_args[@]}" printvars | sed -n -r -e 's/^DUMASO \[(.*)\]$/\1/p' ) - libs= - [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a" - [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} ${duma_so}" - libs="${libs# }" - CT_DoLog EXTRA "Building libraries '${libs}'" - CT_DoExecLog ALL \ - make HOSTCC="${CT_BUILD}-gcc" \ - CC="${CT_TARGET}-${CT_CC}" \ - CXX="${CT_TARGET}-g++" \ - RANLIB="${CT_TARGET}-ranlib" \ - DUMA_CPP="${DUMA_CPP}" \ - ${libs} - CT_DoLog EXTRA "Installing libraries '${libs}'" - CT_DoExecLog ALL install -m 644 ${libs} "${CT_SYSROOT_DIR}/usr/lib" - if [ "${CT_DUMA_SO}" = "y" ]; then - CT_DoLog EXTRA "Installing shared library link" - ln -vsf ${duma_so} "${CT_SYSROOT_DIR}/usr/lib/libduma.so" 2>&1 |CT_DoLog ALL CT_DoLog EXTRA "Installing wrapper script" - mkdir -p "${CT_DEBUGROOT_DIR}/usr/bin" + CT_DoExecLog ALL mkdir -p "${CT_DEBUGROOT_DIR}/usr/bin" # Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A. - sed -r -e 's:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/'"${duma_so}"':;' \ - "${CT_LIB_DIR}/scripts/build/debug/duma.in" \ - >"${CT_DEBUGROOT_DIR}/usr/bin/duma" - chmod 755 "${CT_DEBUGROOT_DIR}/usr/bin/duma" + CT_DoExecLog ALL rm -f "${CT_DEBUGROOT_DIR}/usr/bin/duma" + CT_DoExecLog ALL cp "${CT_LIB_DIR}/scripts/build/debug/duma.in" \ + "${CT_DEBUGROOT_DIR}/usr/bin/duma" + CT_DoExecLog ALL sed -i -r -e "s:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/${duma_so}:;" \ + "${CT_DEBUGROOT_DIR}/usr/bin/duma" + CT_DoExecLog ALL chmod 755 "${CT_DEBUGROOT_DIR}/usr/bin/duma" fi CT_Popd -- cgit v0.10.2-6-g49f6