|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
#
|
|
|
# Filename: bin/sde-build-tools
|
|
|
# Copyright (C) 2006 - 2015 The OpenSDE Project
|
|
|
# Copyright (C) 2004 - 2006 The T2 SDE Project
|
|
|
# Copyright (C) 1998 - 2003 Clifford Wolf
|
|
|
#
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
#
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
|
# GNU General Public License can be found in the file COPYING.
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
flist_find_libc_so() {
|
|
|
# TODO: when is this criteria valid?
|
|
|
# $SHELL's libc
|
|
|
if ldd /proc/$$/exe | grep 'libc[.-]' |
|
|
|
sed -e 's:.* \(/[^ ]\+\) .*:\1:' | head -n1; then
|
|
|
return
|
|
|
fi
|
|
|
|
|
|
# TODO: scan "$xroot"/lib*/{*/,}libc[.-]*
|
|
|
}
|
|
|
|
|
|
flist_tools_clean() {
|
|
|
rm -f "$TOOLSDIR/lib/fl_wrapper.so"
|
|
|
}
|
|
|
|
|
|
flist_tools_build() {
|
|
|
FLWRAPPER_LIBC=$(flist_find_libc_so)
|
|
|
|
|
|
if [ ! -f "$FLWRAPPER_LIBC" ]; then
|
|
|
abort 'Unable to detect /lib/libc.* for flwrapper'
|
|
|
fi
|
|
|
echo_status "Building $toolsdir/lib/fl_wrapper.so ($FLWRAPPER_LIBC)."
|
|
|
|
|
|
if ! atstage native; then
|
|
|
FLWRAPPER_BASEDIR="$base"
|
|
|
else
|
|
|
FLWRAPPER_BASEDIR=
|
|
|
fi
|
|
|
|
|
|
make -s -C src/tools-source/fl_wrapper LIB="$PWD/$TOOLSDIR/lib/fl_wrapper.so" \
|
|
|
CC="$BUILDCC" LIBC="${FLWRAPPER_LIBC##*/}" BASE="$FLWRAPPER_BASEDIR" \
|
|
|
|| exit 1
|
|
|
|
|
|
echo_status "Testing $toolsdir/lib/fl_wrapper.so."
|
|
|
if ! sh -c "LD_PRELOAD=\"\$LD_PRELOAD:build/\$SDECFG_ID/`
|
|
|
`TOOLCHAIN/$toolsdir/lib/fl_wrapper.so\" date ; `
|
|
|
`exit \$?" >/dev/null 2>&1
|
|
|
then
|
|
|
echo_error "Detected a problem with the flist" \
|
|
|
"wrapper lib on your system."
|
|
|
echo_error "Please specify another flist-creation" \
|
|
|
"system in your build configuration."
|
|
|
rm -f $TOOLSDIR/lib/fl_wrapper.so
|
|
|
echo ; exit 1
|
|
|
fi
|
|
|
}
|