On 11/13/2013 10:14 AM, Michael Haubenwallner wrote:
> 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.

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

One update to this patch, to run elibtoolize once per directory again,
even if both filenames are in that same directory:

-               set -- $(find "${S}" '(' -name ltmain.sh -o -name configure ')' 
-printf '%h ')
+               set -- $(find "${S}" '(' -name ltmain.sh -o -name configure ')' 
-printf '%h\n' | sort -u)

> WDYT?

Without objections, I plan to commit this patch by the end of next week.

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      15 Nov 2013 09:57:08 -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\n' | sort -u)
        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