aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2018-09-03 00:32:21 +0800
committerjbeich <jbeich@FreeBSD.org>2018-09-03 00:32:21 +0800
commit936723ecbd646680ff29cd7406c2dc3cff0d2fc0 (patch)
tree6b76a85a410d73c36cb867e96860457d2ace7ac7
parent75b5f3a3f79c079b951b8f4465c3950e6c88b7ca (diff)
downloadfreebsd-ports-gnome-936723ecbd646680ff29cd7406c2dc3cff0d2fc0.tar.gz
freebsd-ports-gnome-936723ecbd646680ff29cd7406c2dc3cff0d2fc0.tar.zst
freebsd-ports-gnome-936723ecbd646680ff29cd7406c2dc3cff0d2fc0.zip
multimedia/aom: add new port
AOMedia Video 1 (AV1), is an open, royalty-free video coding format designed for video transmissions over the Internet. It is being developed by the Alliance for Open Media (AOMedia), a consortium of firms from the semiconductor industry, video on demand providers, and web browser developers, founded in 2015. https://aomedia.org/
-rw-r--r--multimedia/Makefile1
-rw-r--r--multimedia/aom/Makefile32
-rw-r--r--multimedia/aom/distinfo3
-rw-r--r--multimedia/aom/files/patch-aom__ports_arm__cpudetect.c77
-rw-r--r--multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c68
-rw-r--r--multimedia/aom/files/patch-av1_encoder_rd.h31
-rw-r--r--multimedia/aom/files/patch-build_cmake_aom__configure.cmake52
-rw-r--r--multimedia/aom/files/patch-build_cmake_aom__optimization.cmake61
-rw-r--r--multimedia/aom/pkg-descr7
-rw-r--r--multimedia/aom/pkg-plist14
-rw-r--r--multimedia/ffmpeg/Makefile6
11 files changed, 346 insertions, 6 deletions
diff --git a/multimedia/Makefile b/multimedia/Makefile
index f677fff7fad6..f458fc8a3773 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -10,6 +10,7 @@
SUBDIR += abby
SUBDIR += acidrip
SUBDIR += aegisub
+ SUBDIR += aom
SUBDIR += aravis
SUBDIR += asdcplib
SUBDIR += assimp
diff --git a/multimedia/aom/Makefile b/multimedia/aom/Makefile
new file mode 100644
index 000000000000..441aa88ba244
--- /dev/null
+++ b/multimedia/aom/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+PORTNAME= aom
+DISTVERSIONPREFIX= v
+DISTVERSION= 1.0.0
+CATEGORIES= multimedia
+MASTER_SITES= LOCAL/jbeich # GitHub mirror is still importing...
+
+MAINTAINER= jbeich@FreeBSD.org
+COMMENT= AV1 Codec Library
+
+LICENSE= BSD2CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${BUILD_DEPENDS_${ARCH}}
+BUILD_DEPENDS_amd64= nasm:devel/nasm
+BUILD_DEPENDS_i386= nasm:devel/nasm
+
+USES= cmake:outsource compiler:c++11-lib perl5
+USE_GITHUB= yes
+USE_PERL5= build
+USE_LDCONFIG= yes
+GH_ACCOUNT= jbeich # mirror
+CMAKE_ON= BUILD_SHARED_LIBS
+CMAKE_OFF= ENABLE_DOCS ENABLE_TESTS
+
+post-patch:
+# Extract (snapshot) version from GH_TAGNAME instead of CHANGELOG
+ @${REINPLACE_CMD} 's,$${AOM_ROOT}/CHANGELOG,${GH_TAGNAME:S/^v//},' \
+ ${WRKSRC}/build/cmake/version.cmake
+
+.include <bsd.port.mk>
diff --git a/multimedia/aom/distinfo b/multimedia/aom/distinfo
new file mode 100644
index 000000000000..4e86b2375835
--- /dev/null
+++ b/multimedia/aom/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1535885385
+SHA256 (jbeich-aom-v1.0.0_GH0.tar.gz) = c6506418aaaa7cb787d5fd8a67ca3dd749139a6cceab72c6bc76c5f48247635b
+SIZE (jbeich-aom-v1.0.0_GH0.tar.gz) = 2776803
diff --git a/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c b/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c
new file mode 100644
index 000000000000..516e7715e473
--- /dev/null
+++ b/multimedia/aom/files/patch-aom__ports_arm__cpudetect.c
@@ -0,0 +1,77 @@
+- Assume NEON is enabled on aarch64
+- Implement NEON runtime detection on FreeBSD
+
+--- aom_ports/arm_cpudetect.c.orig 2018-06-25 14:54:59 UTC
++++ aom_ports/arm_cpudetect.c
+@@ -38,7 +38,7 @@ static int arm_cpu_env_mask(void) {
+ return env && *env ? (int)strtol(env, NULL, 0) : ~0;
+ }
+
+-#if !CONFIG_RUNTIME_CPU_DETECT
++#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON)
+
+ int arm_cpu_caps(void) {
+ /* This function should actually be a no-op. There is no way to adjust any of
+@@ -143,7 +143,61 @@ int arm_cpu_caps(void) {
+ }
+ return flags & mask;
+ }
+-#else /* end __linux__ */
++#elif defined(__FreeBSD__)
++
++#if 0 // __has_include(<sys/auxv.h>)
++#include <sys/auxv.h>
++#else
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <elf.h>
++#include <errno.h>
++#include <unistd.h>
++
++static unsigned long getauxval(unsigned long type) {
++ Elf_Auxinfo auxv[AT_COUNT];
++ size_t len = sizeof(auxv);
++ int mib[] = {
++ CTL_KERN,
++ KERN_PROC,
++ KERN_PROC_AUXV,
++ getpid(),
++ };
++
++ if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) {
++ for (size_t i = 0; i < nitems(auxv); i++)
++ if ((unsigned long)auxv[i].a_type == type)
++ return auxv[i].a_un.a_val;
++
++ errno = ENOENT;
++ }
++ return 0;
++}
++#endif
++
++#ifndef AT_HWCAP
++#define AT_HWCAP 25 /* 16 on Linux */
++#endif
++
++#ifndef HWCAP_NEON
++#define HWCAP_NEON (1 << 12)
++#endif
++
++int arm_cpu_caps(void) {
++ int flags;
++ int mask;
++ unsigned long hwcaps;
++ if (!arm_cpu_env_flags(&flags)) {
++ return flags;
++ }
++ mask = arm_cpu_env_mask();
++ hwcaps = getauxval(AT_HWCAP);
++#if HAVE_NEON
++ if (hwcaps & HWCAP_NEON) flags |= HAS_NEON;
++#endif
++ return flags & mask;
++}
++#else /* end __FreeBSD__ */
+ #error \
+ "--enable-runtime-cpu-detect selected, but no CPU detection method " \
+ "available for your platform. Reconfigure with --disable-runtime-cpu-detect."
diff --git a/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c b/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c
new file mode 100644
index 000000000000..6d83a1ac70dc
--- /dev/null
+++ b/multimedia/aom/files/patch-aom__ports_ppc__cpudetect.c
@@ -0,0 +1,68 @@
+- Implement VSX detection on FreeBSD
+
+--- aom_ports/ppc_cpudetect.c.orig 2018-06-25 14:54:59 UTC
++++ aom_ports/ppc_cpudetect.c
+@@ -9,12 +9,6 @@
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+-#include <fcntl.h>
+-#include <unistd.h>
+-#include <stdint.h>
+-#include <asm/cputable.h>
+-#include <linux/auxvec.h>
+-
+ #include "config/aom_config.h"
+
+ #include "aom_ports/ppc.h"
+@@ -37,6 +31,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;
+@@ -75,6 +76,36 @@ out_close:
+ close(fd);
+ return flags & mask;
+ }
++#elif defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
++
++int ppc_simd_caps(void) {
++ int flags;
++ int mask;
++ u_long cpu_features = 0;
++ size_t sz = sizeof(cpu_features);
++
++ // If AOM_SIMD_CAPS is set then allow only those capabilities.
++ if (!cpu_env_flags(&flags)) {
++ return flags;
++ }
++
++ mask = cpu_env_mask();
++
++ sysctlbyname("hw.cpu_features", &cpu_features, &sz, NULL, 0);
++#if HAVE_VSX
++ if (cpu_features & 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.
diff --git a/multimedia/aom/files/patch-av1_encoder_rd.h b/multimedia/aom/files/patch-av1_encoder_rd.h
new file mode 100644
index 000000000000..cf5fd7bd73c1
--- /dev/null
+++ b/multimedia/aom/files/patch-av1_encoder_rd.h
@@ -0,0 +1,31 @@
+<stdint.h> isn't bootlegged via gtest.h on FreeBSD 10.* leading to
+
+In file included from test/horz_superres_test.cc:14:
+In file included from av1/encoder/encoder.h:36:
+av1/encoder/rd.h:304:26: error: use of undeclared identifier 'INT64_MAX'
+ rd_stats->ref_rdcost = INT64_MAX;
+ ^
+av1/encoder/rd.h:325:20: error: use of undeclared identifier 'INT64_MAX'
+ rd_stats->dist = INT64_MAX;
+ ^
+av1/encoder/rd.h:326:22: error: use of undeclared identifier 'INT64_MAX'
+ rd_stats->rdcost = INT64_MAX;
+ ^
+av1/encoder/rd.h:327:19: error: use of undeclared identifier 'INT64_MAX'
+ rd_stats->sse = INT64_MAX;
+ ^
+av1/encoder/rd.h:331:26: error: use of undeclared identifier 'INT64_MAX'
+ rd_stats->ref_rdcost = INT64_MAX;
+ ^
+5 errors generated.
+
+--- av1/encoder/rd.h.orig 2018-06-25 14:54:59 UTC
++++ av1/encoder/rd.h
+@@ -13,6 +13,7 @@
+ #define AV1_ENCODER_RD_H_
+
+ #include <limits.h>
++#include <stdint.h>
+
+ #include "av1/common/blockd.h"
+
diff --git a/multimedia/aom/files/patch-build_cmake_aom__configure.cmake b/multimedia/aom/files/patch-build_cmake_aom__configure.cmake
new file mode 100644
index 000000000000..8d22e80203db
--- /dev/null
+++ b/multimedia/aom/files/patch-build_cmake_aom__configure.cmake
@@ -0,0 +1,52 @@
+- uname -p returns amd64 on FreeBSD/OpenBSD but x86_64 on DragonFly/NetBSD
+- Automatically fall back to generic without forcing downstream to maintain whitelist
+- More ELF platforms can use GNU assembler on non-x86
+
+--- build/cmake/aom_configure.cmake.orig 2018-06-25 14:54:59 UTC
++++ build/cmake/aom_configure.cmake
+@@ -51,6 +51,7 @@ endforeach()
+ # Detect target CPU.
+ if(NOT AOM_TARGET_CPU)
+ if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR
++ "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64" OR
+ "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
+ if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
+ set(AOM_TARGET_CPU "x86")
+@@ -122,10 +123,8 @@ else()
+ endif()
+
+ if(NOT "${AOM_SUPPORTED_CPU_TARGETS}" MATCHES "${AOM_TARGET_CPU}")
+- message(FATAL_ERROR
+- "No RTCD support for ${AOM_TARGET_CPU}. Create it, or "
+- "add -DAOM_TARGET_CPU=generic to your cmake command line for a "
+- "generic build of libaom and tools.")
++ message(WARNING "No RTCD support for ${AOM_TARGET_CPU}. Assuming generic.")
++ set(AOM_TARGET_CPU generic)
+ endif()
+
+ if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
+@@ -151,20 +150,15 @@ elseif("${AOM_TARGET_CPU}" MATCHES "arm")
+ if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
+ set(AS_EXECUTABLE as)
+ set(AOM_AS_FLAGS -arch ${AOM_TARGET_CPU} -isysroot ${CMAKE_OSX_SYSROOT})
+- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
+- if(NOT AS_EXECUTABLE)
+- set(AS_EXECUTABLE as)
+- endif()
+ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
+ if(NOT AS_EXECUTABLE)
+ set(AS_EXECUTABLE ${CMAKE_C_COMPILER} -c -mimplicit-it=always)
+ endif()
++ else()
++ if(NOT AS_EXECUTABLE)
++ set(AS_EXECUTABLE as)
++ endif()
+ endif()
+- if(NOT AS_EXECUTABLE)
+- message(FATAL_ERROR
+- "Unknown assembler for: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}")
+- endif()
+-
+ string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
+ endif()
+
diff --git a/multimedia/aom/files/patch-build_cmake_aom__optimization.cmake b/multimedia/aom/files/patch-build_cmake_aom__optimization.cmake
new file mode 100644
index 000000000000..07c9ea3c26fd
--- /dev/null
+++ b/multimedia/aom/files/patch-build_cmake_aom__optimization.cmake
@@ -0,0 +1,61 @@
+ELF is also used on Solaris, BSDs, Haiku, Fuchsia, etc.
+
+--- build/cmake/aom_optimization.cmake.orig 2018-06-25 14:54:59 UTC
++++ build/cmake/aom_optimization.cmake
+@@ -83,24 +83,20 @@ function(get_asm_obj_format out_format)
+ if("${AOM_TARGET_CPU}" STREQUAL "x86_64")
+ if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
+ set(objformat "macho64")
+- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
+- set(objformat "elf64")
+ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
+ STREQUAL "Windows")
+ set(objformat "win64")
+ else()
+- message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
++ set(objformat "elf64")
+ endif()
+ elseif("${AOM_TARGET_CPU}" STREQUAL "x86")
+ if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
+ set(objformat "macho32")
+- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
+- set(objformat "elf32")
+ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
+ STREQUAL "Windows")
+ set(objformat "win32")
+ else()
+- message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
++ set(objformat "elf32")
+ endif()
+ else()
+ message(FATAL_ERROR
+@@ -171,7 +167,13 @@ function(test_nasm)
+ message(FATAL_ERROR
+ "Unsupported nasm: macho32 object format not supported.")
+ endif()
+- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
++ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
++ STREQUAL "Windows")
++ if(NOT "${nasm_helptext}" MATCHES "win32")
++ message(FATAL_ERROR
++ "Unsupported nasm: win32 object format not supported.")
++ endif()
++ else()
+ if(NOT "${nasm_helptext}" MATCHES "elf32")
+ message(FATAL_ERROR
+ "Unsupported nasm: elf32 object format not supported.")
+@@ -183,7 +185,13 @@ function(test_nasm)
+ message(FATAL_ERROR
+ "Unsupported nasm: macho64 object format not supported.")
+ endif()
+- elseif("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
++ elseif("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR "${AOM_TARGET_SYSTEM}"
++ STREQUAL "Windows")
++ if(NOT "${nasm_helptext}" MATCHES "win64")
++ message(FATAL_ERROR
++ "Unsupported nasm: win64 object format not supported.")
++ endif()
++ else()
+ if(NOT "${nasm_helptext}" MATCHES "elf64")
+ message(FATAL_ERROR
+ "Unsupported nasm: elf64 object format not supported.")
diff --git a/multimedia/aom/pkg-descr b/multimedia/aom/pkg-descr
new file mode 100644
index 000000000000..77aca114e4ee
--- /dev/null
+++ b/multimedia/aom/pkg-descr
@@ -0,0 +1,7 @@
+AOMedia Video 1 (AV1), is an open, royalty-free video coding format
+designed for video transmissions over the Internet. It is being
+developed by the Alliance for Open Media (AOMedia), a consortium of
+firms from the semiconductor industry, video on demand providers, and
+web browser developers, founded in 2015.
+
+WWW: https://aomedia.org/
diff --git a/multimedia/aom/pkg-plist b/multimedia/aom/pkg-plist
new file mode 100644
index 000000000000..f5f922d51301
--- /dev/null
+++ b/multimedia/aom/pkg-plist
@@ -0,0 +1,14 @@
+bin/aomdec
+bin/aomenc
+include/aom/aom.h
+include/aom/aom_codec.h
+include/aom/aom_decoder.h
+include/aom/aom_encoder.h
+include/aom/aom_frame_buffer.h
+include/aom/aom_image.h
+include/aom/aom_integer.h
+include/aom/aomcx.h
+include/aom/aomdx.h
+lib/libaom.so
+lib/libaom.so.0
+libdata/pkgconfig/aom.pc
diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile
index f2e7e72b7a67..0486b129947d 100644
--- a/multimedia/ffmpeg/Makefile
+++ b/multimedia/ffmpeg/Makefile
@@ -41,12 +41,6 @@ OPTIONS_DEFAULT= FONTCONFIG FREETYPE FREI0R GMP GNUTLS ICONV \
OPENCV OPTIMIZED_CFLAGS OPUS RTCPU THEORA V4L VAAPI VDPAU \
VORBIS VPX X264 X265 XVID
-.if !exists(${.CURDIR:H:H}/multimedia/aom)
-# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/c438899a7064
-# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/43778a501f1b
-OPTIONS_EXCLUDE+= AOM
-.endif
-
.if !exists(${.CURDIR:H:H}/net/srt)
# https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a2fc8dbae853
OPTIONS_EXCLUDE+= SRT