From 8e59c5febd2dad171fe90caf04d8b3eb31ca3b31 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 27 Nov 2018 19:16:24 +0200 Subject: [PATCH] gnu: x265: Fix building on armhf-linux. * gnu/packages/video.scm (x265)[patches]: Add patch. [arguments]: Add a configure-flag to disable assembly. Adjust a custom phase to recognize armv8 as 32-bit arm when masquerading as armhf-linux. --- gnu/local.mk | 1 + gnu/packages/patches/x265-arm-flags.patch | 36 +++++++++++++++++++++++ gnu/packages/video.scm | 10 ++++++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/x265-arm-flags.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0cd9fad2e5..29d07f5192 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1243,6 +1243,7 @@ dist_patch_DATA = \ %D%/packages/patches/wpa-supplicant-fix-zeroed-keys.patch \ %D%/packages/patches/wpa-supplicant-fix-nonce-reuse.patch \ %D%/packages/patches/wpa-supplicant-krack-followups.patch \ + %D%/packages/patches/x265-arm-flags.patch \ %D%/packages/patches/x265-detect512-all-arches.patch \ %D%/packages/patches/xboing-CVE-2004-0149.patch \ %D%/packages/patches/xf86-video-ark-remove-mibstore.patch \ diff --git a/gnu/packages/patches/x265-arm-flags.patch b/gnu/packages/patches/x265-arm-flags.patch new file mode 100644 index 0000000000..f17e26f6f1 --- /dev/null +++ b/gnu/packages/patches/x265-arm-flags.patch @@ -0,0 +1,36 @@ +https://sources.debian.org/src/x265/2.9-3/debian/patches/0001-Fix-arm-flags.patch/ + +From: Sebastian Ramacher +Date: Wed, 26 Apr 2017 22:05:06 +0200 +Subject: Fix arm* flags + +--- + source/CMakeLists.txt | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt +index 33b6523..25aecbb 100644 +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -72,7 +72,7 @@ elseif(ARMMATCH GREATER "-1") + endif() + message(STATUS "Detected ARM target processor") + set(ARM 1) +- add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1) ++ # add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1) + else() + message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown") + message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}") +@@ -230,12 +230,8 @@ if(GCC) + if(ARM AND CROSS_COMPILE_ARM) + set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) + elseif(ARM) +- find_package(Neon) + if(CPU_HAS_NEON) +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) + 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/gnu/packages/video.scm b/gnu/packages/video.scm index 1e1c988c25..fc3ee5c72b 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -405,7 +405,8 @@ and creating Matroska files from other media files (@code{mkvmerge}).") (sha256 (base32 "090hp4216isis8q5gb7bwzia8rfyzni54z21jnwm97x3hiy6ibpb")) - (patches (search-patches "x265-detect512-all-arches.patch")) + (patches (search-patches "x265-arm-flags.patch" + "x265-detect512-all-arches.patch")) (modules '((guix build utils))) (snippet '(begin (delete-file-recursively "source/compat/getopt") @@ -416,6 +417,10 @@ and creating Matroska files from other media files (@code{mkvmerge}).") #:configure-flags ;; Ensure position independent code for everyone. (list "-DENABLE_PIC=TRUE" + ,@(if (string-prefix? "armhf" (or (%current-system) + (%current-target-system))) + '("-DENABLE_ASSEMBLY=OFF") + '()) (string-append "-DCMAKE_INSTALL_PREFIX=" (assoc-ref %outputs "out"))) #:phases @@ -424,6 +429,9 @@ and creating Matroska files from other media files (@code{mkvmerge}).") (lambda _ (delete-file-recursively "build") (chdir "source") + ;; recognize armv8 in 32-bit mode as ARM + (substitute* "CMakeLists.txt" + (("armv6l") "armv8l")) #t)) (add-before 'configure 'build-12-bit (lambda* (#:key (configure-flags '()) #:allow-other-keys)