summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-26 16:48:55 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-26 17:01:55 +0000
commit4cf4f2b66f850bb39c5bf29d3cd12ada9114d67e (patch)
treedeea09c1ce5b29125ba5b3df3c55cb313b7b2344
parent18de192b0a4b71ade57acc0b6af311cc17a1bf0a (diff)
downloadlibguestfs-4cf4f2b66f850bb39c5bf29d3cd12ada9114d67e.tar.gz
libguestfs-4cf4f2b66f850bb39c5bf29d3cd12ada9114d67e.tar.xz
libguestfs-4cf4f2b66f850bb39c5bf29d3cd12ada9114d67e.zip
Remove dependency_libs from libtool *.la files.
Add a libtool wrapper which kills dependency_libs in libtool *.la files, to ensure that libtool doesn't add unnecessary extra libraries when linking. See http://lists.fedoraproject.org/pipermail/devel/2010-November/146343.html
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac5
-rwxr-xr-xlibtool-kill-dependency_libs.sh57
3 files changed, 64 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 86d4e0a5..bfca6a1e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,7 +91,8 @@ EXTRA_DIST = \
contrib/README \
bindtests \
.gitignore \
- m4/.gitignore
+ m4/.gitignore \
+ libtool-kill-dependency_libs.sh
# Recipes web page.
html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
diff --git a/configure.ac b/configure.ac
index 90dffb0e..0125a864 100644
--- a/configure.ac
+++ b/configure.ac
@@ -830,6 +830,11 @@ dnl Library versioning.
MAX_PROC_NR=`cat $srcdir/src/MAX_PROC_NR`
AC_SUBST(MAX_PROC_NR)
+dnl Replace libtool with a wrapper that clobbers dependency_libs in *.la files
+dnl http://lists.fedoraproject.org/pipermail/devel/2010-November/146343.html
+LIBTOOL='$(SHELL) $(top_srcdir)/libtool-kill-dependency_libs.sh $(top_builddir)/libtool'
+AC_SUBST([LIBTOOL])
+
dnl Run in subdirs.
if test "x$enable_daemon" = "xyes"; then
AC_CONFIG_SUBDIRS([daemon])
diff --git a/libtool-kill-dependency_libs.sh b/libtool-kill-dependency_libs.sh
new file mode 100755
index 00000000..1403fbe2
--- /dev/null
+++ b/libtool-kill-dependency_libs.sh
@@ -0,0 +1,57 @@
+#!/bin/bash -
+# libtool-kill-dependency_libs.sh
+# Copyright (C) 2010 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Run libtool as normal, then kill the dependency_libs line in the .la
+# file. Otherwise libtool will add DT_NEEDED entries for dependencies
+# of libguestfs to all the other binaries, which is NOT helpful
+# behaviour.
+
+set -e
+
+# Find the -o option. The precise name of this option is full of
+# magic for libtool so we cannot change it here, which is what we'd
+# like to do. Unfortunately this introduces a short race for parallel
+# makes but there's not much we can do about that.
+declare -a args
+i=0
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -o)
+ output="$2"
+ args[$i]="$1"
+ ((++i))
+ args[$i]="$2"
+ ((++i))
+ shift 2;;
+ *)
+ args[$i]="$1";
+ ((++i))
+ shift;;
+ esac
+done
+
+# Run libtool as normal.
+#echo "${args[@]}"
+"${args[@]}"
+mv "$output" "$output.tmp"
+
+# Remove dependency_libs from output.
+sed "s/^dependency_libs=.*/dependency_libs=''/" < "$output.tmp" > "$output"
+chmod --reference="$output.tmp" "$output"
+rm "$output.tmp"