[pacman-dev] [PATCH 4/5] Patch ltmain on autoreconf

Allan McRae allan at archlinux.org
Wed Jun 26 01:02:01 EDT 2013


We used to carry a patched version of ltmain in our repos to fix libtools
issues with -Wl,-as-needed. Now that ltmain is "generated" by autoreconf,
we manually patch it afterwards.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 autogen.sh                      |  3 ++-
 build-aux/.gitignore            |  3 ++-
 build-aux/ltmain-asneeded.patch | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 build-aux/ltmain-asneeded.patch

diff --git a/autogen.sh b/autogen.sh
index c31f34f..31b0990 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,3 +1,4 @@
 #!/bin/sh -xu
 
-autoreconf -i
\ No newline at end of file
+autoreconf -i
+(cd build-aux && patch -p0 -i ltmain-asneeded.patch)
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index f59ec20..3ec659c 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -1 +1,2 @@
-*
\ No newline at end of file
+*
+!ltmain-asneeded.patch
diff --git a/build-aux/ltmain-asneeded.patch b/build-aux/ltmain-asneeded.patch
new file mode 100644
index 0000000..af5ae6b
--- /dev/null
+++ b/build-aux/ltmain-asneeded.patch
@@ -0,0 +1,33 @@
+--- ltmain.sh.orig	2013-06-26 14:31:53.472627840 +1000
++++ ltmain.sh	2013-06-26 14:30:56.137038936 +1000
+@@ -5800,6 +5800,14 @@
+ 	arg=$func_stripname_result
+ 	;;
+ 
++      -Wl,*--as-needed*)
++	deplibs="$deplibs $wl--as-needed"
++	;;
++
++      -Wl,*--no-as-needed*)
++	deplibs="$deplibs $wl--no-as-needed"
++	;;
++
+       -Wl,*)
+ 	func_stripname '-Wl,' '' "$arg"
+ 	args=$func_stripname_result
+@@ -6160,6 +6168,15 @@
+ 	lib=
+ 	found=no
+ 	case $deplib in
++	-Wl,--as-needed|-Wl,--no-as-needed)
++	  if test "$linkmode,$pass" = "prog,link"; then
++	    compile_deplibs="$deplib $compile_deplibs"
++	    finalize_deplibs="$deplib $finalize_deplibs"
++	  else
++	    deplibs="$deplib $deplibs"
++	  fi
++	  continue
++	  ;;
+ 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ 	  if test "$linkmode,$pass" = "prog,link"; then
-- 
1.8.3.1



More information about the pacman-dev mailing list