1From 890f5bf2654b695a866262d72bfa9750af921a3b Mon Sep 17 00:00:00 2001
2From: Ben Hutchings <ben@decadent.org.uk>
3Date: Sat, 23 Aug 2014 12:26:37 -0700
4Subject: [PATCH] Fix linking of libraries used by libreg
5
6The math and crypto libraries are called by and need to be linked to
7libreg.so, not to the executables.
8
9Upstream-Status: Backport [http://www.spinics.net/lists/linux-wireless/msg126027.html]
10
11Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
12Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
13---
14 Makefile | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17diff --git a/Makefile b/Makefile
18index a3ead30..da2dcc3 100644
19--- a/Makefile
20+++ b/Makefile
21@@ -30,7 +30,7 @@ CFLAGS += -std=gnu99 -Wall -Werror -pedantic
22 CFLAGS += -Wall -g
23 LDLIBREG += -lreg
24 LDLIBS += $(LDLIBREG)
25-LDLIBS += -lm
26+LIBREGLDLIBS += -lm
27 LIBREG += libreg.so
28 LDFLAGS += -L ./
29
30@@ -40,13 +40,13 @@ all_noverify: $(LIBREG) crda intersect regdbdump db2rd optimize
31
32 ifeq ($(USE_OPENSSL),1)
33 CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl`
34-LDLIBS += `pkg-config --libs openssl`
35+LIBREGLDLIBS += `pkg-config --libs openssl`
36
37 $(LIBREG): keys-ssl.c
38
39 else
40 CFLAGS += -DUSE_GCRYPT
41-LDLIBS += -lgcrypt
42+LIBREGLDLIBS += -lgcrypt
43
44 $(LIBREG): keys-gcrypt.c
45
46@@ -116,7 +116,7 @@ keys-%.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem)
47
48 $(LIBREG): regdb.h reglib.h reglib.c
49 	$(NQ) '  CC  ' $@
50-	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -shared -Wl,-soname,$(LIBREG) $^
51+	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -shared -Wl,-soname,$(LIBREG) $^ $(LIBREGLDLIBS)
52
53 install-libreg-headers:
54 	$(NQ) '  INSTALL  libreg-headers'
55--
562.7.4
57
58