ref: a5cabf0be455d93a2df5eb5341e7df21e58b8f6b
parent: 91ae2dab7a65825f02d8d3ea72c3025e96a80a5f
parent: 3d263d1087d71863e74ef2870dd840f1e82eba3e
author: sijchen <sijchen@cisco.com>
date: Tue Dec 2 06:48:22 EST 2014
Merge pull request #1582 from mstorsjo/lib-install-fixes Fix/clean up building and installing shared libraries
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,7 @@
PREFIX=/usr/local
SHARED=-shared
OBJ=o
+SHAREDLIB_DIR=$(PREFIX)/lib
PROJECT_NAME=openh264
MODULE_NAME=gmpopenh264
GMP_API_BRANCH=master
@@ -180,7 +181,7 @@
endif
ifneq (ios, $(OS))
-libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
+libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX)
else
libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX)
endif
@@ -194,13 +195,14 @@
$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
$(QUIET)rm -f $@
$(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS)
- if [ "$(SHAREDLIBSUFFIXVER)" != "$(SHAREDLIBSUFFIX)" ]; then \
- ln -sfn $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) \
- $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX); \
- fi
+ifneq ($(SHAREDLIBSUFFIXVER),$(SHAREDLIBSUFFIX))
+$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX): $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
+ $(QUIET)ln -sfn $+ $@
+endif
+
ifeq ($(HAVE_GMP_API),Yes)
-plugin: $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER)
+plugin: $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX)
LIBRARIES += $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER)
else
plugin:
@@ -211,11 +213,12 @@
$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
$(QUIET)rm -f $@
$(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS) $(MODULE_LDFLAGS)
- if [ "$(SHAREDLIBSUFFIXVER)" != "$(SHAREDLIBSUFFIX)" ]; then \
- ln -sfn $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER) \
- $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX); \
- fi
+ifneq ($(SHAREDLIBSUFFIXVER),$(SHAREDLIBSUFFIX))
+$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX): $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER)
+ $(QUIET)ln -sfn $+ $@
+endif
+
$(PROJECT_NAME).pc: $(PROJECT_NAME).pc.in
@sed -e 's;@prefix@;$(PREFIX);' -e 's;@VERSION@;$(VERSION);' < $(PROJECT_NAME).pc.in > $(PROJECT_NAME).pc
@@ -228,15 +231,10 @@
install -m 644 $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(PREFIX)/lib
install-shared: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) install-headers $(PROJECT_NAME).pc
- mkdir -p $(PREFIX)/lib
- mkdir -p $(PREFIX)/bin
- install -m 755 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(PREFIX)/lib
- if [ -L $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) ]; then \
+ mkdir -p $(SHAREDLIB_DIR)
+ install -m 755 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) $(SHAREDLIB_DIR)
+ if [ "$(SHAREDLIBSUFFIXVER)" != "$(SHAREDLIBSUFFIX)" ]; then \
cp -a $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(SHAREDLIB_DIR); \
- fi
- if [ -f $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX).a ]; then \
- install -m 644 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX).a \
- $(PREFIX)/lib; \
fi
mkdir -p $(PREFIX)/lib/pkgconfig
install -m 444 $(PROJECT_NAME).pc $(PREFIX)/lib/pkgconfig
--- a/build/msvc-common.mk
+++ b/build/msvc-common.mk
@@ -35,7 +35,9 @@
LIBPREFIX=
EXEEXT=.exe
OBJ=obj
+SHAREDLIB_DIR = $(PREFIX)/bin
SHAREDLIBSUFFIX=dll
+SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX)
SHARED=-LD
-SHLDFLAGS=-link -def:openh264.def -implib:$(PROJECT_NAME)_dll.lib
EXTRA_LIBRARY=$(PROJECT_NAME)_dll.lib
+SHLDFLAGS=-link -def:openh264.def -implib:$(EXTRA_LIBRARY)
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -1,6 +1,5 @@
ARCH = arm
include $(SRC_PATH)build/arch.mk
-SHAREDLIB_DIR = $(PREFIX)/lib
SHAREDLIBSUFFIX = so
# Android APK/JARs expect libraries to be unversioned
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX)
--- a/build/platform-freebsd.mk
+++ b/build/platform-freebsd.mk
@@ -1,5 +1,4 @@
include $(SRC_PATH)build/arch.mk
-SHAREDLIB_DIR = $(PREFIX)/lib
SHAREDLIBSUFFIX = so
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
--- a/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -1,5 +1,4 @@
include $(SRC_PATH)build/arch.mk
-SHAREDLIB_DIR = $(PREFIX)/lib
SHAREDLIBSUFFIX = so
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
--- a/build/platform-mingw_nt.mk
+++ b/build/platform-mingw_nt.mk
@@ -2,7 +2,8 @@
SHAREDLIB_DIR = $(PREFIX)/bin
SHAREDLIBSUFFIX = dll
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX)
-SHLDFLAGS = -Wl,--out-implib,$(LIBPREFIX)$(PROJECT_NAME).dll.a
+EXTRA_LIBRARY=$(LIBPREFIX)$(PROJECT_NAME).dll.a
+SHLDFLAGS = -Wl,--out-implib,$(EXTRA_LIBRARY)
CFLAGS += -MMD -MP
LDFLAGS +=
ifeq ($(ENABLE64BIT), Yes)