public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches
@ 2013-11-13  9:14 Michael Haubenwallner
  2013-11-15 10:02 ` [gentoo-dev] " Michael Haubenwallner
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Haubenwallner @ 2013-11-13  9:14 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

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/


[-- Attachment #2: elibtoolize-conf.diff --]
[-- Type: text/plain, Size: 6815 bytes --]

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"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-dev] Re: [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches
  2013-11-13  9:14 [gentoo-dev] [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches Michael Haubenwallner
@ 2013-11-15 10:02 ` Michael Haubenwallner
  2013-11-22  9:07   ` Michael Haubenwallner
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Haubenwallner @ 2013-11-15 10:02 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

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/

[-- Attachment #2: elibtoolize-conf-r1.diff --]
[-- Type: text/plain, Size: 6825 bytes --]

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"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-dev] Re: [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches
  2013-11-15 10:02 ` [gentoo-dev] " Michael Haubenwallner
@ 2013-11-22  9:07   ` Michael Haubenwallner
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Haubenwallner @ 2013-11-22  9:07 UTC (permalink / raw
  To: gentoo-dev


On 11/15/2013 11:02 AM, Michael Haubenwallner wrote:
>> 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:

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

committed.

/haubi/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-22  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13  9:14 [gentoo-dev] [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches Michael Haubenwallner
2013-11-15 10:02 ` [gentoo-dev] " Michael Haubenwallner
2013-11-22  9:07   ` Michael Haubenwallner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox