1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/libtool/parse-config
3 # Copyright (C) 2006 - 2023 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 version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 # On cross-builds libtool gets everything, really everything that is
13 # possible mess up, messed up - seriously. Just not installing the
14 # annoying .la-hell already helps.
18 # var_append INSTALL_WRAPPER_FILTER '|' "sed -e 's,.*$root/.*lib.*\.la,/tmp/weg.la,'"
19 # didn't cut it, as some packages run some libtool finalization after the files
20 # got installed, and error out if the files are translated away, ...
22 grep '\.la$' $builddir/flist.txt |
26 var_append flistdel '|' '.*\.la'
29 hook_add postflist 5 libtool_remove_la
31 # Some packges have outdated libtool that e.g. does not handle lib64. The
32 # LIBTOOL-QUIRK flag allows automated updating of those files.
35 if atstage native; then
38 pref=$base/build/$SDECFG_ID/TOOLCHAIN/cross
41 [ -f configure.in -o -f configure.ac ] && libtoolize -c -f
43 find -name libtool -o -name ltmain.sh | while read fn; do
45 *libtool) cp -fv $pref/usr/bin/libtool $fn ;;
46 *) cp -fv $pref/usr/share/libtool/ltmain.sh $fn ;;
51 # Many libtool and ltmain files contain an error which is hostile in
52 # our build environment:
53 # - on systems where the libdir is not */lib, libtool still searches
54 # /lib and /usr/lib first
55 # - removal of temporary paths during library search does not work,
56 # this concerns mainly dependency_libs in .la files where build system
57 # paths and other things survive
59 # We try to correct any libtool and ltmain file now:
60 libtool_correct_files() {
61 # do not do anything if we're outside builddir (like sysfiles is)
62 [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
64 # find all libtool etal files, and sed them
65 find -type f -name "libtool*" -o -name "ltmain*" -o -name "ltconfig*" -o -name "ltcf*" | while read f; do
67 sed -e 's,sys_lib_dlsearch_path_spec="/lib .*$lt_ld_extra.*,sys_lib_dlsearch_path_spec="$lt_ld_extra",' \
68 -e "s,'s% \$path % %g',\"s% \$path % %g\",g" -e "s,'s% -L\$path % %g',\"s% -L\$path % %g\",g" \
69 -e 's,echo "$\(lib_search_path\|deplibs\|dependency_libs\) ",echo " $\1 ",g' \
71 touch -r $f.ltcorrect $f
73 # previous sed does (per line):
74 # 1. Dynamic library search path
75 # libtool.m4/ltmain.sh use the ld.so.conf list (lt_ld_extra) of path to search for dynamic libs,
76 # that variable is, however prefixed with "-L/lib -L/usr/lib" statically, the latter paths are
77 # removed by the sed expression
78 # 2. Wrong quotes around sed expression
79 # A cleanup routine for temporary paths (grep for notinst_path) in libtool*/ltmain.* removes
80 # paths that should not appear after installation of the library. For this to work the "$path"
81 # variable must be evaluated (which is not possible with ' around it)
82 # 3. Sed expects a leading whitespace
83 # To be sure that the cleaning process (mentioned in 2.) works also for the first argument,
84 # a " " is prepended before it is run through the sed expression (see 2.).
86 diff $f.ltcorrect $f >/dev/null || echo_warning "Corrected $f"
91 libtool_final_check() {
92 local ld=${libdir##*/}
93 # do not do anything if we're outside builddir (like sysfiles is)
94 [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
95 if [ -f libtool -a -f $root/usr/bin/libtool ] &&
96 ! egrep -q "sys_lib_search_path_spec=.* /usr/$ld " libtool
98 echo_warning "Overwriting libtool: configure broken beyond believe"
99 cp $root/usr/bin/libtool .
100 echo -e "#!/bin/true" > missing
104 if ! atstage toolchain && hasflag LIBTOOL-QUIRK; then
105 hook_add preconf 8 libtool_fixup
106 elif ! hasflag NO-LIBTOOL-FIX; then
107 hook_add preconf 8 libtool_correct_files
110 #hook_add premake 7 libtool_final_check