2008-06-17 22:26:44 +00:00
|
|
|
# Build script for D.U.M.A.
|
2007-07-12 08:47:15 +00:00
|
|
|
|
|
|
|
is_enabled="${CT_DUMA}"
|
|
|
|
|
|
|
|
do_print_filename() {
|
|
|
|
[ "${CT_DUMA}" = "y" ] || return 0
|
|
|
|
echo "duma_${CT_DUMA_VERSION}"
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_duma_get() {
|
|
|
|
CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/
|
|
|
|
# D.U.M.A. doesn't separate its name from its version with a dash,
|
|
|
|
# but with an underscore. Create a link so that crosstool-NG can
|
|
|
|
# work correctly:
|
|
|
|
cd "${CT_TARBALLS_DIR}"
|
2008-05-20 21:32:39 +00:00
|
|
|
duma_ext=$(CT_GetFileExtension "duma_${CT_DUMA_VERSION}")
|
2007-07-12 08:47:15 +00:00
|
|
|
rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
|
|
|
|
ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_duma_extract() {
|
|
|
|
CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
|
|
|
|
cd "${CT_SRC_DIR}"
|
|
|
|
rm -f "duma-${CT_DUMA_VERSION}"
|
|
|
|
ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_duma_build() {
|
|
|
|
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
|
|
|
|
|
2008-06-17 22:26:44 +00:00
|
|
|
# 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 |egrep '^libduma.so[^:]*:' |head -n 1 |cut -d : -f 1)
|
|
|
|
|
2007-07-12 08:47:15 +00:00
|
|
|
libs=
|
|
|
|
[ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
|
2008-06-17 22:26:44 +00:00
|
|
|
[ "${CT_DUMA_SO}" = "y" ] && libs="${libs} ${duma_so}"
|
|
|
|
libs="${libs# }"
|
|
|
|
CT_DoLog EXTRA "Building libraries '${libs}'"
|
|
|
|
make HOSTCC="${CT_CC_NATIVE}" \
|
|
|
|
HOSTCXX="${CT_CC_NATIVE}" \
|
|
|
|
CC="${CT_TARGET}-gcc" \
|
2008-06-19 15:30:01 +00:00
|
|
|
CXX="${CT_TARGET}-gcc" \
|
2008-06-17 22:26:44 +00:00
|
|
|
RANLIB="${CT_TARGET}-ranlib" \
|
|
|
|
DUMA_CPP="${DUMA_CPP}" \
|
|
|
|
${libs} 2>&1 |CT_DoLog ALL
|
|
|
|
CT_DoLog EXTRA "Installing libraries '${libs}'"
|
|
|
|
install -m 644 ${libs} "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL
|
2007-07-12 08:47:15 +00:00
|
|
|
if [ "${CT_DUMA_SO}" = "y" ]; then
|
2008-06-17 22:26:44 +00:00
|
|
|
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_DEBUG_INSTALL_DIR}/usr/bin"
|
|
|
|
# Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A.
|
|
|
|
cat >"${CT_DEBUG_INSTALL_DIR}/usr/bin/duma" <<_EOF_
|
|
|
|
#!/bin/sh
|
|
|
|
if [ \$# -eq 0 ]; then
|
|
|
|
echo "Usage: \$0 <executable [args]>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
export LD_PRELOAD="${duma_so}"
|
|
|
|
exec "\$@"
|
|
|
|
_EOF_
|
|
|
|
chmod 755 "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
|
2007-07-12 08:47:15 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CT_Popd
|
2008-06-17 22:26:44 +00:00
|
|
|
CT_EndStep
|
2007-07-12 08:47:15 +00:00
|
|
|
}
|
|
|
|
|