summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2005-03-23 18:03:21 +0000
committerMartin Schlemmer <azarah@gentoo.org>2005-03-23 18:03:21 +0000
commite7bd8fe6c3110b21cffeadb4698f88ac19d1b67c (patch)
treef174fa86abffe1a22b6377bc598b184f2c1402da /eclass
parentUse correct toolchain compiler. (diff)
downloadgentoo-2-e7bd8fe6c3110b21cffeadb4698f88ac19d1b67c.tar.gz
gentoo-2-e7bd8fe6c3110b21cffeadb4698f88ac19d1b67c.tar.bz2
gentoo-2-e7bd8fe6c3110b21cffeadb4698f88ac19d1b67c.zip
Fixups for bug #83486.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ELT-patches/fix-relink/1.4.016
-rw-r--r--eclass/ELT-patches/portage/1.4.074
-rw-r--r--eclass/ELT-patches/relink/1.4.0a99
-rw-r--r--eclass/ELT-patches/sed/1.4.014
-rw-r--r--eclass/ELT-patches/test/1.4.0291
-rw-r--r--eclass/libtool.eclass131
6 files changed, 574 insertions, 51 deletions
diff --git a/eclass/ELT-patches/fix-relink/1.4.0 b/eclass/ELT-patches/fix-relink/1.4.0
index c8edade31e35..1b12c9b1a360 100644
--- a/eclass/ELT-patches/fix-relink/1.4.0
+++ b/eclass/ELT-patches/fix-relink/1.4.0
@@ -1,14 +1,14 @@
--- ltmain.sh 2003-09-24 18:22:17.528129376 +0200
+++ ltmain.sh 2003-09-24 18:23:17.101072912 +0200
@@ -1582,6 +1582,8 @@
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
-+ # PKGW
-+ dependency_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if test "X$duplicate_deps" = "Xyes" ; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ tmp_libs=
++ # PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ #echo "Adding $deplib to \$deplibs"
+ deplibs="$deplib $deplibs"
@@ -1699,6 +1701,8 @@
fi
diff --git a/eclass/ELT-patches/portage/1.4.0 b/eclass/ELT-patches/portage/1.4.0
new file mode 100644
index 000000000000..a49f33329f93
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.4.0
@@ -0,0 +1,74 @@
+Note that if you update this patch, please update this one as well:
+
+ eclass/ELT-patches/portage/1.4.1
+
+The file name can stay 1.4.1, as it will still apply to all versions. Only
+when a new version of libtool comes out that it do not apply to, then the
+name should be bumped, but the patch content should stay fairly the same.
+
+--- ltmain.sh Wed Apr 3 01:19:37 2002
++++ ltmain.sh Sun May 26 19:50:52 2002
+@@ -3940,9 +3940,50 @@
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+- newdependency_libs="$newdependency_libs $libdir/$name"
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$PWORKDIR"; then
++ S="$PWORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
+ ;;
+- *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+@@ -3975,6 +4005,10 @@
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ fi
+ $echo > $output "\
+ # $outputname - a libtool library file
+ # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
diff --git a/eclass/ELT-patches/relink/1.4.0a b/eclass/ELT-patches/relink/1.4.0a
new file mode 100644
index 000000000000..382d76087e62
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.0a
@@ -0,0 +1,99 @@
+--- ltmain.sh Wed Oct 3 02:05:35 2001
++++ ltmain.sh Wed Oct 3 05:16:14 2001
+@@ -754,6 +754,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -884,6 +885,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -985,6 +991,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1866,6 +1877,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1886,10 +1898,22 @@
+ add="-l$name"
+ fi
+
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3856,7 +3880,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="($relink_command; cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="($relink_command; cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4157,6 +4181,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
diff --git a/eclass/ELT-patches/sed/1.4.0 b/eclass/ELT-patches/sed/1.4.0
new file mode 100644
index 000000000000..9c51ac2de0ff
--- /dev/null
+++ b/eclass/ELT-patches/sed/1.4.0
@@ -0,0 +1,14 @@
+--- ltmain.sh 2003-02-13 14:54:24.000000000 +0100
++++ ltmain.sh 2003-02-13 15:24:49.000000000 +0100
+@@ -48,6 +48,11 @@ EOF
+ exit 0
+ fi
+
++# define variables for historic ltconfig's generated by Libtool 1.3
++test -z "$SED" && SED=sed
++test -z "$EGREP" && EGREP=egrep
++test -z "$LTCC" && LTCC=${CC-gcc}
++
+ # The name of this program.
+ progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+ modename="$progname"
diff --git a/eclass/ELT-patches/test/1.4.0 b/eclass/ELT-patches/test/1.4.0
new file mode 100644
index 000000000000..d6f442f0e38d
--- /dev/null
+++ b/eclass/ELT-patches/test/1.4.0
@@ -0,0 +1,291 @@
+--- ltmain.sh Tue May 29 19:16:03 2001
++++ ltmain.sh Tue May 29 21:26:50 2001
+@@ -459,7 +459,7 @@
+ pic_mode=default
+ ;;
+ esac
+- if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
++ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+@@ -1343,7 +1343,7 @@
+ ;;
+ esac
+ for pass in $passes; do
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # Determine which files to process
+ case $pass in
+ dlopen)
+@@ -1360,11 +1360,11 @@
+ found=no
+ case $deplib in
+ -l*)
+- if test $linkmode = oldlib && test $linkmode = obj; then
++ if test "$linkmode" = oldlib && test "$linkmode" = obj; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+ continue
+ fi
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1384,7 +1384,7 @@
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+- test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
++ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+@@ -1393,16 +1393,16 @@
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+- test $pass = conv && continue
++ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+- if test $pass = scan; then
++ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+@@ -1417,7 +1417,7 @@
+ continue
+ ;; # -L
+ -R*)
+- if test $pass = link; then
++ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+@@ -1430,7 +1430,7 @@
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1451,7 +1451,7 @@
+ continue
+ ;;
+ prog)
+- if test $pass != link; then
++ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+@@ -1462,7 +1462,7 @@
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+- if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
++ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+@@ -1512,13 +1512,13 @@
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+- { test $linkmode = oldlib && test $linkmode = obj; }; then
++ { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
+ # Add dl[pre]opened files of deplib
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+@@ -1537,7 +1537,7 @@
+ esac
+ tmp_libs="$tmp_libs $deplib"
+ done
+- elif test $linkmode != prog && test $linkmode != lib; then
++ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+@@ -1555,7 +1555,7 @@
+ fi
+
+ # This library was specified with -dlopen.
+- if test $pass = dlopen; then
++ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1604,7 +1604,7 @@
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1623,7 +1623,7 @@
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+@@ -1634,7 +1634,7 @@
+ continue
+ fi
+
+- if test $linkmode = prog && test $pass != link; then
++ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+@@ -1671,7 +1671,7 @@
+ # Link against this shared library
+
+ if test "$linkmode,$pass" = "prog,link" ||
+- { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
++ { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+@@ -1693,7 +1693,7 @@
+ esac
+ ;;
+ esac
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+@@ -1777,7 +1777,7 @@
+ linklib=$newlib
+ fi # test -n $old_archive_from_expsyms_cmds
+
+- if test $linkmode = prog || test "$mode" != relink; then
++ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1826,7 +1826,7 @@
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+@@ -1843,7 +1843,7 @@
+ fi
+ fi
+
+- if test $linkmode = prog || test "$mode" = relink; then
++ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1865,7 +1865,7 @@
+ add="-l$name"
+ fi
+
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+@@ -1873,7 +1873,7 @@
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+- elif test $linkmode = prog; then
++ elif test "$linkmode" = prog; then
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+@@ -1932,9 +1932,9 @@
+ fi
+ fi # link shared/static library?
+
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+- { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
++ { test "$hardcode_into_libs" != yes || test $build_old_libs = yes ||
+ test $link_static = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+@@ -1964,7 +1964,7 @@
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+- if test $link_all_deplibs != no; then
++ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+@@ -2007,15 +2007,15 @@
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+- if test $pass != dlopen; then
+- test $pass != scan && dependency_libs="$newdependency_libs"
+- if test $pass != conv; then
++ if test "$pass" != dlopen; then
++ test "$pass" != scan && dependency_libs="$newdependency_libs"
++ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+@@ -2073,7 +2073,7 @@
+ deplibs=
+ fi
+ done # for pass
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+@@ -2410,7 +2410,7 @@
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+- if test $build_libtool_need_lc = "yes"; then
++ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+@@ -2683,7 +2683,7 @@
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+- if test $hardcode_into_libs = yes; then
++ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
diff --git a/eclass/libtool.eclass b/eclass/libtool.eclass
index 81488d72ec2c..a23e8ad76d58 100644
--- a/eclass/libtool.eclass
+++ b/eclass/libtool.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.43 2005/02/27 20:29:04 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.44 2005/03/23 18:03:21 azarah Exp $
#
# Author: Martin Schlemmer <azarah@gentoo.org>
#
@@ -20,7 +20,7 @@ INHERITED="${INHERITED} ${ECLASS}"
DESCRIPTION="Based on the ${ECLASS} eclass"
-ELIBTOOL_VERSION="2.0.1"
+ELIBTOOL_VERSION="2.0.2"
ELT_PATCH_DIR="${PORTDIR}/eclass/ELT-patches"
ELT_APPLIED_PATCHES=
@@ -68,7 +68,8 @@ ELT_walk_patches() {
local y=
local ret=1
local patch_dir=
- local version=$(eval $(grep -e '^[[:space:]]*VERSION=' $1); echo "${VERSION}")
+ local version=$(eval $(grep -e '^[[:space:]]*VERSION=' $1); \
+ echo "${VERSION}")
if [[ -n $2 ]] ; then
if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then
@@ -77,50 +78,35 @@ ELT_walk_patches() {
return ${ret}
fi
- # First check a version specific patch, if not check major.minor*
- for y in ${version} $(echo "${version}" | cut -d. -f1,2) ; do
- [[ -z ${y} ]] && continue
- for x in $(ls -d "${patch_dir}/${y}"* 2> /dev/null) ; do
- if [[ -n ${x} && -f ${x} ]] ; then
- # For --remove-internal-dep ...
- if [[ -n $3 ]] ; then
- # For replace @REM_INT_DEP@ with what was passed
- # to --remove-internal-dep
- sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \
- ${T}/$$.rem_int_deps.patch
-
- x="${T}/$$.rem_int_deps.patch"
- fi
+ if [[ -z ${version} ]] ; then
+ eerror "Could not get VERSION for ${1##*/}!"
+ die "Could not get VERSION for ${1##*/}!"
+ fi
- if ELT_try_and_apply_patch "$1" "${x}" ; then
- ret=0
- break
- fi
+ # Go through the patches in reverse order (large to small)
+ for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do
+ if [[ -n ${x} && -f ${x} ]] ; then
+ local ltver=$(VER_to_int "${version}")
+ local ptver=$(VER_to_int "${x##*/}")
+
+ # If libtool version smaller than patch version, skip patch.
+ [[ ${ltver} -lt ${ptver} ]] && continue
+ # For --remove-internal-dep ...
+ if [[ -n $3 ]] ; then
+ # For replace @REM_INT_DEP@ with what was passed
+ # to --remove-internal-dep
+ sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \
+ ${T}/$$.rem_int_deps.patch
+
+ x="${T}/$$.rem_int_deps.patch"
fi
- done
- done
- # If still nothing, try the rest.
- if [[ ${ret} -eq 1 ]]; then
- for x in $(ls -d "${patch_dir}"/* 2> /dev/null) ; do
- if [[ -n ${x} && -f ${x} ]] ; then
- # For --remove-internal-dep ...
- if [[ -n $3 ]] ; then
- # For replace @REM_INT_DEP@ with what was passed
- # to --remove-internal-dep
- sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \
- ${T}/$$.rem_int_deps.patch
-
- x="${T}/$$.rem_int_deps.patch"
- fi
-
- if ELT_try_and_apply_patch "$1" "${x}" ; then
- ret=0
- break
- fi
+ if ELT_try_and_apply_patch "$1" "${x}" ; then
+ ret=0
+ break
fi
- done
- fi
+ fi
+ done
fi
return ${ret}
@@ -345,3 +331,62 @@ darwintoolize() {
esac
done
}
+
+# char *VER_major(string)
+#
+# Return the Major (X of X.Y.Z) version
+#
+VER_major() {
+ [[ -z $1 ]] && return 1
+
+ local VER=$@
+ echo ${VER%%[^[:digit:]]*}
+}
+
+# char *VER_minor(string)
+#
+# Return the Minor (Y of X.Y.Z) version
+#
+VER_minor() {
+ [[ -z $1 ]] && return 1
+
+ local VER=$@
+ VER=${VER#*.}
+ echo ${VER%%[^[:digit:]]*}
+}
+
+# char *VER_micro(string)
+#
+# Return the Micro (Z of X.Y.Z) version.
+#
+VER_micro() {
+ [[ -z $1 ]] && return 1
+
+ local VER=$@
+ VER=${VER#*.*.}
+ echo ${VER%%[^[:digit:]]*}
+}
+
+# int VER_to_int(string)
+#
+# Convert a string type version (2.4.0) to an int (132096)
+# for easy compairing or versions ...
+#
+VER_to_int() {
+ [[ -z $1 ]] && return 1
+
+ local VER_MAJOR=$(VER_major "$1")
+ local VER_MINOR=$(VER_minor "$1")
+ local VER_MICRO=$(VER_micro "$1")
+ local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO ))
+
+ # We make version 1.0.0 the minimum version we will handle as
+ # a sanity check ... if its less, we fail ...
+ if [[ ${VER_int} -ge 65536 ]] ; then
+ echo "${VER_int}"
+ return 0
+ fi
+
+ echo 1
+ return 1
+}