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.

120 lines
4.1 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) 2007 - 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. libtool_remove_la()
  16. {
  17. echo "Removing .la files..."
  18. grep '\.la$' $builddir/flist.txt | xargs rm -fv "$root/{}"
  19. }
  20. # Some packges have outdated libtool that e.g. does not handle lib64. The
  21. # LIBTOOL-QUIRK flag allows automated updating of those files.
  22. libtool_fixup()
  23. {
  24. local pref= ltmain=
  25. if atstage native; then
  26. pref="$root"
  27. else
  28. pref="$base/build/$SDECFG_ID/TOOLCHAIN/tools.cross"
  29. fi
  30. for ltmain in "$pref/usr/share/libtool"/{,config/}ltmain.sh; do
  31. [ ! -s "$ltmain" ] || break
  32. done
  33. [ -f configure.in -o -f configure.ac ] && libtoolize -c -f
  34. find -name libtool -o -name ltmain.sh | while read fn; do
  35. case "$fn" in
  36. *libtool) cp -fv "$pref/usr/bin/libtool" "$fn" ;;
  37. *) cp -fv "$ltmain" "$fn" ;;
  38. esac
  39. done
  40. }
  41. # Many libtool and ltmain files contain an error which is hostile in
  42. # our build environment:
  43. # - on systems where the libdir is not */lib, libtool still searches
  44. # /lib and /usr/lib first
  45. # - removal of temporary paths during library search does not work,
  46. # this concerns mainly dependency_libs in .la files where build system
  47. # paths and other things survive
  48. #
  49. # We try to correct any libtool and ltmain file now:
  50. libtool_correct_files() {
  51. # do not do anything if we're outside builddir (like sysfiles is)
  52. [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
  53. # find all libtool etal files, and sed them
  54. find -type f -name "libtool*" -o -name "ltmain*" -o -name "ltconfig*" -o -name "ltcf*" | while read f; do
  55. cp $f $f.ltcorrect
  56. sed -i \
  57. -e 's,sys_lib_dlsearch_path_spec="/lib .*$lt_ld_extra.*,sys_lib_dlsearch_path_spec="$lt_ld_extra",' \
  58. -e "s,'s% \$path % %g',\"s% \$path % %g\",g" -e "s,'s% -L\$path % %g',\"s% -L\$path % %g\",g" \
  59. -e 's,echo "$\(lib_search_path\|deplibs\|dependency_libs\) ",echo " $\1 ",g' \
  60. $f
  61. # previous sed does (per line):
  62. # 1. Dynamic library search path
  63. # libtool.m4/ltmain.sh use the ld.so.conf list (lt_ld_extra) of path to search for dynamic libs,
  64. # that variable is, however prefixed with "-L/lib -L/usr/lib" statically, the latter paths are
  65. # removed by the sed expression
  66. # 2. Wrong quotes around sed expression
  67. # A cleanup routine for temporary paths (grep for notinst_path) in libtool*/ltmain.* removes
  68. # paths that should not appear after installation of the library. For this to work the "$path"
  69. # variable must be evaluated (which is not possible with ' around it)
  70. # 3. Sed expects a leading whitespace
  71. # To be sure that the cleaning process (mentioned in 2.) works also for the first argument,
  72. # a " " is prepended before it is run through the sed expression (see 2.).
  73. diff $f.ltcorrect $f >/dev/null || echo_warning "Corrected $f"
  74. rm -f $f.ltcorrect
  75. done
  76. }
  77. libtool_final_check()
  78. {
  79. local ld=${libdir##*/}
  80. # do not do anything if we're outside builddir (like sysfiles is)
  81. [[ ${PWD//src.$pkg.$config.$id/} = $PWD ]] && return
  82. if [ -f libtool -a -f $root/usr/bin/libtool ] &&
  83. ! egrep -q "sys_lib_search_path_spec=.* /usr/$ld " libtool
  84. then
  85. echo_warning "Overwriting libtool - configure broken beyond believe."
  86. cp $root/usr/bin/libtool .
  87. echo -e "#!/bin/true" > missing
  88. fi
  89. }
  90. if ! atstage toolchain && hasflag LIBTOOL-QUIRK; then
  91. hook_add preconf 8 libtool_fixup
  92. elif ! hasflag NO-LIBTOOL-FIX; then
  93. hook_add preconf 8 libtool_correct_files
  94. fi
  95. if ! hasflag NO-LIBTOOL-FIX; then
  96. # use our libtool widely
  97. export LIBTOOL=${archprefix}libtool
  98. #hook_add premake 7 libtool_final_check
  99. fi
  100. if ! atstage native; then
  101. hook_add postflist 5 libtool_remove_la
  102. fi