Merge uclibctoolize() stuff with elibtoolize(), and add required
authorMartin Schlemmer <azarah@gentoo.org>
Fri, 2 Sep 2005 21:12:09 +0000 (21:12 +0000)
committerMartin Schlemmer <azarah@gentoo.org>
Fri, 2 Sep 2005 21:12:09 +0000 (21:12 +0000)
patches to make elibtoolize not bork on portage patch failing.

eclass/ELT-patches/portage/1.2.0 [new file with mode: 0644]
eclass/ELT-patches/portage/1.3.0c [new file with mode: 0644]
eclass/ELT-patches/uclibc-conf/1.2.0 [new file with mode: 0644]
eclass/ELT-patches/uclibc-conf/1.3.0c [new file with mode: 0644]
eclass/ELT-patches/uclibc-ltconf/1.2.0 [new file with mode: 0644]
eclass/ELT-patches/uclibc-ltconf/1.3.0 [new file with mode: 0644]
eclass/libtool.eclass

diff --git a/eclass/ELT-patches/portage/1.2.0 b/eclass/ELT-patches/portage/1.2.0
new file mode 100644 (file)
index 0000000..0d0102d
--- /dev/null
@@ -0,0 +1,13 @@
+# Dummy patch, not needed by libtool-1.2
+
+--- ltmain.sh  2005-09-02 21:42:18.000000000 +0200
++++ ltmain.sh  2005-09-02 21:42:34.000000000 +0200
+@@ -29,7 +29,7 @@
+ 
+ # Constants.
+ PROGRAM=ltmain.sh
+-PACKAGE=libtool
++PACKAGE=libtool
+ VERSION=1.2
+ 
+ default_mode=
diff --git a/eclass/ELT-patches/portage/1.3.0c b/eclass/ELT-patches/portage/1.3.0c
new file mode 100644 (file)
index 0000000..d2166f1
--- /dev/null
@@ -0,0 +1,66 @@
+--- ltmain.sh  2005-09-02 22:19:17.000000000 +0200
++++ ltmain.sh  2005-09-02 22:20:55.000000000 +0200
+@@ -3769,9 +3769,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"
+@@ -3799,6 +3840,10 @@
+           dlprefiles="$newdlprefiles"
+         fi
+         $rm $output
++        # 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/uclibc-conf/1.2.0 b/eclass/ELT-patches/uclibc-conf/1.2.0
new file mode 100644 (file)
index 0000000..acd804c
--- /dev/null
@@ -0,0 +1,48 @@
+--- configure.libltdl~ Fri Jun 11 08:54:04 2004
++++ configure  Fri Jun 11 08:56:33 2004
+@@ -1978,6 +1978,11 @@
+   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+   ;;
+ 
++linux-uclibc*)
++  lt_cv_deplibs_check_method=pass_all
++  lt_cv_file_magic_test_file=`echo /lib/libuClibc*.so`
++  ;;
++
+ netbsd*)
+   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+     lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -3030,7 +3035,7 @@
+ 
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+ 
+@@ -4504,6 +4509,24 @@
+   dynamic_linker='GNU/Linux ld.so'
+   ;;
+ 
++linux-uclibc*)
++  version_type=linux
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++  soname_spec='${libname}${release}.so$major'
++  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++  shlibpath_var=LD_LIBRARY_PATH
++  shlibpath_overrides_runpath=no
++  # This implies no fast_install, which is unacceptable.
++  # Some rework will be needed to allow for fast_install
++  # before this can be enabled.
++  # Note: copied from linux-gnu, and may not be appropriate.
++  hardcode_into_libs=yes
++  # Assume using the uClibc dynamic linker.
++  dynamic_linker="uClibc ld.so"
++  ;;
++
+ netbsd*)
+   version_type=sunos
+   need_lib_prefix=no
diff --git a/eclass/ELT-patches/uclibc-conf/1.3.0c b/eclass/ELT-patches/uclibc-conf/1.3.0c
new file mode 100644 (file)
index 0000000..03efc5d
--- /dev/null
@@ -0,0 +1,48 @@
+--- configure.libltdl~ Fri Jun 11 08:54:04 2004
++++ configure  Fri Jun 11 08:56:33 2004
+@@ -1978,6 +1978,11 @@
+   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+   ;;
+ 
++linux-uclibc*)
++  lt_cv_deplibs_check_method=pass_all
++  lt_cv_file_magic_test_file=`echo /lib/libuClibc*.so`
++  ;;
++
+ netbsd*)
+   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+     lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -3030,7 +3035,7 @@
+ 
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case "$host_os" in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+ 
+@@ -4504,6 +4509,24 @@
+   dynamic_linker='GNU/Linux ld.so'
+   ;;
+ 
++linux-uclibc*)
++  version_type=linux
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++  soname_spec='${libname}${release}.so$major'
++  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++  shlibpath_var=LD_LIBRARY_PATH
++  shlibpath_overrides_runpath=no
++  # This implies no fast_install, which is unacceptable.
++  # Some rework will be needed to allow for fast_install
++  # before this can be enabled.
++  # Note: copied from linux-gnu, and may not be appropriate.
++  hardcode_into_libs=yes
++  # Assume using the uClibc dynamic linker.
++  dynamic_linker="uClibc ld.so"
++  ;;
++
+ netbsd*)
+   version_type=sunos
+   need_lib_prefix=no
diff --git a/eclass/ELT-patches/uclibc-ltconf/1.2.0 b/eclass/ELT-patches/uclibc-ltconf/1.2.0
new file mode 100644 (file)
index 0000000..bbc6bc9
--- /dev/null
@@ -0,0 +1,36 @@
+--- ltconfig.uclibc    2004-01-14 22:07:42.000000000 +0100
++++ ltconfig   2004-03-10 15:43:37.000000000 +0100
+@@ -603,6 +603,7 @@
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+ linux-gnu*) ;;
++linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+ 
+@@ -1259,6 +1260,25 @@
+   fi
+   ;;
+ 
++linux-uclibc*)
++  version_type=linux
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
++  soname_spec='${libname}${release}.so.$major'
++  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++  shlibpath_var=LD_LIBRARY_PATH
++  shlibpath_overrides_runpath=no
++  deplibs_check_method=pass_all
++  # This implies no fast_install, which is unacceptable.
++  # Some rework will be needed to allow for fast_install
++  # before this can be enabled.
++  # Note: copied from linux-gnu, and may not be appropriate.
++  hardcode_into_libs=yes
++  # Assume using the uClibc dynamic linker.
++  dynamic_linker="uClibc ld.so"
++  ;;
++
+ netbsd* | openbsd*)
+   version_type=sunos
+   library_names_spec='${libname}${release}.so.$versuffix'
diff --git a/eclass/ELT-patches/uclibc-ltconf/1.3.0 b/eclass/ELT-patches/uclibc-ltconf/1.3.0
new file mode 100644 (file)
index 0000000..0a5a9ea
--- /dev/null
@@ -0,0 +1,39 @@
+--- ltconfig.uclibc    2004-01-14 22:07:42.000000000 +0100
++++ ltconfig   2004-03-10 15:43:37.000000000 +0100
+@@ -603,6 +603,7 @@
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+ linux-gnu*) ;;
++linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+ 
+@@ -1259,6 +1260,28 @@
+   dynamic_linker='GNU/Linux ld.so'
+   ;;
+ 
++linux-uclibc*)
++  version_type=linux
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++  soname_spec='${libname}${release}.so$major'
++  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++  shlibpath_var=LD_LIBRARY_PATH
++  shlibpath_overrides_runpath=no
++  # deplibs_check_method=pass_all
++  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
++  file_magic_cmd=/usr/bin/file
++  file_magic_test_file=`echo /lib/libuClibc-*.so`
++  # This implies no fast_install, which is unacceptable.
++  # Some rework will be needed to allow for fast_install
++  # before this can be enabled.
++  # Note: copied from linux-gnu, and may not be appropriate.
++  hardcode_into_libs=yes
++  # Assume using the uClibc dynamic linker.
++  dynamic_linker="uClibc ld.so"
++  ;;
++
+ netbsd*)
+   need_lib_prefix=no
+   need_version=no
index aa7c86fec02684b66489b30bc36c43663a9e355e..f924016db544924e286fbdbd3c3313cea3f4b047 100644 (file)
@@ -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.52 2005/09/02 10:02:50 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.53 2005/09/02 21:12:09 azarah Exp $
 #
 # Author: Martin Schlemmer <azarah@gentoo.org>
 #
@@ -22,6 +22,7 @@ ELIBTOOL_VERSION="2.0.2"
 
 ELT_PATCH_DIR="${PORTDIR}/eclass/ELT-patches"
 ELT_APPLIED_PATCHES=
+ELT_LTMAIN_SH=
 
 #
 # Returns all the directories containing ltmain.sh
@@ -66,7 +67,11 @@ ELT_walk_patches() {
        local y=
        local ret=1
        local patch_dir=
-       local version=$(eval $(grep -e '^[[:space:]]*VERSION=' $1); \
+       local version=
+       local ltmain_sh=$1
+       
+       [[ $1 == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH}
+       version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \
                                        echo "${VERSION}")
 
        if [[ -n $2 ]] ; then
@@ -118,7 +123,8 @@ elibtoolize() {
        local do_only_patches="no"
        local deptoremove=
        local my_dirlist=
-       local elt_patches="portage relink max_cmd_len sed test tmp"
+       local elt_patches="portage relink max_cmd_len sed test tmp \
+                          uclibc-conf uclibc-ltconf"
        local start_dir="${PWD}"
 
        my_dirlist="$(ELT_find_ltmain_sh)"
@@ -176,6 +182,7 @@ elibtoolize() {
        for x in ${my_dirlist} ; do
                local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
                export ELT_APPLIED_PATCHES=
+               export ELT_LTMAIN_SH="${x}/ltmain.sh"
 
                [[ -f ${x}/.elibtoolized ]] && continue
 
@@ -204,6 +211,24 @@ elibtoolize() {
                                                ret=$?
                                        fi
                                        ;;
+                               "uclibc-conf")
+                                       if [[ -e ${x}/configure ]] && \
+                                          grep 'Transform linux' "${x}/configure" > /dev/null ; then
+                                               ELT_walk_patches "${x}/configure" "${y}"
+                                               ret=$?
+                                       # ltmain.sh and co might be in a subdirectory ...
+                                       elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
+                                          grep 'Transform linux' "${x}/../configure" > /dev/null ; then
+                                               ELT_walk_patches "${x}/../configure" "${y}"
+                                               ret=$?
+                                       fi
+                                       ;;
+                               "uclibc-ltconf")
+                                       if [[ -e ${x}/ltconfig ]] ; then
+                                               ELT_walk_patches "${x}/ltconfig" "${y}"
+                                               ret=$?
+                                       fi
+                                       ;;
                                *)
                                        ELT_walk_patches "${x}/ltmain.sh" "${y}"
                                        ret=$?
@@ -246,6 +271,10 @@ elibtoolize() {
                                                        ELT_APPLIED_PATCHES="portage"
                                                fi
                                                ;;
+                                       "uclibc-"*)
+                                               [[ ${CHOST} == *"-uclibc" ]] && \
+                                                       ewarn "  uClibc patch set '${y}' failed to apply!"
+                                               ;;
                                esac
                        fi
                done
@@ -281,46 +310,11 @@ elibtoolize() {
        done
 
        cd "${start_dir}"
-
-       uclibctoolize
 }
 
 uclibctoolize() {
-       [[ -n ${NO_UCLIBCTOOLIZE} ]] && return 0
-
-       local errmsg=""
-       [[ ${CTARGET:-${CHOST}} == *-uclibc ]] \
-               && errmsg="PLEASE CHECK" \
-               || errmsg="Already patched"
-       local targets=""
-       local x
-
-       if [[ -z $* ]] ; then
-               targets=$(find ${S} -name configure -o -name ltconfig)
-       fi
-
-       einfo "Applying uClibc/libtool patches ..."
-       for x in ${targets} ; do
-               [[ ! -s ${x} ]] && continue
-               case ${x##*/} in
-               configure)
-                       if grep 'Transform linux' "${x}" > /dev/null ; then
-                               ebegin " Fixing \${S}${x/${S}}"
-                               patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/configure.patch" > /dev/null
-                               eend $? "${errmsg} ${x}"
-                       fi
-                       ;;
-
-               ltconfig)
-                       local ver=$(grep '^VERSION=' ${x})
-                       ver=${ver/VERSION=}
-                       [[ ${ver:0:3} == "1.4" ]] && ver="1.3"   # 1.4 and 1.3 are compat
-                       ebegin " Fixing \${S}${x/${S}}"
-                       patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/ltconfig-${ver:0:3}.patch" > /dev/null
-                       eend $? "${errmsg} ${x}"
-                       ;;
-               esac
-       done
+       ewarn "uclibctoolize() is depreciated, please just use libtoolize()!"
+       elibtoolize
 }
 
 darwintoolize() {