mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 15:08:57 +02:00
87 lines
3.6 KiB
Plaintext
87 lines
3.6 KiB
Plaintext
From 14fab4b1f5f53967c4f5cee63520936f98bec022 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..f9c96a5 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, ¶m);
|
|
+#else
|
|
+ pthread_attr_setstacksize(&attr, 256 * PAGESIZE);
|
|
+#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
|
|
|