commit:     e2661dbb76e81cc081c1220350c11e0a82401dd4
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun May 24 14:58:19 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun May 24 20:23:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2661dbb

media-libs/x265: migrate to EAPI=7

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 media-libs/x265/files/x265-3.3-arm.patch   | 34 ++++++++++++++++++++++++++
 media-libs/x265/files/x265-3.3-neon.patch  | 16 ++++++++++++
 media-libs/x265/files/x265-3.3-ppc64.patch | 15 ++++++++++++
 media-libs/x265/x265-3.3.ebuild            | 39 +++++++++++++++++-------------
 4 files changed, 87 insertions(+), 17 deletions(-)

diff --git a/media-libs/x265/files/x265-3.3-arm.patch 
b/media-libs/x265/files/x265-3.3-arm.patch
new file mode 100644
index 00000000000..7e7c8c58b72
--- /dev/null
+++ b/media-libs/x265/files/x265-3.3-arm.patch
@@ -0,0 +1,34 @@
+More aliases for ARM.
+Do not force CFLAGS for ARM.
+
+Index: source/CMakeLists.txt
+===================================================================
+--- old/CMakeLists.txt
++++ new/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/x265-3.3-neon.patch 
b/media-libs/x265/files/x265-3.3-neon.patch
new file mode 100644
index 00000000000..316e670febe
--- /dev/null
+++ b/media-libs/x265/files/x265-3.3-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
+===================================================================
+--- old/common/primitives.cpp
++++ new/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/files/x265-3.3-ppc64.patch 
b/media-libs/x265/files/x265-3.3-ppc64.patch
new file mode 100644
index 00000000000..8e739e3fab1
--- /dev/null
+++ b/media-libs/x265/files/x265-3.3-ppc64.patch
@@ -0,0 +1,15 @@
+More complete ppc64 matches.
+
+Index: x265_2.2/source/CMakeLists.txt
+===================================================================
+--- old/CMakeLists.txt
++++ new/CMakeLists.txt
+@@ -44,7 +44,7 @@ set(X86_ALIASES x86 i386 i686 x86_64 amd
+ set(ARM_ALIASES armv6l armv6j armv7l armv7a)
+ list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
+ list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
+-set(POWER_ALIASES ppc64 ppc64le)
++set(POWER_ALIASES ppc64 ppc64le powerpc64 powerpc64le)
+ list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH)
+ if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
+     set(X86 1)

diff --git a/media-libs/x265/x265-3.3.ebuild b/media-libs/x265/x265-3.3.ebuild
index 41f53bc131e..9fc0159bc00 100644
--- a/media-libs/x265/x265-3.3.ebuild
+++ b/media-libs/x265/x265-3.3.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI="7"
 
 inherit cmake-utils multilib-minimal multilib multibuild flag-o-matic
 
@@ -25,19 +25,22 @@ IUSE="+10bit +12bit cpu_flags_arm_neon numa pic power8 test"
 RESTRICT="test"
 
 ASM_DEPEND=">=dev-lang/yasm-1.2.0"
-RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
-DEPEND="${RDEPEND}
-       abi_x86_32? ( ${ASM_DEPEND} )
+
+BDEPEND="abi_x86_32? ( ${ASM_DEPEND} )
        abi_x86_64? ( ${ASM_DEPEND} )"
 
+RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
+
+DEPEND="${RDEPEND}"
+
 PATCHES=(
-       "${FILESDIR}/arm.patch"
-       "${FILESDIR}/neon.patch"
-       "${FILESDIR}/ppc64.patch"
+       "${FILESDIR}"/${PN}-3.3-arm.patch
+       "${FILESDIR}"/${PN}-3.3-neon.patch
+       "${FILESDIR}"/${PN}-3.3-ppc64.patch
 )
 
 src_unpack() {
-       if [[ ${PV} = 9999* ]]; then
+       if [[ ${PV} = 9999* ]] ; then
                mercurial_src_unpack
                # Can't set it at global scope due to mercurial.eclass 
limitations...
                export S=${WORKDIR}/${P}/source
@@ -61,11 +64,11 @@ src_unpack() {
 # allow disabling it: "main" *MUST* come last in the following list.
 
 x265_get_variants() {
-       local variants=""
-       use 12bit && variants+="main12 "
-       use 10bit && variants+="main10 "
-       variants+="main"
-       echo "${variants}"
+       local -a variants=()
+       use 12bit && variants+=( main12 )
+       use 10bit && variants+=( main10 )
+       variants+=( main )
+       echo "${variants[@]}"
 }
 
 x265_variant_src_configure() {
@@ -117,9 +120,9 @@ x265_variant_src_configure() {
                        if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
                                local myvariants=( "${MULTIBUILD_VARIANTS[@]}" )
                                unset myvariants[${#MULTIBUILD_VARIANTS[@]}-1]
-                               local liblist=""
+                               local liblist="" v=
                                for v in "${myvariants[@]}" ; do
-                                       ln -s "${BUILD_DIR%-*}-${v}/libx265.a" 
"libx265_${v}.a" ||      die
+                                       ln -s "${BUILD_DIR%-*}-${v}/libx265.a" 
"libx265_${v}.a" || die
                                        liblist+="libx265_${v}.a;"
                                done
                                mycmakeargs+=(
@@ -133,6 +136,7 @@ x265_variant_src_configure() {
                *)
                        die "Unknown variant: ${MULTIBUILD_VARIANT}";;
        esac
+
        cmake-utils_src_configure
        popd >/dev/null || die
 }
@@ -140,8 +144,9 @@ x265_variant_src_configure() {
 multilib_src_configure() {
        append-cflags -fPIC
        append-cxxflags -fPIC
+
        local myabicmakeargs=(
-               $(cmake-utils_use_enable test TESTS)
+               -DENABLE_TESTS=$(usex test ON OFF)
                $(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
                -DENABLE_LIBNUMA=$(usex numa ON OFF)
                -DCPU_POWER8=$(usex power8 ON OFF)
@@ -173,7 +178,7 @@ multilib_src_compile() {
 }
 
 x265_variant_src_test() {
-       if [ -x "${BUILD_DIR}/test/TestBench" ] ; then
+       if [[ -x "${BUILD_DIR}/test/TestBench" ]] ; then
                "${BUILD_DIR}/test/TestBench" || die
        else
                einfo "Unit tests check only assembly."

Reply via email to