svt-av1: new recipe

This commit is contained in:
Jerome Duval
2021-01-14 19:04:49 +01:00
parent 5f0af38afd
commit 69683406f2
2 changed files with 165 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
From 5b7ef6aeba12650f983e0f609939aeeb3cb07877 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 14 Jan 2021 18:29:12 +0100
Subject: Haiku patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5f3351..64f1d76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,7 +135,7 @@ else()
endif()
if(MINGW)
list(APPEND flags_to_test -mxsave -fno-asynchronous-unwind-tables)
- else()
+ elseif(NOT HAIKU)
list(APPEND flags_to_test -fstack-protector-strong -D_FORTIFY_SOURCE=2)
endif()
endif()
diff --git a/Source/Lib/Common/Codec/EbThreads.c b/Source/Lib/Common/Codec/EbThreads.c
index 25619f3..658f15c 100644
--- a/Source/Lib/Common/Codec/EbThreads.c
+++ b/Source/Lib/Common/Codec/EbThreads.c
@@ -84,11 +84,15 @@ EbHandle svt_create_thread(void *thread_function(void *), void *thread_context)
#ifndef EB_THREAD_SANITIZER_ENABLED
pthread_attr_t attr;
pthread_attr_init(&attr);
+#if !defined(__HAIKU__)
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
struct sched_param param = {.sched_priority = 99};
pthread_attr_setschedparam(&attr, &param);
+#else
+ pthread_attr_setstacksize(&attr, 256 * B_PAGE_SIZE);
+#endif
ret = pthread_create(th, &attr, thread_function, thread_context);
pthread_attr_destroy(&attr);
diff --git a/third_party/cpuinfo/CMakeLists.txt b/third_party/cpuinfo/CMakeLists.txt
index eba602b..70593c6 100644
--- a/third_party/cpuinfo/CMakeLists.txt
+++ b/third_party/cpuinfo/CMakeLists.txt
@@ -65,7 +65,7 @@ IF(NOT CMAKE_SYSTEM_NAME)
"Target operating system is not specified. "
"cpuinfo will compile, but cpuinfo_initialize() will always fail.")
SET(CPUINFO_SUPPORTED_PLATFORM FALSE)
-ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS|Darwin|Linux|Android)$")
+ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS|Darwin|Linux|Android|Haiku)$")
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14" AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
MESSAGE(WARNING
"Target operating system \"${CMAKE_SYSTEM_NAME}\" is not supported in cpuinfo. "
@@ -85,7 +85,7 @@ IF(CPUINFO_SUPPORTED_PLATFORM)
src/x86/x86_init.c
src/x86/vendor.c
src/x86/isa.c)
- IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
+ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR HAIKU)
LIST(APPEND CPUINFO_SRCS
src/x86/linux/init.c)
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
diff --git a/third_party/cpuinfo/src/init.c b/third_party/cpuinfo/src/init.c
index f703e8e..13eff98 100644
--- a/third_party/cpuinfo/src/init.c
+++ b/third_party/cpuinfo/src/init.c
@@ -25,7 +25,7 @@ bool CPUINFO_ABI cpuinfo_initialize(void) {
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
#if defined(__MACH__) && defined(__APPLE__)
pthread_once(&init_guard, &cpuinfo_x86_mach_init);
- #elif defined(__linux__)
+ #elif defined(__linux__) || defined(__HAIKU__)
pthread_once(&init_guard, &cpuinfo_x86_linux_init);
#elif defined(_WIN32) || defined(__CYGWIN__)
InitOnceExecuteOnce(&init_guard, &cpuinfo_x86_windows_init, NULL, NULL);
@@ -33,7 +33,7 @@ bool CPUINFO_ABI cpuinfo_initialize(void) {
cpuinfo_log_error("operating system is not supported in cpuinfo");
#endif
#elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64
- #if defined(__linux__)
+ #if defined(__linux__) || defined(__HAIKU__)
pthread_once(&init_guard, &cpuinfo_arm_linux_init);
#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
pthread_once(&init_guard, &cpuinfo_arm_mach_init);
--
2.30.0

View File

@@ -0,0 +1,79 @@
SUMMARY="An AV1-compliant encoder/decoder library core"
DESCRIPTION="The Scalable Video Technology for AV1 (SVT-AV1 Encoder and \
Decoder) is an AV1-compliant encoder/decoder library core. The SVT-AV1 encoder\
development is a work-in-progress targeting performance levels applicable to \
both VOD and Live encoding / transcoding video applications. The SVT-AV1 \
decoder implementation is targeting future codec research activities."
HOMEPAGE="https://github.com/AOMediaCodec/SVT-AV1"
COPYRIGHT="2019, Alliance for Open Media"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/AOMediaCodec/SVT-AV1/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="951ffc240ceecd94c6cd94e53c81217c4333219a868cbf477a9eedaf0ed1c388"
SOURCE_DIR="SVT-AV1-$portVersion"
PATCHES="svt_av1-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="?x86"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
svt_av1$secondaryArchSuffix = $portVersion
cmd:SvtAv1DecApp$commandSuffix
cmd:SvtAv1EncApp$commandSuffix
lib:libSvtAv1Dec$secondaryArchSuffix = $libVersionCompat
lib:libSvtAv1Enc$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
svt_av1${secondaryArchSuffix}_devel = $portVersion
devel:libSvtAv1Dec$secondaryArchSuffix = $libVersionCompat
devel:libSvtAv1Enc$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
svt_av1$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ninja
cmd:yasm >= 1.2
"
defineDebugInfoPackage svt_av1$secondaryArchSuffix \
"$libDir"/libSvtAv1Dec.so.$libVersion \
"$libDir"/libSvtAv1Enc.so.$libVersion
BUILD()
{
cmake -B build -G Ninja \
-DBUILD_SHARED_LIBS=ON \
-DNATIVE=OFF \
$cmakeDirArgs
ninja -C build $jobArgs
}
INSTALL()
{
ninja -C build install
prepareInstalledDevelLibs libSvtAv1Dec libSvtAv1Enc
fixPkgconfig strict
packageEntries devel $developDir
}