summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/pciutils/pciutils/lib-build-fix.patch
blob: 413ef0e1e5d442000d1a80b5ab9912a9d2b26772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Link directly to lib/libpci.so.3.1.5 will hard code this versioned
string into lspci and other utilities, which is not desirable and
won't work. In the other hand, linking to a symbolic link lib/libpci.so
doesn't have this issue.

Upstream-Status: Pending

7/30/2010 - created by Qing He <qing.he@intel.com>

diff --git a/Makefile b/Makefile
index 74c570a..31337e0 100644
--- a/Makefile
+++ b/Makefile
@@ -56,9 +56,9 @@ PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
 
 export
 
-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
+all: lib/$(PCILIB_DEV) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
 
-lib/$(PCILIB): $(PCIINC) force
+lib/$(PCILIB) lib/$(PCILIB_DEV): $(PCIINC) force
 	$(MAKE) -C lib all
 
 force:
@@ -66,8 +66,8 @@ force:
 lib/config.h lib/config.mk:
 	cd lib && ./configure
 
-lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
-setpci: setpci.o common.o lib/$(PCILIB)
+lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB_DEV)
+setpci: setpci.o common.o lib/$(PCILIB_DEV)
 
 LSPCIINC=lspci.h pciutils.h $(PCIINC)
 lspci.o: lspci.c $(LSPCIINC)
@@ -89,7 +89,7 @@ update-pciids: update-pciids.sh
 	chmod +x $@
 
 # The example of use of libpci
-example: example.o lib/$(PCILIB)
+example: example.o lib/$(PCILIB_DEV)
 example.o: example.c $(PCIINC)
 
 %: %.o
diff --git a/lib/Makefile b/lib/Makefile
index 1eb06a5..a8dab56 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -42,7 +42,7 @@ ifdef PCI_HAVE_PM_NBSD_LIBPCI
 OBJS += nbsd-libpci
 endif
 
-all: $(PCILIB) $(PCILIBPC)
+all: $(PCILIB_DEV) $(PCILIBPC)
 
 ifeq ($(SHARED),no)
 $(PCILIB): $(addsuffix .o,$(OBJS))
@@ -53,6 +53,9 @@ else
 CFLAGS += -fPIC -fvisibility=hidden
 $(PCILIB): $(addsuffix .o,$(OBJS))
 	$(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS)
+
+$(PCILIB_DEV): $(PCILIB)
+	ln -s $< $@
 endif
 
 $(PCILIBPC): libpci.pc.in
diff --git a/lib/configure b/lib/configure
index 27388bc..6c508cf 100755
--- a/lib/configure
+++ b/lib/configure
@@ -216,16 +216,18 @@ fi
 echo "Checking whether to build a shared library... $SHARED (set manually)"
 if [ "$SHARED" = no ] ; then
 	echo >>$m 'PCILIB=$(LIBNAME).a'
+	echo >>$m 'PCILIB_DEV=$(LIBNAME).a'
 	echo >>$m 'LDLIBS=$(WITH_LIBS)'
 	echo >>$m 'LIB_LDLIBS='
 else
 	echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
+	echo >>$m 'PCILIB_DEV=$(LIBNAME).so'
 	# We link the dependencies _to_ the library, so we do not need explicit deps in .pc
 	echo >>$m 'LDLIBS='
 	echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
 	echo >>$c '#define PCI_SHARED_LIB'
 	if [ "$SHARED" = yes ] ; then
-		echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
+		echo >>$m 'SONAME=-Wl,-soname -Wl,$(LIBNAME).so$(ABI_VERSION)'
 	fi
 fi
 echo >>$m 'PCILIBPC=$(LIBNAME).pc'