commit:     1a09e44eac27b76085eafe0db8f52ed46c98ee41
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  7 11:35:50 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Tue Feb  7 11:35:58 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a09e44e

media-libs/x265: Fixes for arm.

Add patch to properly detect ARM.
Do not force CFLAGS for ARM, esp. -march=native which breaks when cross 
compiling.
Add neon useflag.
Disable neon on main10 & main12 profiles as those do not build, bug #589674.
Add patch to define proper symbols when disabling neon.

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 media-libs/x265/files/arm.patch  | 34 ++++++++++++++++++++++++++++++++++
 media-libs/x265/files/neon.patch | 16 ++++++++++++++++
 media-libs/x265/x265-2.2.ebuild  | 14 +++++++++++++-
 media-libs/x265/x265-9999.ebuild | 18 +++++++++++++++---
 4 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/media-libs/x265/files/arm.patch b/media-libs/x265/files/arm.patch
new file mode 100644
index 00000000..69edcde
--- /dev/null
+++ b/media-libs/x265/files/arm.patch
@@ -0,0 +1,34 @@
+More aliases for ARM.
+Do not force CFLAGS for ARM.
+
+Index: source/CMakeLists.txt
+===================================================================
+--- source.orig/CMakeLists.txt
++++ source/CMakeLists.txt
+@@ -41,7 +41,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_
+ # System architecture detection
+ string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
+ set(X86_ALIASES x86 i386 i686 x86_64 amd64)
+-set(ARM_ALIASES armv6l armv7l)
++set(ARM_ALIASES armv6l armv6j armv7l armv7a)
+ list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
+ list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
+ set(POWER_ALIASES ppc64 ppc64le)
+@@ -208,15 +208,11 @@ if(GCC)
+             endif()
+         endif()
+     endif()
+-    if(ARM AND CROSS_COMPILE_ARM)
+-        set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
+-    elseif(ARM)
++    if(ARM)
+         find_package(Neon)
+         if(CPU_HAS_NEON)
+-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
++            set(ARM_ARGS -mfpu=neon)
+             add_definitions(-DHAVE_NEON)
+-        else()
+-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+         endif()
+     endif()
+     add_definitions(${ARM_ARGS})

diff --git a/media-libs/x265/files/neon.patch b/media-libs/x265/files/neon.patch
new file mode 100644
index 00000000..444c899
--- /dev/null
+++ b/media-libs/x265/files/neon.patch
@@ -0,0 +1,16 @@
+These functions are only built when enabling assembly on ARM; use proper check
+to avoid undefined symbols.
+
+Index: source/common/primitives.cpp
+===================================================================
+--- source.orig/common/primitives.cpp
++++ source/common/primitives.cpp
+@@ -270,7 +270,7 @@ void PFX(cpu_emms)(void) {}
+ void PFX(cpu_cpuid)(uint32_t, uint32_t *eax, uint32_t *, uint32_t *, uint32_t 
*) { *eax = 0; }
+ void PFX(cpu_xgetbv)(uint32_t, uint32_t *, uint32_t *) {}
+ 
+-#if X265_ARCH_ARM == 0
++#if X265_ARCH_ARM == 0 || !defined(ENABLE_ASSEMBLY)
+ void PFX(cpu_neon_test)(void) {}
+ int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }
+ #endif // X265_ARCH_ARM

diff --git a/media-libs/x265/x265-2.2.ebuild b/media-libs/x265/x265-2.2.ebuild
index 0608b09..ac326ae 100644
--- a/media-libs/x265/x265-2.2.ebuild
+++ b/media-libs/x265/x265-2.2.ebuild
@@ -22,7 +22,7 @@ HOMEPAGE="http://x265.org/";
 LICENSE="GPL-2"
 # subslot = libx265 soname
 SLOT="0/102"
-IUSE="+10bit +12bit numa pic test"
+IUSE="+10bit +12bit neon numa pic test"
 
 ASM_DEPEND=">=dev-lang/yasm-1.2.0"
 RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
@@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
        abi_x86_32? ( ${ASM_DEPEND} )
        abi_x86_64? ( ${ASM_DEPEND} )"
 
+PATCHES=( "${FILESDIR}/arm.patch" "${FILESDIR}/neon.patch" )
+
 src_unpack() {
        if [[ ${PV} = 9999* ]]; then
                mercurial_src_unpack
@@ -79,6 +81,10 @@ x265_variant_src_configure() {
                        if [[ ${ABI} = x86 ]] ; then
                                mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
                        fi
+                       if [[ ${ABI} = arm ]] ; then
+                               # 589674
+                               mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+                       fi
                        ;;
                "main10")
                        mycmakeargs+=(
@@ -90,6 +96,10 @@ x265_variant_src_configure() {
                        if [[ ${ABI} = x86 ]] ; then
                                mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
                        fi
+                       if [[ ${ABI} = arm ]] ; then
+                               # 589674
+                               mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+                       fi
                        ;;
                "main")
                        if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
@@ -134,6 +144,8 @@ multilib_src_configure() {
        elif [[ ${ABI} = x32 ]] ; then
                # bug #510890
                myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+       elif [[ ${ABI} = arm ]] ; then
+               mycmakeargs+=( -DENABLE_ASSEMBLY=$(usex neon ON OFF) )
        fi
 
        local MULTIBUILD_VARIANTS=( $(x265_get_variants) )

diff --git a/media-libs/x265/x265-9999.ebuild b/media-libs/x265/x265-9999.ebuild
index 3ac5bf9..9edba39 100644
--- a/media-libs/x265/x265-9999.ebuild
+++ b/media-libs/x265/x265-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -21,8 +21,8 @@ HOMEPAGE="http://x265.org/";
 
 LICENSE="GPL-2"
 # subslot = libx265 soname
-SLOT="0/104"
-IUSE="+10bit +12bit numa pic test"
+SLOT="0/108"
+IUSE="+10bit +12bit neon numa pic test"
 
 ASM_DEPEND=">=dev-lang/yasm-1.2.0"
 RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
@@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
        abi_x86_32? ( ${ASM_DEPEND} )
        abi_x86_64? ( ${ASM_DEPEND} )"
 
+PATCHES=( "${FILESDIR}/arm.patch" "${FILESDIR}/neon.patch" )
+
 src_unpack() {
        if [[ ${PV} = 9999* ]]; then
                mercurial_src_unpack
@@ -79,6 +81,10 @@ x265_variant_src_configure() {
                        if [[ ${ABI} = x86 ]] ; then
                                mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
                        fi
+                       if [[ ${ABI} = arm ]] ; then
+                               # 589674
+                               mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+                       fi
                        ;;
                "main10")
                        mycmakeargs+=(
@@ -90,6 +96,10 @@ x265_variant_src_configure() {
                        if [[ ${ABI} = x86 ]] ; then
                                mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
                        fi
+                       if [[ ${ABI} = arm ]] ; then
+                               # 589674
+                               mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+                       fi
                        ;;
                "main")
                        if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
@@ -134,6 +144,8 @@ multilib_src_configure() {
        elif [[ ${ABI} = x32 ]] ; then
                # bug #510890
                myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
+       elif [[ ${ABI} = arm ]] ; then
+               mycmakeargs+=( -DENABLE_ASSEMBLY=$(usex neon ON OFF) )
        fi
 
        local MULTIBUILD_VARIANTS=( $(x265_get_variants) )

Reply via email to