public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Michael Haubenwallner <haubi@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Re: [PATCH] libtool.eclass: Have elibtoolize explicitly apply configure patches
Date: Fri, 15 Nov 2013 11:02:33 +0100	[thread overview]
Message-ID: <5285F139.3030707@gentoo.org> (raw)
In-Reply-To: <52834300.9090703@gentoo.org>

[-- 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"

  reply	other threads:[~2013-11-15 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-11-22  9:07   ` [gentoo-dev] " Michael Haubenwallner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5285F139.3030707@gentoo.org \
    --to=haubi@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox