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 <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-01-29 18:54:13 -08:00
parent bd318e886b
commit c83335c5a3
2 changed files with 34 additions and 32 deletions

View File

@ -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"

View File

@ -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= )
# 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)
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
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