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.

105 lines
3.9 KiB

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