Merged in TimothyGu/haikuports/x265 (pull request #407)

Add x265 port
This commit is contained in:
François Revol
2015-01-01 05:22:11 +01:00
2 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
From 8387d94e949e524f936c9c7ecb86b8663c603351 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@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 ba63f81..e43be21 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -56,7 +56,8 @@ else()
endif()
if(UNIX)
- SET(PLATFORM_LIBS pthread)
+ find_package(Threads)
+ SET(PLATFORM_LIBS ${CMAKE_THREAD_LIBS_INIT})
find_library(LIBRT rt)
if(LIBRT)
set(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
--
1.8.3.4
From 592de1f1cd5666ae9cc64715833dfd16130a9c0b Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@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 e43be21..b78d12b 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -166,6 +166,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")
if(X64)
# NOTE: We only officially support 16bit-per-pixel compiles of x265
@@ -251,7 +252,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
--
1.8.3.4
From ccb172d336c00fa95b1d99407da86be0b970b3bb Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@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 8a2ab9d..70b1289 100644
--- a/source/common/threadpool.cpp
+++ b/source/common/threadpool.cpp
@@ -32,6 +32,8 @@
#if MACOS
#include <sys/param.h>
#include <sys/sysctl.h>
+#elif defined(__HAIKU__)
+#include <OS.h>
#endif
namespace x265 {
@@ -141,6 +143,9 @@ void PoolThread::threadMain()
{
#if _WIN32
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
+#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
--
1.8.3.4
From ae89f461c037e2981add0a1b161b81afd5104e30 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Mon, 29 Dec 2014 04:43:42 +0000
Subject: checkasm-a: Explicitly use PLT relocation for libc symbols
Fixes linking with PIC (default for all compilation) on Haiku.
diff --git a/source/test/checkasm-a.asm b/source/test/checkasm-a.asm
index f7b9837..d0d622a 100644
--- a/source/test/checkasm-a.asm
+++ b/source/test/checkasm-a.asm
@@ -153,7 +153,7 @@ cglobal checkasm_call, 2,15,16,max_args*8+8
jz .ok
mov r9, rax
lea r0, [error_message]
- call puts
+ call puts wrt ..plt
mov r1, [rsp+max_args*8]
mov dword [r1], 0
mov rax, r9
--
1.8.3.4

View File

@@ -0,0 +1,83 @@
SUMMARY="H.265/HEVC video encoder"
DESCRIPTION="x265 is a full-fledged video encoder for the HEVC video format \
(also known as High Efficiency Video Coding, ISO/IEC 23008-2, MPEG-H Part 2, \
and ITU-T H.265). HEVC is a direct successor to the earlier H.264/MPEG-4 AVC \
video compression standard, aiming to achieve the same video quality at half \
the bit rate. x265 is a free software project implementing that standard."
HOMEPAGE="http://x265.org/"
LICENSE="GNU GPL v2"
COPYRIGHT="2013-2014 x265 Project"
SRC_URI="https://bitbucket.org/multicoreware/x265/get/$portVersion.tar.bz2"
CHECKSUM_SHA256="e818cacd6a963d49813dbe6c041888311a237da95896e604b4c91b2ddfac83a5"
REVISION="1"
ARCHITECTURES="x86 x86_64"
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
# BitBucket sucks
SOURCE_DIR='multicoreware-x265-5e604833c5aa'
PROVIDES="
x265$secondaryArchSuffix = $portVersion
cmd:x265 = $portVersion
lib:libx265$secondaryArchSuffix = 35
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libgcc_s$secondaryArchSuffix
lib:libstdc++$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:yasm
"
PATCHES="x265-$portVersion.patchset"
BUILD()
{
# Can't put this in SOURCE_DIR as cmake uses a file in the root
# directory to find out the version of x265
cd source
cmake -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
-DLIB_INSTALL_DIR:PATH=$relativeLibDir \
-DBIN_INSTALL_DIR:PATH=bin \
-DINCLUDE_INSTALL_DIR:PATH=$relativeIncludeDir
make $jobArgs VERBOSE=1
}
INSTALL()
{
cd source
make install
prepareInstalledDevelLibs libx265
fixPkgconfig
# devel package
packageEntries devel \
$developDir
}
# ----- devel package -------------------------------------------------------
PROVIDES_devel="
x265${secondaryArchSuffix}_devel = $portVersion
devel:libx265$secondaryArchSuffix = 35
"
REQUIRES_devel="
x265$secondaryArchSuffix == $portVersion base
"