diff --git a/ports/libvpx/0008-enable-shared-on-mingw.patch b/ports/libvpx/0008-enable-shared-on-mingw.patch new file mode 100644 index 0000000000..0cc56e63cf --- /dev/null +++ b/ports/libvpx/0008-enable-shared-on-mingw.patch @@ -0,0 +1,165 @@ +diff --git a/build/make/Makefile b/build/make/Makefile +--- a/build/make/Makefile ++++ b/build/make/Makefile +@@ -342,6 +342,20 @@ $(1): + $$(filter %.o,$$^) $$(extralibs) + endef + ++define dll_gnu_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. ++# ++# This needs further abstraction for dealing with non-GNU linkers. ++$(1): ++ $(if $(quiet),@echo " [LD] $$@") ++ $(qexec)$$(LD) -shared $$(LDFLAGS) \ ++ -Wl,--no-undefined \ ++ -o $$@ \ ++ -Wl,--out-implib=$$(subst $(2),.dll.a,$(1)) $$(filter %.o,$$^) $$(extralibs) ++endef ++ + define dl_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 +@@ -425,6 +439,7 @@ $(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)))) ++$(foreach lib,$(filter %-$(VERSION_MAJOR).dll,$(LIBS)),$(eval $(call dll_gnu_template,$(lib),-$(VERSION_MAJOR).dll))) + + INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) + ifeq ($(MAKECMDGOALS),dist) +diff --git a/build/make/configure.sh b/build/make/configure.sh +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -737,7 +737,10 @@ process_common_cmdline() { + --libdir=*) + libdir="${optval}" + ;; +- --libc|--as|--prefix|--libdir) ++ --bindir=*) ++ bindir="${optval}" ++ ;; ++ --libc|--as|--prefix|--libdir|--bindir) + die "Option ${opt} requires argument" + ;; + --help|-h) +@@ -766,9 +769,14 @@ post_process_common_cmdline() { + prefix="${prefix%/}" + libdir="${libdir:-${prefix}/lib}" + libdir="${libdir%/}" ++ bindir="${bindir:-${prefix}/bin}" ++ bindir="${bindir%/}" + if [ "${libdir#${prefix}}" = "${libdir}" ]; then + die "Libdir ${libdir} must be a subdirectory of ${prefix}" + fi ++ if [ "${bindir#${prefix}}" = "${bindir}" ]; then ++ die "Bindir ${bindir} must be a subdirectory of ${prefix}" ++ fi + } + + post_process_cmdline() { +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -540,6 +540,7 @@ else + DIST_DIR?=\$(DESTDIR)${prefix} + endif + LIBSUBDIR=${libdir##${prefix}/} ++BINSUBDIR=${bindir##${prefix}/} + + VERSION_STRING=${VERSION_STRING} + +@@ -577,9 +578,13 @@ process_detect() { + ;; + *) + if enabled gnu; then +- echo "--enable-shared is only supported on ELF; assuming this is OK" ++ echo "--enable-shared is only supported on ELF and PE; assuming this is OK" ++ elif enabled win32; then ++ echo "--enable-shared is only supported on ELF and PE; assuming this is OK" ++ elif enabled win64; then ++ echo "--enable-shared is only supported on ELF and PE; assuming this is OK" + else +- die "--enable-shared only supported on ELF, OS/2, and Darwin for now" ++ die "--enable-shared only supported on ELF, OS/2, Darwin and PE for now" + fi + ;; + esac +diff --git a/examples.mk b/examples.mk +--- a/examples.mk ++++ b/examples.mk +@@ -312,9 +312,13 @@ else + ifneq ($(filter os2%,$(TGT_OS)),) + SHARED_LIB_SUF=_dll.a + else ++ifneq ($(filter win%,$(TGT_OS)),) ++SHARED_LIB_SUF=.dll.a ++else + SHARED_LIB_SUF=.so + endif + 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 +--- a/libs.mk ++++ b/libs.mk +@@ -150,6 +150,7 @@ endif + INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/% + INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/% + INSTALL_MAPS += $(LIBSUBDIR)/% % ++INSTALL_MAPS += $(BINSUBDIR)/% % + INSTALL_MAPS += src/% $(SRC_PATH_BARE)/% + ifeq ($(CONFIG_MSVS),yes) + INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%) +@@ -335,6 +336,16 @@ EXPORT_FILE := libvpx.def + LIBVPX_SO_SYMLINKS := + LIBVPX_SO_IMPLIB := libvpx_dll.a + else ++ifeq ($(filter win%,$(TGT_OS)),$(TGT_OS)) ++LIBVPX_SO := libvpx-$(VERSION_MAJOR).dll ++SHARED_LIB_SUF := .dll.a ++EXPORT_FILE := ++LIBVPX_SO_SYMLINKS := ++LIBVPX_SO_IMPLIB := libvpx.dll.a ++# PE shared libraries are runtime loadables and belong next to the executables, ++# not in the link-time library directory. ++LIBVPX_SO_INSTALL_DIR := $(BINSUBDIR) ++else + LIBVPX_SO := libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH) + SHARED_LIB_SUF := .so + EXPORT_FILE := libvpx.ver +@@ -344,6 +355,10 @@ LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \ + endif + endif + endif ++endif ++ ++# ELF/Darwin/OS2 keep the shared library alongside its symlinks in $(LIBSUBDIR). ++LIBVPX_SO_INSTALL_DIR ?= $(LIBSUBDIR) + + LIBS-$(CONFIG_SHARED) += $(BUILD_PFX)$(LIBVPX_SO)\ + $(notdir $(LIBVPX_SO_SYMLINKS)) \ +@@ -366,6 +381,10 @@ libvpx_dll.a: $(LIBVPX_SO) + $(qexec)emximp -o $@ $< + CLEAN-OBJS += libvpx_dll.a + ++libvpx.dll.a: $(LIBVPX_SO) ++ @echo " [IMPLIB] $@" ++CLEAN-OBJS += libvpx.dll.a ++ + define libvpx_symlink_template + $(1): $(2) + @echo " [LN] $(2) $$@" +@@ -382,7 +401,7 @@ $(eval $(call libvpx_symlink_template,\ + + + INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS) +-INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO) ++INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_INSTALL_DIR)/$(LIBVPX_SO) + INSTALL-LIBS-$(CONFIG_SHARED) += $(if $(LIBVPX_SO_IMPLIB),$(LIBSUBDIR)/$(LIBVPX_SO_IMPLIB)) + + diff --git a/ports/libvpx/portfile.cmake b/ports/libvpx/portfile.cmake index 78af9a1390..105706e47e 100644 --- a/ports/libvpx/portfile.cmake +++ b/ports/libvpx/portfile.cmake @@ -12,6 +12,8 @@ vcpkg_from_github( # Candidate upstream fix: makes configure-time toolchain probes use -Fo/-Fe when CC/LD is cl.exe or clang-cl. # Once upstream picks this up (or once we drop --enable-external-build), the MSVC arm64 SVE workaround below can also be removed. 0007-msvc-use-Fo-in-toolchain-probe.patch + # mingw shared .dll patch + 0008-enable-shared-on-mingw.patch ) if(CMAKE_HOST_WIN32) @@ -156,24 +158,24 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) else() - set(OPTIONS "--disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-pic") + set(OPTIONS --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-pic) - set(OPTIONS_DEBUG "--enable-debug-libs --enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug") - set(OPTIONS_RELEASE "--prefix=${CURRENT_PACKAGES_DIR}") - set(AS_NASM "--as=nasm") + set(OPTIONS_DEBUG --enable-debug-libs --enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug) + set(OPTIONS_RELEASE --prefix=${CURRENT_PACKAGES_DIR}) + set(AS_NASM --as=nasm) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - set(OPTIONS "${OPTIONS} --disable-static --enable-shared") + list(APPEND OPTIONS --disable-static --enable-shared) else() - set(OPTIONS "${OPTIONS} --enable-static --disable-shared") + list(APPEND OPTIONS --enable-static --disable-shared) endif() if("realtime" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-realtime-only") + list(APPEND OPTIONS --enable-realtime-only) endif() if("highbitdepth" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth") + list(APPEND OPTIONS --enable-vp9-highbitdepth) endif() if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) @@ -186,6 +188,8 @@ else() set(LIBVPX_TARGET_ARCH "arm64") elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL riscv64) set(LIBVPX_TARGET_ARCH "riscv64") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL wasm32) + set(LIBVPX_TARGET_ARCH "wasm32") else() message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}") endif() @@ -211,8 +215,11 @@ else() if(LIBVPX_TARGET_ARCH STREQUAL "x86") set(LIBVPX_TARGET "x86-win32-gcc") else() - set(LIBVPX_TARGET "x86_64-win64-gcc") + set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-win64-gcc") endif() + elseif(VCPKG_TARGET_IS_EMSCRIPTEN) + # WASM use target generic-gnu + set(LIBVPX_TARGET "generic-gnu") elseif(VCPKG_TARGET_IS_LINUX) # RISCV64 use target generic-gnu if(LIBVPX_TARGET_ARCH STREQUAL "riscv64") @@ -224,19 +231,19 @@ else() set(LIBVPX_TARGET "generic-gnu") # Settings if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) - set(OPTIONS "${OPTIONS} --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512") + list(APPEND OPTIONS --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) - set(OPTIONS "${OPTIONS} --disable-avx --disable-avx2 --disable-avx512") + list(APPEND OPTIONS --disable-avx --disable-avx2 --disable-avx512) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm) - set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon") + list(APPEND OPTIONS --enable-thumb --disable-neon) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64) - set(OPTIONS "${OPTIONS} --enable-thumb") + list(APPEND OPTIONS --enable-thumb) endif() # Set environment variables for configure set(ENV{AS} ${VCPKG_DETECTED_CMAKE_C_COMPILER}) set(ENV{LDFLAGS} "${LDFLAGS} --target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}") # Set clang target - set(OPTIONS "${OPTIONS} --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}") + list(APPEND OPTIONS --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}) # Unset nasm and let AS do its job unset(AS_NASM) elseif(VCPKG_TARGET_IS_OSX) @@ -348,4 +355,12 @@ endif() configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-libvpx-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-libvpx/unofficial-libvpx-config.cmake" @ONLY) -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +vcpkg_install_copyright( + COMMENT [[ +The first LICENSE below is the libvpx license (BSD-3-Clause). +The second LICENSE below is the license of the bundled third_party/x86inc assembly macros (ISC), which are assembled into libvpx on x86 and x64 targets. +]] + FILE_LIST + "${SOURCE_PATH}/LICENSE" + "${SOURCE_PATH}/third_party/x86inc/LICENSE" +) diff --git a/ports/libvpx/vcpkg.json b/ports/libvpx/vcpkg.json index 7b0e7e9b18..71e711fc47 100644 --- a/ports/libvpx/vcpkg.json +++ b/ports/libvpx/vcpkg.json @@ -1,10 +1,10 @@ { "name": "libvpx", "version": "1.16.0", - "port-version": 2, + "port-version": 3, "description": "The reference software implementation for the video coding formats VP8 and VP9.", "homepage": "https://github.com/webmproject/libvpx", - "license": "BSD-3-Clause", + "license": "BSD-3-Clause AND ISC", "dependencies": [ { "name": "vcpkg-cmake-get-vars", diff --git a/versions/baseline.json b/versions/baseline.json index 2158fe6ba4..a6d0f03e70 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5950,7 +5950,7 @@ }, "libvpx": { "baseline": "1.16.0", - "port-version": 2 + "port-version": 3 }, "libwandio": { "baseline": "4.2.7-1", diff --git a/versions/l-/libvpx.json b/versions/l-/libvpx.json index a7760a7f7f..d352d893ca 100644 --- a/versions/l-/libvpx.json +++ b/versions/l-/libvpx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c0310b0d1b90d33d02c8dab057ab834612c11779", + "version": "1.16.0", + "port-version": 3 + }, { "git-tree": "6ceb7c67ef2fd1729a37204404ef21fc5647154f", "version": "1.16.0",