summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2015-06-03 05:47:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-06-03 05:47:43 +0000
commit88fadafa9e59365fec9266301bbdf7528d88cdd2 (patch)
tree6fa0e0b45c2b2a8d1e829fb78384e0a5b40dd5ce
parent622beaba67dfd4b12877081a20ff16f98bddee77 (diff)
parent6d52fe2e715e93ae8aa1e6c9d7c14237c98535e6 (diff)
downloadlibvpx-88fadafa9e59365fec9266301bbdf7528d88cdd2.tar
libvpx-88fadafa9e59365fec9266301bbdf7528d88cdd2.tar.gz
libvpx-88fadafa9e59365fec9266301bbdf7528d88cdd2.tar.bz2
libvpx-88fadafa9e59365fec9266301bbdf7528d88cdd2.zip
Merge "Support building shared libraries on OS/2"
-rw-r--r--build/make/Makefile13
-rwxr-xr-xconfigure4
-rw-r--r--examples.mk10
-rw-r--r--libs.mk29
-rw-r--r--vpx/exports_dec2
5 files changed, 51 insertions, 7 deletions
diff --git a/build/make/Makefile b/build/make/Makefile
index a16f41c2f..b56b4902c 100644
--- a/build/make/Makefile
+++ b/build/make/Makefile
@@ -310,6 +310,18 @@ $(1):
$$(filter %.o,$$^) $$(extralibs)
endef
+define dll_template
+# Not using a pattern rule here because we don't want to generate empty
+# archives when they are listed as a dependency in files not responsible
+# for creating them.
+$(1):
+ $(if $(quiet),@echo " [LD] $$@")
+ $(qexec)$$(LD) -Zdll $$(LDFLAGS) \
+ -o $$@ \
+ $$(filter %.o,$$^) $$(extralibs) $$(EXPORTS_FILE)
+endef
+
+
#
# Get current configuration
#
@@ -367,6 +379,7 @@ LIBS=$(call enabled,LIBS)
$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
$(foreach lib,$(filter %so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib))))
+$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dll,$(LIBS)),$(eval $(call dll_template,$(lib))))
INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
ifeq ($(MAKECMDGOALS),dist)
diff --git a/configure b/configure
index d3d6e6732..6cac15aee 100755
--- a/configure
+++ b/configure
@@ -494,11 +494,11 @@ process_detect() {
# Can only build shared libs on a subset of platforms. Doing this check
# here rather than at option parse time because the target auto-detect
# magic happens after the command line has been parsed.
- if ! enabled linux; then
+ if ! enabled linux && ! enabled os2; then
if enabled gnu; then
echo "--enable-shared is only supported on ELF; assuming this is OK"
else
- die "--enable-shared only supported on ELF for now"
+ die "--enable-shared only supported on ELF and OS/2 for now"
fi
fi
fi
diff --git a/examples.mk b/examples.mk
index 174c71d10..fad02cfcd 100644
--- a/examples.mk
+++ b/examples.mk
@@ -281,7 +281,15 @@ BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_S
# Instantiate linker template for all examples.
CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
-SHARED_LIB_SUF=$(if $(filter darwin%,$(TGT_OS)),.dylib,.so)
+ifneq ($(filter darwin%,$(TGT_OS)),)
+SHARED_LIB_SUF=.dylib
+else
+ifneq ($(filter os2%,$(TGT_OS)),)
+SHARED_LIB_SUF=_dll.a
+else
+SHARED_LIB_SUF=.so
+endif
+endif
CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
$(foreach bin,$(BINS-yes),\
$(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
diff --git a/libs.mk b/libs.mk
index 8ac4c3614..0f87a8a86 100644
--- a/libs.mk
+++ b/libs.mk
@@ -228,19 +228,30 @@ SO_VERSION_MINOR := 0
SO_VERSION_PATCH := 0
ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
LIBVPX_SO := libvpx.$(SO_VERSION_MAJOR).dylib
+SHARED_LIB_SUF := .dylib
EXPORT_FILE := libvpx.syms
LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
libvpx.dylib )
else
+ifeq ($(filter os2%,$(TGT_OS)),$(TGT_OS))
+LIBVPX_SO := libvpx$(SO_VERSION_MAJOR).dll
+SHARED_LIB_SUF := _dll.a
+EXPORT_FILE := libvpx.def
+LIBVPX_SO_SYMLINKS :=
+LIBVPX_SO_IMPLIB := libvpx_dll.a
+else
LIBVPX_SO := libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH)
+SHARED_LIB_SUF := .so
EXPORT_FILE := libvpx.ver
LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
libvpx.so libvpx.so.$(SO_VERSION_MAJOR) \
libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR))
endif
+endif
LIBS-$(CONFIG_SHARED) += $(BUILD_PFX)$(LIBVPX_SO)\
- $(notdir $(LIBVPX_SO_SYMLINKS))
+ $(notdir $(LIBVPX_SO_SYMLINKS)) \
+ $(if $(LIBVPX_SO_IMPLIB), $(BUILD_PFX)$(LIBVPX_SO_IMPLIB))
$(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE)
$(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
$(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(SO_VERSION_MAJOR)
@@ -258,6 +269,19 @@ libvpx.syms: $(call enabled,CODEC_EXPORTS)
$(qexec)awk '{print "_"$$2}' $^ >$@
CLEAN-OBJS += libvpx.syms
+libvpx.def: $(call enabled,CODEC_EXPORTS)
+ @echo " [CREATE] $@"
+ $(qexec)echo LIBRARY $(LIBVPX_SO:.dll=) INITINSTANCE TERMINSTANCE > $@
+ $(qexec)echo "DATA MULTIPLE NONSHARED" >> $@
+ $(qexec)echo "EXPORTS" >> $@
+ $(qexec)awk '!/vpx_svc_*/ {print "_"$$2}' $^ >>$@
+CLEAN-OBJS += libvpx.def
+
+libvpx_dll.a: $(LIBVPX_SO)
+ @echo " [IMPLIB] $@"
+ $(qexec)emximp -o $@ $<
+CLEAN-OBJS += libvpx_dll.a
+
define libvpx_symlink_template
$(1): $(2)
@echo " [LN] $(2) $$@"
@@ -275,6 +299,7 @@ $(eval $(call libvpx_symlink_template,\
INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
+INSTALL-LIBS-$(CONFIG_SHARED) += $(if $(LIBVPX_SO_IMPLIB),$(LIBSUBDIR)/$(LIBVPX_SO_IMPLIB))
LIBS-yes += vpx.pc
@@ -454,7 +479,7 @@ OBJS-yes += $(LIBVPX_TEST_OBJS)
BINS-yes += $(LIBVPX_TEST_BIN)
CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
-CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
+CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
TEST_LIBS := lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a
$(LIBVPX_TEST_BIN): $(TEST_LIBS)
$(eval $(call linkerxx_template,$(LIBVPX_TEST_BIN), \
diff --git a/vpx/exports_dec b/vpx/exports_dec
index 3ce1499b7..c694ebae1 100644
--- a/vpx/exports_dec
+++ b/vpx/exports_dec
@@ -1,10 +1,8 @@
text vpx_codec_dec_init_ver
text vpx_codec_decode
text vpx_codec_get_frame
-text vpx_codec_get_mem_map
text vpx_codec_get_stream_info
text vpx_codec_peek_stream_info
text vpx_codec_register_put_frame_cb
text vpx_codec_register_put_slice_cb
text vpx_codec_set_frame_buffer_functions
-text vpx_codec_set_mem_map