diff mbox

[Maverick] UBUNTU: SAUCE: perf: Link libbfd statically

Message ID 1312277892-5468-3-git-send-email-stefan.bader@canonical.com
State New
Headers show

Commit Message

Stefan Bader Aug. 2, 2011, 9:38 a.m. UTC
From 8fb5549770e69e3c7a1ccf141d1498267f414c0a Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Tue, 5 Jul 2011 20:13:40 -0400
Subject: [PATCH] UBUNTU: SAUCE: perf: Link libbfd statically

The binutils-dev package description forbids Debian packages from
linking libbfd dynamically, because that would lead to very strict
versioned dependencies, so that frequent rebuilds are required to keep
every package in sync with current binutils.  It would also make it
impossible to install multiple versions of linux-tools linked against
diff mbox

Patch

different binutils versions.

BugLink: https://bugs.launchpad.net/bugs/783660

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
[v2: Changed to modify EXTLIBS]
[v3: Adapted to apply to Maverick]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 tools/perf/Makefile |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d75c28a..3ee346c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -605,18 +605,19 @@  else
 		EXTLIBS += -liberty
 		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
 	else
-		has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
+		LIBBFD := $(shell $(CC) -print-file-name=libbfd.a)
+		has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBBFD) "$(QUIET_STDERR)" && echo y")
 
 		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
+			EXTLIBS += $(LIBBFD)
 		else
-			has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
+			has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBBFD) -liberty "$(QUIET_STDERR)" && echo y")
 			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
+				EXTLIBS += $(LIBBFD) -liberty
 			else
-				has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
+				has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBBFD) -liberty -lz "$(QUIET_STDERR)" && echo y")
 				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
+					EXTLIBS += $(LIBBFD) -liberty -lz
 				else
 					has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
 					ifeq ($(has_cplus_demangle),y)