# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/libtool/parse-config # Copyright (C) 2006 - 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # 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 version 2. # --- T2-COPYRIGHT-NOTE-END --- # On cross-builds libtool gets everything, really everything that is # possible mess up, messed up - seriously. Just not installing the # annoying .la-hell already helps. # libtool_remove_la() { # A simple: # var_append INSTALL_WRAPPER_FILTER '|' "sed -e 's,.*$root/.*lib.*\.la,/tmp/weg.la,'" # didn't cut it, as some packages run some libtool finalization after the files # got installed, and error out if the files are translated away, ... grep '\.la$' $builddir/flist.txt | while read f; do rm -fv "$root/$f" done var_append flistdel '|' '.*\.la' } #atstage native || hook_add postflist 5 libtool_remove_la # 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/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 mv $f $f.ltcorrect sed -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.ltcorrect > $f touch -r $f.ltcorrect $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 #hook_add premake 7 libtool_final_check