[x265] [PATCH] Haiku support

Steve Borho steve at borho.org
Wed Aug 12 09:30:22 CEST 2015


On 08/11, J?r?me Duval wrote:
> Hi all,
> 
> I'm submitting a patch to add support for Haiku. I understand it is a
> trivial patch which doesn't require a signed agreement. Please tell me
> if that's not the case.
> 
> Here is a description of the changes:
> 1st: Haiku has no pthread library, we need to check for a threading library.
> 2nd: Haiku doesn't install headers in include, we add an option to
> define such a place, defaulting to include.
> 3rd: Haiku has no nice() function, we use the platform specific call.
> 
> The patch is rebased against today's HG trunk and should apply cleanly.

Haiku is https://www.haiku-os.org?

> From b2a16767983618709903e175f6f3d94a36e35832 Mon Sep 17 00:00:00 2001
> From: Timothy Gu <timothygu99 at gmail.com>
> Date: Sun, 28 Dec 2014 07:11:55 +0000
> Subject: Check if threading library needs to be linked separately
> 
> 
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> index 353003e..6fd2cbe 100644
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -66,7 +66,8 @@ else()
>  endif()
> 
>  if(UNIX)
> -    list(APPEND PLATFORM_LIBS pthread)
> +    find_package(Threads)
> +    list(APPEND PLATFORM_LIBS ${CMAKE_THREAD_LIBS_INIT})

Nice. I checked and this package pre-dates our earliest supported cmake
version (2.8.8) so it is ok to use. The rest looks ok.

>      find_library(LIBRT rt)
>      if(LIBRT)
>          list(APPEND PLATFORM_LIBS rt)
> -- 
> 2.2.2
> 
> 
> From 3649a1e872b18b9e5b2562e12d581d43be916e6a Mon Sep 17 00:00:00 2001
> From: Timothy Gu <timothygu99 at gmail.com>
> Date: Sun, 28 Dec 2014 07:13:56 +0000
> Subject: Add an option to adjust headers installation path
> 
> 
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> index 6fd2cbe..bd6fbdb 100644
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -277,6 +277,7 @@ endif()
>  # Build options
>  set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
>  set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
> +set(INCLUDE_INSTALL_DIR include CACHE STRING "Install location of headers")
>  set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
>  set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
>  if(EXTRA_LINK_FLAGS)
> @@ -419,7 +420,8 @@ endif()
>  install(TARGETS x265-static
>      LIBRARY DESTINATION ${LIB_INSTALL_DIR}
>      ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
> -install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
> +install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h"
> +        DESTINATION "${INCLUDE_INSTALL_DIR}")
> 
>  if(CMAKE_RC_COMPILER)
>      # The resource compiler does not need CFLAGS or macro defines. It
> -- 
> 2.2.2
> 
> 
> From 524b178975d953535acb23fcc9f240b3c5742ce0 Mon Sep 17 00:00:00 2001
> From: Timothy Gu <timothygu99 at gmail.com>
> Date: Sun, 28 Dec 2014 07:14:34 +0000
> Subject: Add Haiku version of adjusting thread priority
> 
> 
> diff --git a/source/common/threadpool.cpp b/source/common/threadpool.cpp
> index 6cb815f..a4b138d 100644
> --- a/source/common/threadpool.cpp
> +++ b/source/common/threadpool.cpp
> @@ -52,6 +52,9 @@
> 
>  #endif
> 
> +#if defined(__HAIKU__)
> +#include <OS.h>
> +#endif
>  #if MACOS
>  #include <sys/param.h>
>  #include <sys/sysctl.h>
> @@ -91,7 +94,10 @@ void WorkerThread::threadMain()
> 
>  #if _WIN32
>      SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
> -#else
> +#elif defined(__HAIKU__)
> +    __attribute__((unused)) status_t
> +    val = set_thread_priority(find_thread(NULL), B_LOW_PRIORITY);
> + #else
>      __attribute__((unused)) int val = nice(10);
>  #endif
> 
> -- 
> 2.2.2
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list