OpenSDE Packages Database (without history before r20070)
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.

98 lines
3.7 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../libtool/parse-config
  5. # Copyright (C) 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- T2-COPYRIGHT-NOTE-END ---
  14. # Some packges have outdated libtool that e.g. does not handle lib64. The
  15. # LIBTOOL-QUIRK flag allows automated updating of those files.
  16. libtool_fixup()
  17. {
  18. if atstage native; then
  19. pref=$root
  20. else
  21. pref=$base/build/$SDECFG_ID/TOOLCHAIN/tools.cross
  22. fi
  23. [ -f configure.in -o -f configure.ac ] && libtoolize -c -f
  24. find -name libtool -o -name ltmain.sh | while read fn; do
  25. case $fn in
  26. *libtool) cp -fv $pref/usr/bin/libtool $fn ;;
  27. *) cp -fv $pref/usr/share/libtool/ltmain.sh $fn ;;
  28. esac
  29. done
  30. }
  31. # Many libtool and ltmain files contain an error which is hostile in
  32. # our build environment:
  33. # - on systems where the libdir is not */lib, libtool still searches
  34. # /lib and /usr/lib first
  35. # - removal of temporary paths during library search does not work,
  36. # this concerns mainly dependency_libs in .la files where build system
  37. # paths and other things survive
  38. #
  39. # We try to correct any libtool and ltmain file now:
  40. libtool_correct_files() {
  41. # do not do anything if we're outside builddir (like sysfiles is)
  42. [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
  43. # find all libtool etal files, and sed them
  44. find -type f -name "libtool*" -o -name "ltmain*" -o -name "ltconfig*" -o -name "ltcf*" | while read f; do
  45. cp $f $f.ltcorrect
  46. sed -i \
  47. -e 's,sys_lib_dlsearch_path_spec="/lib .*$lt_ld_extra.*,sys_lib_dlsearch_path_spec="$lt_ld_extra",' \
  48. -e "s,'s% \$path % %g',\"s% \$path % %g\",g" -e "s,'s% -L\$path % %g',\"s% -L\$path % %g\",g" \
  49. -e 's,echo "$\(lib_search_path\|deplibs\|dependency_libs\) ",echo " $\1 ",g' \
  50. $f
  51. # previous sed does (per line):
  52. # 1. Dynamic library search path
  53. # libtool.m4/ltmain.sh use the ld.so.conf list (lt_ld_extra) of path to search for dynamic libs,
  54. # that variable is, however prefixed with "-L/lib -L/usr/lib" statically, the latter paths are
  55. # removed by the sed expression
  56. # 2. Wrong quotes around sed expression
  57. # A cleanup routine for temporary paths (grep for notinst_path) in libtool*/ltmain.* removes
  58. # paths that should not appear after installation of the library. For this to work the "$path"
  59. # variable must be evaluated (which is not possible with ' around it)
  60. # 3. Sed expects a leading whitespace
  61. # To be sure that the cleaning process (mentioned in 2.) works also for the first argument,
  62. # a " " is prepended before it is run through the sed expression (see 2.).
  63. diff $f.ltcorrect $f >/dev/null || echo_warning "Corrected $f"
  64. rm -f $f.ltcorrect
  65. done
  66. }
  67. libtool_final_check()
  68. {
  69. local ld=${libdir##*/}
  70. # do not do anything if we're outside builddir (like sysfiles is)
  71. [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
  72. if [ -f libtool -a -f $root/usr/bin/libtool ] &&
  73. ! egrep -q "sys_lib_search_path_spec=.* /usr/$ld " libtool
  74. then
  75. echo_warning "Overwriting libtool - configure broken beyond believe."
  76. cp $root/usr/bin/libtool .
  77. echo -e "#!/bin/true" > missing
  78. fi
  79. }
  80. if ! atstage toolchain && hasflag LIBTOOL-QUIRK; then
  81. hook_add preconf 8 libtool_fixup
  82. elif ! hasflag NO-LIBTOOL-FIX; then
  83. hook_add preconf 8 libtool_correct_files
  84. fi
  85. #hook_add premake 7 libtool_final_check