diff options
-rw-r--r-- | recipes/openh264.recipe | 7 | ||||
-rw-r--r-- | recipes/openh264/versioned-shared-library.patch | 158 |
2 files changed, 165 insertions, 0 deletions
diff --git a/recipes/openh264.recipe b/recipes/openh264.recipe index a393f633..b2211fd3 100644 --- a/recipes/openh264.recipe +++ b/recipes/openh264.recipe @@ -1,5 +1,6 @@ # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python +from cerbero.tools.libtool import LibtoolLibrary from cerbero.utils import shell class Recipe(recipe.Recipe): @@ -9,6 +10,7 @@ class Recipe(recipe.Recipe): stype = SourceType.TARBALL btype = BuildType.MAKEFILE licenses = [License.BSD] + patches = [name + '/versioned-shared-library.patch'] files_libs = ['libopenh264'] files_devel = ['include/wels'] @@ -64,3 +66,8 @@ class Recipe(recipe.Recipe): {'-miphoneos-version-min': '-mios-simulator-version-min'}) # No configure script + + def post_install(self): + libtool_la = LibtoolLibrary('openh264', 0, None, None, self.config.libdir, + self.config.target_platform) + libtool_la.save() diff --git a/recipes/openh264/versioned-shared-library.patch b/recipes/openh264/versioned-shared-library.patch new file mode 100644 index 00000000..1c2b3c99 --- /dev/null +++ b/recipes/openh264/versioned-shared-library.patch @@ -0,0 +1,158 @@ +From cbde1a7ecad2f01208432d79f4f4ffa509918187 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 13 Nov 2014 18:48:33 +0530 +Subject: [PATCH] Makefile: Fix shared library building on various OSes + +Has to be versioned on OS != Windows, and should create .dll.a on Windows +--- + Makefile | 27 ++++++++++++++++++++------- + build/platform-android.mk | 3 +++ + build/platform-darwin.mk | 5 +++++ + build/platform-freebsd.mk | 3 +++ + build/platform-linux.mk | 3 +++ + build/platform-mingw_nt.mk | 3 +++ + 6 files changed, 37 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index dfb0c93..7b34482 100644 +--- a/Makefile ++++ b/Makefile +@@ -46,8 +46,9 @@ CFLAGS += -fsanitize=address + LDFLAGS += -fsanitize=address + endif + +-include build/platform-$(OS).mk ++SHAREDLIBVERSION=0 + ++include build/platform-$(OS).mk + + CFLAGS += + LDFLAGS += +@@ -168,20 +169,24 @@ endif + endif + + ifneq (ios, $(OS)) +-libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) ++libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + else + libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) + endif + +-LIBRARIES += $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) ++LIBRARIES += $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + + $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) + $(QUIET)rm -f $@ + $(QUIET_AR)$(AR) $(AR_OPTS) $+ + +-$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) ++$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) + $(QUIET)rm -f $@ + $(QUIET_CXX)$(CXX) $(SHARED) $(LDFLAGS) $(CXX_LINK_O) $+ $(SHLDFLAGS) ++ if [ "$(SHAREDLIBSUFFIXVER)" != "$(SHAREDLIBSUFFIX)" ]; then \ ++ ln -sfn $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) \ ++ $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX); \ ++ fi + + ifeq ($(HAVE_GMP_API),Yes) + plugin: $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX) +@@ -192,7 +197,7 @@ plugin: + @echo "You do not have gmp-api. Run make gmp-bootstrap to get the gmp-api headers." + endif + +-$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) ++$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXVER): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) + $(QUIET)rm -f $@ + $(QUIET_CXX)$(CXX) $(SHARED) $(LDFLAGS) $(CXX_LINK_O) $+ $(SHLDFLAGS) $(MODULE_LDFLAGS) + +@@ -204,9 +209,17 @@ install-static: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) install-headers + mkdir -p $(PREFIX)/lib + install -m 644 $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(PREFIX)/lib + +-install-shared: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) install-headers ++install-shared: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) install-headers + mkdir -p $(PREFIX)/lib +- install -m 755 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(PREFIX)/lib ++ mkdir -p $(PREFIX)/bin ++ install -m 755 $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) $(SHAREDLIB_DIR) ++ if [ -L $(LIBPREFIX)$(PROJECT_NAME).$(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 + ifneq ($(EXTRA_LIBRARY),) + install -m 644 $(EXTRA_LIBRARY) $(PREFIX)/lib + endif +diff --git a/build/platform-android.mk b/build/platform-android.mk +index 31c5737..3e96701 100644 +--- a/build/platform-android.mk ++++ b/build/platform-android.mk +@@ -1,6 +1,9 @@ + ARCH = arm + include build/platform-arch.mk ++SHAREDLIB_DIR = $(PREFIX)/lib + SHAREDLIBSUFFIX = so ++SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION) ++SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + NDKLEVEL = 12 + ifeq ($(ARCH), arm) + ifneq ($(APP_ABI), armeabi) +diff --git a/build/platform-darwin.mk b/build/platform-darwin.mk +index 40a0314..6b3ba63 100644 +--- a/build/platform-darwin.mk ++++ b/build/platform-darwin.mk +@@ -1,5 +1,10 @@ + include build/platform-arch.mk ++SHAREDLIB_DIR = $(PREFIX)/lib + SHAREDLIBSUFFIX = dylib ++SHAREDLIBSUFFIXVER=$(SHAREDLIBVERSION).$(SHAREDLIBSUFFIX) ++SHLDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \ ++ -fno-common -headerpad_max_install_names -install_name \ ++ $(SHAREDLIB_DIR)/$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + SHARED = -dynamiclib + CFLAGS += -Wall -fPIC -MMD -MP + LDFLAGS += -lpthread +diff --git a/build/platform-freebsd.mk b/build/platform-freebsd.mk +index 66e2efd..272db46 100644 +--- a/build/platform-freebsd.mk ++++ b/build/platform-freebsd.mk +@@ -1,5 +1,8 @@ + include build/platform-arch.mk ++SHAREDLIB_DIR = $(PREFIX)/lib + SHAREDLIBSUFFIX = so ++SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION) ++SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + CFLAGS += -fPIC + LDFLAGS += -lpthread + ifeq ($(ASM_ARCH), x86) +diff --git a/build/platform-linux.mk b/build/platform-linux.mk +index 4427d37..3eb00f2 100644 +--- a/build/platform-linux.mk ++++ b/build/platform-linux.mk +@@ -1,5 +1,8 @@ + include build/platform-arch.mk ++SHAREDLIB_DIR = $(PREFIX)/lib + SHAREDLIBSUFFIX = so ++SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION) ++SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER) + CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP + LDFLAGS += -lpthread + ifeq ($(ASM_ARCH), x86) +diff --git a/build/platform-mingw_nt.mk b/build/platform-mingw_nt.mk +index e1c3771..90321ad 100644 +--- a/build/platform-mingw_nt.mk ++++ b/build/platform-mingw_nt.mk +@@ -1,5 +1,8 @@ + include build/platform-x86-common.mk ++SHAREDLIB_DIR = $(PREFIX)/bin + SHAREDLIBSUFFIX = dll ++SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX) ++SHLDFLAGS = -Wl,--out-implib,$(LIBPREFIX)$(PROJECT_NAME).dll.a + CFLAGS += -MMD -MP + LDFLAGS += + ifeq ($(ENABLE64BIT), Yes) +-- +2.1.0 + |