This commit is contained in:
2025-08-27 17:10:19 +02:00
parent 67c8d5ea09
commit f54d1dfc4a
628 changed files with 29658 additions and 4 deletions

58
media/libvpx/Makefile Normal file
View File

@@ -0,0 +1,58 @@
# Created by: Ashish SHUKLA <ashish@FreeBSD.org>
# $FreeBSD: head/multimedia/libvpx/Makefile 437439 2017-04-01 15:23:30Z gerald $
PORTNAME= libvpx
DISTVERSIONPREFIX= v
DISTVERSION= 1.15.0
CATEGORIES= multimedia
MAINTAINER= jbeich@FreeBSD.org
COMMENT= VP8/VP9 Codec SDK
BUILD_DEPENDS= yasm:devel/yasm
USE_GITHUB= yes
GH_ACCOUNT= webmproject
USES= compiler:c11 cpe gmake perl5 shebangfix
HAS_CONFIGURE= yes
USE_PERL5= build
USE_LDCONFIG= yes
SHEBANG_FILES= build/make/ads2gas.pl
CONFIGURE_ENV= ASFLAGS="${ASFLAGS}"
# Only explicitly list ARCHs with SIMD optimizations
CONFIGURE_ARGS_aarch64= --target=arm64-linux-gcc
CONFIGURE_ARGS_amd64= --target=x86_64-linux-gcc
CONFIGURE_ARGS_i386= --target=x86-linux-gcc
.if ${CFLAGS:M-march=armv[78]*}
CONFIGURE_ARGS+= --target=armv7-linux-gcc
ASFLAGS+= -meabi=5
.endif
CONFIGURE_ARGS+=${CONFIGURE_ARGS_${ARCH}}
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --disable-install-docs
CONFIGURE_ARGS+= --disable-install-srcs
CONFIGURE_ARGS+= --enable-pic
CONFIGURE_ARGS+= --enable-vp8
CONFIGURE_ARGS+= --enable-vp9
MAKE_ARGS+= verbose=yes
ALL_TARGET= # empty
#CONFIGURE_ARGS+= --disable-multithread
CONFIGURE_ARGS+= --disable-unit-tests
#CONFIGURE_ARGS+= --enable-debug
CONFIGURE_ARGS+= --enable-multi-res-encoding
CONFIGURE_ARGS+= --enable-postproc --enable-vp9-postproc --enable-vp9-temporal-denoising
CONFIGURE_ARGS+= --disable-runtime-cpu-detect
CONFIGURE_ARGS+= --enable-shared
post-patch:
${REINPLACE_CMD} 's|\(link_with_cc\)=gcc|\1=$${CC}|' \
${WRKSRC}/build/make/configure.sh
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/vpx*
.include <bsd.port.mk>

3
media/libvpx/distinfo Normal file
View File

@@ -0,0 +1,3 @@
TIMESTAMP = 1756194247
SHA256 (webmproject-libvpx-v1.15.0_GH0.tar.gz) = e935eded7d81631a538bfae703fd1e293aad1c7fd3407ba00440c95105d2011e
SIZE (webmproject-libvpx-v1.15.0_GH0.tar.gz) = 5629622

View File

@@ -0,0 +1,40 @@
- Assume NEON is enabled on armv7
- Implement runtime detection on FreeBSD
--- vpx_ports/aarch32_cpudetect.c.orig 2024-10-23 18:24:57 UTC
+++ vpx_ports/aarch32_cpudetect.c
@@ -12,7 +12,7 @@
#include "./vpx_config.h"
#include "arm_cpudetect.h"
-#if !CONFIG_RUNTIME_CPU_DETECT
+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON)
static int arm_get_cpu_caps(void) {
// This function should actually be a no-op. There is no way to adjust any of
@@ -57,10 +57,24 @@ static int arm_get_cpu_caps(void) {
return flags;
}
-#elif defined(__linux__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
+#elif defined(__linux__) || defined(__FreeBSD__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
#include <sys/auxv.h>
+#if defined(__FreeBSD__)
+static unsigned long getauxval(unsigned long type)
+{
+ /* Only AT_HWCAP* return unsigned long */
+ if (type != AT_HWCAP && type != AT_HWCAP2) {
+ return 0;
+ }
+
+ unsigned long ret = 0;
+ elf_aux_info(type, &ret, sizeof(ret));
+ return ret;
+}
+#endif
+
// Define hwcap values ourselves: building with an old auxv header where these
// hwcap values are not defined should not prevent features from being enabled.
#define VPX_AARCH32_HWCAP_NEON (1 << 12)

View File

@@ -0,0 +1,29 @@
- Implement runtime detection on FreeBSD
--- vpx_ports/aarch64_cpudetect.c.orig 2024-01-09 21:12:22 UTC
+++ vpx_ports/aarch64_cpudetect.c
@@ -91,9 +91,23 @@ static int arm_get_cpu_caps(void) {
return flags;
}
-#elif defined(__linux__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
+#elif defined(__linux__) || defined(__FreeBSD__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
#include <sys/auxv.h>
+
+#if defined(__FreeBSD__)
+static unsigned long getauxval(unsigned long type)
+{
+ /* Only AT_HWCAP* return unsigned long */
+ if (type != AT_HWCAP && type != AT_HWCAP2) {
+ return 0;
+ }
+
+ unsigned long ret = 0;
+ elf_aux_info(type, &ret, sizeof(ret));
+ return ret;
+}
+#endif
// Define hwcap values ourselves: building with an old auxv header where these
// hwcap values are not defined should not prevent features from being enabled.

View File

@@ -0,0 +1,64 @@
--- vpx_ports/ppc_cpudetect.c.orig 2021-03-18 19:59:46 UTC
+++ vpx_ports/ppc_cpudetect.c
@@ -8,12 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <asm/cputable.h>
-#include <linux/auxvec.h>
-
#include "./vpx_config.h"
#include "vpx_ports/ppc.h"
@@ -35,6 +29,13 @@ static int cpu_env_mask(void) {
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
+#if defined(__linux__)
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <asm/cputable.h>
+#include <linux/auxvec.h>
+
int ppc_simd_caps(void) {
int flags;
int mask;
@@ -73,6 +74,34 @@ out_close:
close(fd);
return flags & mask;
}
+#elif defined(__FreeBSD__)
+#include <sys/auxv.h>
+#include <machine/cpu.h>
+
+int ppc_simd_caps(void) {
+ int flags;
+ int mask;
+ u_long hwcap = 0;
+
+ // If VPX_SIMD_CAPS is set then allow only those capabilities.
+ if (!cpu_env_flags(&flags)) {
+ return flags;
+ }
+
+ mask = cpu_env_mask();
+
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+#if HAVE_VSX
+ if (hwcap & PPC_FEATURE_HAS_VSX) flags |= HAS_VSX;
+#endif
+
+ return flags & mask;
+}
+#else
+#error \
+ "--enable-runtime-cpu-detect selected, but no CPU detection method " \
+"available for your platform. Reconfigure with --disable-runtime-cpu-detect."
+#endif /* end __FreeBSD__ */
#else
// If there is no RTCD the function pointers are not used and can not be
// changed.

View File

@@ -0,0 +1,22 @@
--- ./build/make/Makefile.orig 2024-10-23 20:24:57.000000000 +0200
+++ ./build/make/Makefile 2025-08-26 09:44:23.222343000 +0200
@@ -301,8 +301,8 @@
define install_map_template
$(DIST_DIR)/$(1): $(2)
$(if $(quiet),@echo " [INSTALL] $$@")
- $(qexec)mkdir -p $$(dir $$@)
- $(qexec)cp -p $$< $$@
+ $(qexec)install -d $$(dir $$@)
+ $(qexec)install -p $$< $$(dir $$@)
endef
define archive_template
@@ -422,7 +422,7 @@
.libs: $(LIBS)
@touch $@
$(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.$(SO_VERSION_MAJOR),$(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))))

View File

@@ -0,0 +1,11 @@
--- ./build/make/configure.sh.orig 2024-10-23 20:24:57.000000000 +0200
+++ ./build/make/configure.sh 2025-08-26 09:44:23.221334000 +0200
@@ -1592,7 +1592,7 @@
if enabled rvct; then
enabled small && check_add_cflags -Ospace || check_add_cflags -Otime
else
- enabled small && check_add_cflags -O2 || check_add_cflags -O3
+ enabled small && check_add_cflags -O2 || check_add_cflags -O2
fi
fi

View File

@@ -0,0 +1,56 @@
--- ./libs.mk.orig 2024-10-23 20:24:57.000000000 +0200
+++ ./libs.mk 2025-08-26 09:45:52.826673000 +0200
@@ -336,12 +336,10 @@
LIBVPX_SO_SYMLINKS :=
LIBVPX_SO_IMPLIB := libvpx_dll.a
else
-LIBVPX_SO := libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH)
+LIBVPX_SO := libvpx.so.$(SO_VERSION_MAJOR)
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))
+LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, libvpx.so)
endif
endif
endif
@@ -369,19 +367,19 @@
define libvpx_symlink_template
$(1): $(2)
- @echo " [LN] $(2) $$@"
- $(qexec)mkdir -p $$(dir $$@)
- $(qexec)ln -sf $(2) $$@
+ echo " [LN] $(2) $$@"
+ mkdir -p $$(dir $$@)
+ ln -sf $(2) $$@
endef
$(eval $(call libvpx_symlink_template,\
$(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
$(BUILD_PFX)$(LIBVPX_SO)))
+
$(eval $(call libvpx_symlink_template,\
$(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
$(LIBVPX_SO)))
-
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))
@@ -398,12 +396,12 @@
$(qexec)echo '' >> $@
$(qexec)echo 'Name: vpx' >> $@
$(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
- $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
+ $(qexec)echo 'Version: $(VERSION_MAJOR)' >> $@
$(qexec)echo 'Requires:' >> $@
$(qexec)echo 'Conflicts:' >> $@
$(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@
ifeq ($(HAVE_PTHREAD_H),yes)
- $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
+ $(qexec)echo 'Libs.private: -lm -pthread' >> $@
else
$(qexec)echo 'Libs.private: -lm' >> $@
endif

3
media/libvpx/pkg-descr Normal file
View File

@@ -0,0 +1,3 @@
libvpx is the VP8/VP9 Codec SDK.
WWW: http://www.webmproject.org/

18
media/libvpx/pkg-plist Normal file
View File

@@ -0,0 +1,18 @@
bin/vpxdec
bin/vpxenc
include/vpx/vp8.h
include/vpx/vp8cx.h
include/vpx/vp8dx.h
include/vpx/vpx_codec.h
include/vpx/vpx_decoder.h
include/vpx/vpx_encoder.h
include/vpx/vpx_ext_ratectrl.h
include/vpx/vpx_frame_buffer.h
include/vpx/vpx_image.h
include/vpx/vpx_integer.h
include/vpx/vpx_tpl.h
lib/libvpx.a
lib/libvpx.so
lib/libvpx.so.9
lib/pkgconfig/vpx.pc
@dir include/vpx