guix/gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch

80 lines
3 KiB
Diff
Raw Normal View History

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