aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch
blob: 1199d82f1ed7f87ebf5a6db066c6388092068b4d (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
From 9bcba7fb28055550961b134e517b695a8cd05b2a Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 3 Aug 2020 17:43:19 -0400
Subject: [PATCH] libpjproject.pc: Move external libraries to Libs.private.

This is done so users of a shared pjproject library do not get link
directives (provided via pkg-config file of pjproject) to link against
pjproject's own library dependencies.

Static linking with pjproject is preserved by moving the external
libraries link directives to the Libs.private field, which is
specifically intended for this purpose, via for example:

  $ pkg-config --static --libs libpjproject

* build.mak.in (PJ_INSTALL_LDFLAGS_PRIVATE): New variable.
(PJ_INSTALL_LDFLAGS): Filter out PJ_INSTALL_LDFLAGS_PRIVATE entries.
* libpjproject.pc.in (Libs.private): New field.
* Makefile: Substitute PJ_INSTALL_LDFLAGS_PRIVATE as the value for the
Libs.private field.
---
 Makefile           | 5 +++--
 build.mak.in       | 3 ++-
 libpjproject.pc.in | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3fd5cab40..d67badfa4 100644
--- a/Makefile
+++ b/Makefile
@@ -54,14 +54,14 @@ doc:
 		    exit 1; \
 		fi; \
 	done
-	
+
 LIBS = 	pjlib/lib/libpj-$(TARGET_NAME).a \
 	pjlib-util/lib/libpjlib-util-$(TARGET_NAME).a \
 	pjnath/lib/libpjnath-$(TARGET_NAME).a \
 	pjmedia/lib/libpjmedia-$(TARGET_NAME).a \
 	pjmedia/lib/libpjmedia-audiodev-$(TARGET_NAME).a \
 	pjmedia/lib/libpjmedia-codec-$(TARGET_NAME).a \
-    	pjsip/lib/libpjsip-$(TARGET_NAME).a \
+	pjsip/lib/libpjsip-$(TARGET_NAME).a \
 	pjsip/lib/libpjsip-ua-$(TARGET_NAME).a \
 	pjsip/lib/libpjsip-simple-$(TARGET_NAME).a \
 	pjsip/lib/libpjsua-$(TARGET_NAME).a
@@ -133,6 +133,7 @@ install:
 		sed -e "s!@LIBDIR@!$(libdir)!" | \
 		sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \
 		sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \
+		sed -e "s!@PJ_INSTALL_LDFLAGS_PRIVATE@!$(PJ_INSTALL_LDFLAGS_PRIVATE)!" | \
 		sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc
 
 uninstall:
diff --git a/build.mak.in b/build.mak.in
index a9078bb25..1a18a8513 100644
--- a/build.mak.in
+++ b/build.mak.in
@@ -318,4 +318,5 @@ export PJ_INSTALL_DIR := @prefix@
 export PJ_INSTALL_INC_DIR := @includedir@
 export PJ_INSTALL_LIB_DIR := @libdir@
 export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @ac_cflags@
-export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDXXLIBS)
+export PJ_INSTALL_LDFLAGS_PRIVATE := $(APP_THIRD_PARTY_LIBS) $(APP_THIRD_PARTY_EXT) @LIBS@
+export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(filter-out $(PJ_INSTALL_LDFLAGS_PRIVATE),$(APP_LDXXLIBS))
diff --git a/libpjproject.pc.in b/libpjproject.pc.in
index 30ea05c07..4372d5016 100644
--- a/libpjproject.pc.in
+++ b/libpjproject.pc.in
@@ -10,4 +10,5 @@ Description: Multimedia communication library
 URL: http://www.pjsip.org
 Version: @PJ_VERSION@
 Libs: @PJ_INSTALL_LDFLAGS@
+Libs.private: @PJ_INSTALL_LDFLAGS_PRIVATE@
 Cflags: @PJ_INSTALL_CFLAGS@
-- 
2.27.0