shithub: openh264

Download patch

ref: 1a995cc991ab5638a1ac620d38b32758602225cd
parent: 93621d6d9ab510424c6f76045f4debddb8787b3c
author: Martin Storsjö <martin@martin.st>
date: Fri Jan 2 16:56:38 EST 2015

Include private dependencies in the Libs line in pkg-config if only installing a static library

If only a static library is installed, the user of the library may
not know that only a static version of this particular library is
available (and doesn't know that --static should be added to the
pkg-config call). Therefore, one common practice is to include private
dependencies in the public Libs line if a static-only library is
installed.

--- a/Makefile
+++ b/Makefile
@@ -126,7 +126,7 @@
 COMMON_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -I$(SRC_PATH)test -I$(SRC_PATH)test/common
 MODULE_INCLUDES += -I$(SRC_PATH)gmp-api
 
-.PHONY: test gtest-bootstrap clean $(PROJECT_NAME).pc
+.PHONY: test gtest-bootstrap clean $(PROJECT_NAME).pc $(PROJECT_NAME)-static.pc
 
 all: libraries binaries
 
@@ -221,16 +221,23 @@
 endif
 
 $(PROJECT_NAME).pc: $(PROJECT_NAME).pc.in
-	@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(VERSION);' -e 's;@LIBS_PRIVATE@;$(STATIC_LDFLAGS);' < $(PROJECT_NAME).pc.in > $@
+	@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(VERSION);' -e 's;@LIBS@;;' -e 's;@LIBS_PRIVATE@;$(STATIC_LDFLAGS);' < $(PROJECT_NAME).pc.in > $@
 
+$(PROJECT_NAME)-static.pc: $(PROJECT_NAME).pc.in
+	@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(VERSION);' -e 's;@LIBS@;$(STATIC_LDFLAGS);' -e 's;@LIBS_PRIVATE@;;' < $(PROJECT_NAME).pc.in > $@
+
 install-headers:
 	mkdir -p $(PREFIX)/include/wels
 	install -m 644 codec/api/svc/codec*.h $(PREFIX)/include/wels
 
-install-static: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) install-headers
+install-static-lib: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) install-headers
 	mkdir -p $(PREFIX)/lib
 	install -m 644 $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(PREFIX)/lib
 
+install-static: install-static-lib $(PROJECT_NAME)-static.pc
+	mkdir -p $(PREFIX)/lib/pkgconfig
+	install -m 644 $(PROJECT_NAME)-static.pc $(PREFIX)/lib/pkgconfig/$(PROJECT_NAME).pc
+
 install-shared: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) install-headers $(PROJECT_NAME).pc
 	mkdir -p $(SHAREDLIB_DIR)
 	install -m 755 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) $(SHAREDLIB_DIR)
@@ -243,7 +250,7 @@
 	install -m 644 $(EXTRA_LIBRARY) $(PREFIX)/lib
 endif
 
-install: install-static install-shared
+install: install-static-lib install-shared
 	@:
 
 ifeq ($(HAVE_GTEST),Yes)
--- a/openh264.pc.in
+++ b/openh264.pc.in
@@ -5,6 +5,6 @@
 Name: OpenH264
 Description: OpenH264 is a codec library which supports H.264 encoding and decoding. It is suitable for use in real time applications such as WebRTC.
 Version: @VERSION@
-Libs: -L${libdir} -lopenh264
+Libs: -L${libdir} -lopenh264 @LIBS@
 Libs.private: @LIBS_PRIVATE@
 Cflags: -I${includedir}