aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergely Risko <gergely+context@risko.hu>2009-09-11 11:49:28 +0300
committerGergely Risko <gergely+context@risko.hu>2009-09-11 11:49:28 +0300
commit30cc95d199327da2c539dfc90c337b3c5b9e8f53 (patch)
tree5e6c405ebb524140d949213147ab17d616c5cb5d
parent6bdcf91ddc348448d060d4ae680f4175cbca549d (diff)
Libtool patch for supporting -Wl,--as-needed, which can be used in debian/rules to fixup overlinking.
-rwxr-xr-xautogen.sh7
-rwxr-xr-xdebian/rules4
-rw-r--r--ltmain.sh.as-needed.patch31
3 files changed, 41 insertions, 1 deletions
diff --git a/autogen.sh b/autogen.sh
index 44192c43..cba209c8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -6,6 +6,13 @@ autoreconf -i -f -v
# Autoreconf overwrites INSTALL, but we have our own version of it.
cp INSTALL.real INSTALL
+# Libtool 2.2 still reorders LDFLAGS badly, and they won't fix it before libtool 2.3 or 2.4
+# but we can leave without this
+if cat ltmain.sh.as-needed.patch | patch -t -p0 --dry-run
+then
+ cat ltmain.sh.as-needed.patch | patch -t -p0
+fi
+
run_configure=true
for arg in $*; do
case $arg in
diff --git a/debian/rules b/debian/rules
index de9043d4..4bfbba6c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,13 +3,15 @@
#export DH_VERBOSE=1
+LDFLAGS+=-Wl,--as-needed
+
Makefile:
./configure --prefix /usr --sysconfdir=/etc --disable-doc --disable-coverage \
build: build-stamp
build-stamp: Makefile
dh_testdir
- $(MAKE) all
+ $(MAKE) LDFLAGS='$(LDFLAGS)' all
touch build-stamp
clean: Makefile
diff --git a/ltmain.sh.as-needed.patch b/ltmain.sh.as-needed.patch
new file mode 100644
index 00000000..c9c12b4f
--- /dev/null
+++ b/ltmain.sh.as-needed.patch
@@ -0,0 +1,31 @@
+--- ltmain.sh 2009-09-11 11:29:46.000000000 +0300
++++ ltmain.sh-good 2009-09-11 11:28:46.000000000 +0300
+@@ -4716,6 +4716,11 @@
+ arg=$func_stripname_result
+ ;;
+
++ -Wl,--as-needed)
++ deplibs="$deplibs $arg"
++ continue
++ ;;
++
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+@@ -5070,6 +5075,16 @@
+ lib=
+ found=no
+ case $deplib in
++ -Wl,--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)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"