You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
4.0 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../libtool/parse-config
# Copyright (C) 2007 - 2008 The OpenSDE Project
# Copyright (C) 2006 The T2 SDE Project
#
# 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 ---
libtool_remove_la()
{
echo "Removing .la files..."
grep '\.la$' $builddir/flist.txt | xargs rm -fv "$root/{}"
}
# Some packges have outdated libtool that e.g. does not handle lib64. The
# LIBTOOL-QUIRK flag allows automated updating of those files.
libtool_fixup()
{
if atstage native; then
pref=$root
else
pref=$base/build/$SDECFG_ID/TOOLCHAIN/tools.cross
fi
[ -f configure.in -o -f configure.ac ] && libtoolize -c -f
find -name libtool -o -name ltmain.sh | while read fn; do
case $fn in
*libtool) cp -fv $pref/usr/bin/libtool $fn ;;
*) cp -fv $pref/usr/share/libtool/ltmain.sh $fn ;;
esac
done
}
# Many libtool and ltmain files contain an error which is hostile in
# our build environment:
# - on systems where the libdir is not */lib, libtool still searches
# /lib and /usr/lib first
# - removal of temporary paths during library search does not work,
# this concerns mainly dependency_libs in .la files where build system
# paths and other things survive
#
# We try to correct any libtool and ltmain file now:
libtool_correct_files() {
# do not do anything if we're outside builddir (like sysfiles is)
[[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
# find all libtool etal files, and sed them
find -type f -name "libtool*" -o -name "ltmain*" -o -name "ltconfig*" -o -name "ltcf*" | while read f; do
cp $f $f.ltcorrect
sed -i \
-e 's,sys_lib_dlsearch_path_spec="/lib .*$lt_ld_extra.*,sys_lib_dlsearch_path_spec="$lt_ld_extra",' \
-e "s,'s% \$path % %g',\"s% \$path % %g\",g" -e "s,'s% -L\$path % %g',\"s% -L\$path % %g\",g" \
-e 's,echo "$\(lib_search_path\|deplibs\|dependency_libs\) ",echo " $\1 ",g' \
$f
# previous sed does (per line):
# 1. Dynamic library search path
# libtool.m4/ltmain.sh use the ld.so.conf list (lt_ld_extra) of path to search for dynamic libs,
# that variable is, however prefixed with "-L/lib -L/usr/lib" statically, the latter paths are
# removed by the sed expression
# 2. Wrong quotes around sed expression
# A cleanup routine for temporary paths (grep for notinst_path) in libtool*/ltmain.* removes
# paths that should not appear after installation of the library. For this to work the "$path"
# variable must be evaluated (which is not possible with ' around it)
# 3. Sed expects a leading whitespace
# To be sure that the cleaning process (mentioned in 2.) works also for the first argument,
# a " " is prepended before it is run through the sed expression (see 2.).
diff $f.ltcorrect $f >/dev/null || echo_warning "Corrected $f"
rm -f $f.ltcorrect
done
}
libtool_final_check()
{
local ld=${libdir##*/}
# do not do anything if we're outside builddir (like sysfiles is)
[[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
if [ -f libtool -a -f $root/usr/bin/libtool ] &&
! egrep -q "sys_lib_search_path_spec=.* /usr/$ld " libtool
then
echo_warning "Overwriting libtool - configure broken beyond believe."
cp $root/usr/bin/libtool .
echo -e "#!/bin/true" > missing
fi
}
if ! atstage toolchain && hasflag LIBTOOL-QUIRK; then
hook_add preconf 8 libtool_fixup
elif ! hasflag NO-LIBTOOL-FIX; then
hook_add preconf 8 libtool_correct_files
fi
if ! hasflag NO-LIBTOOL-FIX; then
# use our libtool widely
export LIBTOOL=${archprefix}libtool
#hook_add premake 7 libtool_final_check
fi
if ! atstage native; then
hook_add postflist 5 libtool_remove_la
fi