shithub: openh264

Download patch

ref: 68ff8468afa6be7f1929446b458a1d640407d06d
parent: 61cd77d487a4376c58a78099cc247ee6eaf19684
parent: 1a995cc991ab5638a1ac620d38b32758602225cd
author: sijchen <[email protected]>
date: Wed Jan 7 04:45:45 EST 2015

Merge pull request #1691 from mstorsjo/pkgconfig-fixes

Improve pkg-config files for use with static libraries

--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@
 GMP_API_BRANCH=Firefox36
 CCASFLAGS=$(CFLAGS)
 VERSION=1.3
+STATIC_LDFLAGS=-lstdc++
 
 ifeq (,$(wildcard $(SRC_PATH)gmp-api))
 HAVE_GMP_API=No
@@ -125,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
 
@@ -220,16 +221,23 @@
 endif
 
 $(PROJECT_NAME).pc: $(PROJECT_NAME).pc.in
-	@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(VERSION);' < $(PROJECT_NAME).pc.in > $(PROJECT_NAME).pc
+	@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)
@@ -237,12 +245,12 @@
 		cp -a $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(SHAREDLIB_DIR); \
 	fi
 	mkdir -p $(PREFIX)/lib/pkgconfig
-	install -m 444 $(PROJECT_NAME).pc $(PREFIX)/lib/pkgconfig
+	install -m 644 $(PROJECT_NAME).pc $(PREFIX)/lib/pkgconfig
 ifneq ($(EXTRA_LIBRARY),)
 	install -m 644 $(EXTRA_LIBRARY) $(PREFIX)/lib
 endif
 
-install: install-static install-shared
+install: install-static-lib install-shared
 	@:
 
 ifeq ($(HAVE_GTEST),Yes)
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -41,3 +41,4 @@
 SHARED=-LD
 EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
 SHLDFLAGS=-link -def:openh264.def -implib:$(EXTRA_LIBRARY)
+STATIC_LDFLAGS=
--- a/openh264.pc.in
+++ b/openh264.pc.in
@@ -5,5 +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}