1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/libtool/parse-config
3 # Copyright (C) 2006 - 2021 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; version 2 of the License. A copy of the
11 # GNU General Public License can be found in the file COPYING.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 # On cross-builds libtool gets everything, really everything that is
15 # possible mess up, messed up - seriously. Just not installing the
16 # annoying .la-hell already helps.
21 # var_append INSTALL_WRAPPER_FILTER '|' "sed -e 's,.*$root/.*lib.*\.la,/tmp/weg.la,'"
22 # didn't cut it, as some packages run some libtool finalization after the files
23 # got installed, and error out if the files are translated away, ...
25 grep '\.la$' $builddir/flist.txt |
29 var_append flistdel '|' '.*\.la'
31 atstage native || hook_add postflist 5 libtool_remove_la
33 # Some packges have outdated libtool that e.g. does not handle lib64. The
34 # LIBTOOL-QUIRK flag allows automated updating of those files.
38 if atstage native; then
41 pref=$base/build/$SDECFG_ID/TOOLCHAIN/tools.cross
44 [ -f configure.in -o -f configure.ac ] && libtoolize -c -f
46 find -name libtool -o -name ltmain.sh | while read fn; do
48 *libtool) cp -fv $pref/usr/bin/libtool $fn ;;
49 *) cp -fv $pref/usr/share/libtool/ltmain.sh $fn ;;
54 # Many libtool and ltmain files contain an error which is hostile in
55 # our build environment:
56 # - on systems where the libdir is not */lib, libtool still searches
57 # /lib and /usr/lib first
58 # - removal of temporary paths during library search does not work,
59 # this concerns mainly dependency_libs in .la files where build system
60 # paths and other things survive
62 # We try to correct any libtool and ltmain file now:
63 libtool_correct_files() {
64 # do not do anything if we're outside builddir (like sysfiles is)
65 [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
67 # find all libtool etal files, and sed them
68 find -type f -name "libtool*" -o -name "ltmain*" -o -name "ltconfig*" -o -name "ltcf*" | while read f; do
70 sed -e 's,sys_lib_dlsearch_path_spec="/lib .*$lt_ld_extra.*,sys_lib_dlsearch_path_spec="$lt_ld_extra",' \
71 -e "s,'s% \$path % %g',\"s% \$path % %g\",g" -e "s,'s% -L\$path % %g',\"s% -L\$path % %g\",g" \
72 -e 's,echo "$\(lib_search_path\|deplibs\|dependency_libs\) ",echo " $\1 ",g' \
74 touch -r $f.ltcorrect $f
76 # previous sed does (per line):
77 # 1. Dynamic library search path
78 # libtool.m4/ltmain.sh use the ld.so.conf list (lt_ld_extra) of path to search for dynamic libs,
79 # that variable is, however prefixed with "-L/lib -L/usr/lib" statically, the latter paths are
80 # removed by the sed expression
81 # 2. Wrong quotes around sed expression
82 # A cleanup routine for temporary paths (grep for notinst_path) in libtool*/ltmain.* removes
83 # paths that should not appear after installation of the library. For this to work the "$path"
84 # variable must be evaluated (which is not possible with ' around it)
85 # 3. Sed expects a leading whitespace
86 # To be sure that the cleaning process (mentioned in 2.) works also for the first argument,
87 # a " " is prepended before it is run through the sed expression (see 2.).
89 diff $f.ltcorrect $f >/dev/null || echo_warning "Corrected $f"
96 local ld=${libdir##*/}
97 # do not do anything if we're outside builddir (like sysfiles is)
98 [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
99 if [ -f libtool -a -f $root/usr/bin/libtool ] &&
100 ! egrep -q "sys_lib_search_path_spec=.* /usr/$ld " libtool
102 echo_warning "Overwriting libtool: configure broken beyond believe"
103 cp $root/usr/bin/libtool .
104 echo -e "#!/bin/true" > missing
108 if ! atstage toolchain && hasflag LIBTOOL-QUIRK; then
109 hook_add preconf 8 libtool_fixup
110 elif ! hasflag NO-LIBTOOL-FIX; then
111 hook_add preconf 8 libtool_correct_files
114 #hook_add premake 7 libtool_final_check