Hi all,

as you might or might not be aware of, elibtoolize() originally was for applying
patches to ltmain.sh, but now also applies patches to configure scripts.

The problem is that finding configure scripts to be patched is based on where
ltmain.sh is found in ${S}, wild guessing that ltmain.sh may reside in 
subdirectories,
trying ./configure, ../configure and ../../configure inconsistently.

But especially with gettext, this wild guess does not identify each configure 
script.

Attached patch drops that wild guesses, explicitly applying configure-patches to
configure scripts, while still explicitly applying ltconf.sh-patches to 
ltconf.sh.

WDYT?

Thank you!
/haubi/

Index: libtool.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v
retrieving revision 1.106
diff -u -r1.106 libtool.eclass
--- libtool.eclass      11 May 2013 11:17:58 -0000      1.106
+++ libtool.eclass      12 Nov 2013 10:10:46 -0000
@@ -204,9 +204,9 @@
        # Reuse "$@" for dirs to patch
        set --
        if [[ ${do_shallow} == "yes" ]] ; then
-               [[ -f ${S}/ltmain.sh ]] && set -- "${S}"
+               [[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && set -- "${S}"
        else
-               set -- $(find "${S}" -name ltmain.sh -printf '%h ')
+               set -- $(find "${S}" '(' -name ltmain.sh -o -name configure ')' 
-printf '%h ')
        fi
 
        local d p
@@ -225,8 +225,12 @@
                        ewarn "  avoid this if possible (perhaps by filing a 
bug)"
                fi
 
+               local ret
+
+               # patching ltmain.sh
+               [[ -f ${d}/ltmain.sh ]] &&
                for p in ${elt_patches} ; do
-                       local ret=0
+                       ret=0
 
                        case ${p} in
                                portage)
@@ -258,17 +262,6 @@
                                        ELT_walk_patches "${d}/ltmain.sh" "${p}"
                                        ret=$?
                                        ;;
-                               uclibc-conf)
-                                       if grep -qs 'Transform linux' 
"${d}/configure" ; then
-                                               ELT_walk_patches 
"${d}/configure" "${p}"
-                                               ret=$?
-                                       # ltmain.sh and co might be in a 
subdirectory ...
-                                       elif [[ ! -e ${d}/configure ]] && \
-                                                grep -qs 'Transform linux' 
"${d}/../configure" ; then
-                                               ELT_walk_patches 
"${d}/../configure" "${p}"
-                                               ret=$?
-                                       fi
-                                       ;;
                                uclibc-ltconf)
                                        # Newer libtoolize clears ltconfig, as 
not used anymore
                                        if [[ -s ${d}/ltconfig ]] ; then
@@ -276,34 +269,12 @@
                                                ret=$?
                                        fi
                                        ;;
-                               fbsd-conf)
-                                       if grep -qs 'version_type=freebsd-' 
"${d}/configure" ; then
-                                               ELT_walk_patches 
"${d}/configure" "${p}"
-                                               ret=$?
-                                       # ltmain.sh and co might be in a 
subdirectory ...
-                                       elif [[ ! -e ${d}/configure ]] && \
-                                                grep -qs 
'version_type=freebsd-' "${d}/../configure" ; then
-                                               ELT_walk_patches 
"${d}/../configure" "${p}"
-                                               ret=$?
-                                       fi
-                                       ;;
                                fbsd-ltconf)
                                        if [[ -s ${d}/ltconfig ]] ; then
                                                ELT_walk_patches 
"${d}/ltconfig" "${p}"
                                                ret=$?
                                        fi
                                        ;;
-                               darwin-conf)
-                                       if grep -qs '&& echo \.so ||' 
"${d}/configure" ; then
-                                               ELT_walk_patches 
"${d}/configure" "${p}"
-                                               ret=$?
-                                       # ltmain.sh and co might be in a 
subdirectory ...
-                                       elif [[ ! -e ${d}/configure ]] && \
-                                                grep -qs '&& echo \.so ||' 
"${d}/../configure" ; then
-                                               ELT_walk_patches 
"${d}/../configure" "${p}"
-                                               ret=$?
-                                       fi
-                                       ;;
                                darwin-ltconf)
                                        # Newer libtoolize clears ltconfig, as 
not used anymore
                                        if [[ -s ${d}/ltconfig ]] ; then
@@ -321,49 +292,6 @@
                                                ret=$?
                                        fi
                                        ;;
-                               aixrtl|hpux-conf)
-                                       ret=1
-                                       local subret=0
-                                       # apply multiple patches as often as 
they match
-                                       while [[ $subret -eq 0 ]]; do
-                                               subret=1
-                                               if [[ -e ${d}/configure ]]; then
-                                                       ELT_walk_patches 
"${d}/configure" "${p}"
-                                                       subret=$?
-                                               # ltmain.sh and co might be in 
a subdirectory ...
-                                               elif [[ ! -e ${d}/configure && 
-e ${d}/../configure ]] ; then
-                                                       ELT_walk_patches 
"${d}/../configure" "${p}"
-                                                       subret=$?
-                                               fi
-                                               if [[ $subret -eq 0 ]]; then
-                                                       # have at least one 
patch succeeded.
-                                                       ret=0
-                                               fi
-                                       done
-                                       ;;
-                               mint-conf|gold-conf|sol2-conf)
-                                       ret=1
-                                       local subret=1
-                                       if [[ -e ${d}/configure ]]; then
-                                               ELT_walk_patches 
"${d}/configure" "${p}"
-                                               subret=$?
-                                       # ltmain.sh and co might be in a 
subdirectory ...
-                                       elif [[ -e ${d}/../configure ]] ; then
-                                               ELT_walk_patches 
"${d}/../configure" "${p}"
-                                               subret=$?
-                                       elif [[ -e ${d}/../../configure ]] ; 
then
-                                               ELT_walk_patches 
"${d}/../../configure" "${p}"
-                                               subret=$?
-                                       fi
-                                       if [[ $subret -eq 0 ]]; then
-                                               # have at least one patch 
succeeded.
-                                               ret=0
-                                       fi
-                                       ;;
-                               target-nm)
-                                       ELT_walk_patches "${d}/configure" "${p}"
-                                       ret=$?
-                                       ;;
                                install-sh)
                                        ELT_walk_patches "${d}/install-sh" 
"${p}"
                                        ret=$?
@@ -421,15 +349,6 @@
                                        uclibc-*)
                                                [[ ${CHOST} == *-uclibc ]] && 
ewarn "  uClibc patch set '${p}' failed to apply!"
                                                ;;
-                                       fbsd-*)
-                                               if [[ ${CHOST} == *-freebsd* ]] 
; then
-                                                       if [[ -z $(grep 'Handle 
Gentoo/FreeBSD as it was Linux' \
-                                                               
"${d}/configure" "${d}/../configure" 2>/dev/null) ]]; then
-                                                               eerror "  
FreeBSD patch set '${p}' failed to apply!"
-                                                               die "FreeBSD 
patch set '${p}' failed to apply!"
-                                                       fi
-                                               fi
-                                               ;;
                                        darwin-*)
                                                [[ ${CHOST} == *"-darwin"* ]] 
&& ewarn "  Darwin patch set '${p}' failed to apply!"
                                                ;;
@@ -437,6 +356,8 @@
                        fi
                done
 
+               # makes sense for ltmain.sh patches only
+               [[ -f ${d}/ltmain.sh ]] &&
                if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
                        if [[ ${do_portage} == "no" && \
                                  ${do_reversedeps} == "no" && \
@@ -448,6 +369,80 @@
                        fi
                fi
 
+               # patching configure
+               [[ -f ${d}/configure ]] &&
+               for p in ${elt_patches} ; do
+                       ret=0
+
+                       case ${p} in
+                               uclibc-conf)
+                                       if grep -qs 'Transform linux' 
"${d}/configure" ; then
+                                               ELT_walk_patches 
"${d}/configure" "${p}"
+                                               ret=$?
+                                       fi
+                                       ;;
+                               fbsd-conf)
+                                       if grep -qs 'version_type=freebsd-' 
"${d}/configure" ; then
+                                               ELT_walk_patches 
"${d}/configure" "${p}"
+                                               ret=$?
+                                       fi
+                                       ;;
+                               darwin-conf)
+                                       if grep -qs '&& echo \.so ||' 
"${d}/configure" ; then
+                                               ELT_walk_patches 
"${d}/configure" "${p}"
+                                               ret=$?
+                                       fi
+                                       ;;
+                               aixrtl|hpux-conf)
+                                       ret=1
+                                       local subret=0
+                                       # apply multiple patches as often as 
they match
+                                       while [[ $subret -eq 0 ]]; do
+                                               subret=1
+                                               if [[ -e ${d}/configure ]]; then
+                                                       ELT_walk_patches 
"${d}/configure" "${p}"
+                                                       subret=$?
+                                               fi
+                                               if [[ $subret -eq 0 ]]; then
+                                                       # have at least one 
patch succeeded.
+                                                       ret=0
+                                               fi
+                                       done
+                                       ;;
+                               mint-conf|gold-conf|sol2-conf)
+                                       ELT_walk_patches "${d}/configure" "${p}"
+                                       ret=$?
+                                       ;;
+                               target-nm)
+                                       ELT_walk_patches "${d}/configure" "${p}"
+                                       ret=$?
+                                       ;;
+                               *)
+                                       # ltmain.sh patches are applied above
+                                       ;;
+                       esac
+
+                       if [[ ${ret} -ne 0 ]] ; then
+                               case ${p} in
+                                       uclibc-*)
+                                               [[ ${CHOST} == *-uclibc ]] && 
ewarn "  uClibc patch set '${p}' failed to apply!"
+                                               ;;
+                                       fbsd-*)
+                                               if [[ ${CHOST} == *-freebsd* ]] 
; then
+                                                       if [[ -z $(grep 'Handle 
Gentoo/FreeBSD as it was Linux' \
+                                                               
"${d}/configure" 2>/dev/null) ]]; then
+                                                               eerror "  
FreeBSD patch set '${p}' failed to apply!"
+                                                               die "FreeBSD 
patch set '${p}' failed to apply!"
+                                                       fi
+                                               fi
+                                               ;;
+                                       darwin-*)
+                                               [[ ${CHOST} == *"-darwin"* ]] 
&& ewarn "  Darwin patch set '${p}' failed to apply!"
+                                               ;;
+                               esac
+                       fi
+               done
+
                rm -f "${d}/libtool"
 
                > "${d}/.elibtoolized"

Reply via email to