x265: fix ARM cross compilation

authored by rnhmjoj and committed by Rick van Schijndel 771eb24c 926ad2ff

+33 -1
+5 -1
pkgs/development/libraries/x265/default.nix
··· 25 let 26 mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF"; 27 28 cmakeCommonFlags = [ 29 "-Wno-dev" 30 (mkFlag custatsSupport "DETAILED_CU_STATS") ··· 81 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/x265/files/test-ns.patch?id=1d1de341e1404a46b15ae3e84bc400d474cf1a2c"; 82 sha256 = "0zg3g53l07yh7ar5c241x50y5zp7g8nh8rh63ad4bdpchpc2f52d"; 83 }) 84 ]; 85 86 postPatch = '' ··· 107 "-DENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" 108 "-DHIGH_BIT_DEPTH=OFF" 109 "-DENABLE_HDR10_PLUS=ON" 110 - ] ++ [ 111 (mkFlag cliSupport "ENABLE_CLI") 112 (mkFlag unittestsSupport "ENABLE_TESTS") 113 ] ++ lib.optionals (multibitdepthSupport) [
··· 25 let 26 mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF"; 27 28 + isCross = stdenv.buildPlatform != stdenv.hostPlatform; 29 + 30 cmakeCommonFlags = [ 31 "-Wno-dev" 32 (mkFlag custatsSupport "DETAILED_CU_STATS") ··· 83 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/x265/files/test-ns.patch?id=1d1de341e1404a46b15ae3e84bc400d474cf1a2c"; 84 sha256 = "0zg3g53l07yh7ar5c241x50y5zp7g8nh8rh63ad4bdpchpc2f52d"; 85 }) 86 + # Fix detection of NEON (and armv6 build) : 87 + ./fix-neon-detection.patch 88 ]; 89 90 postPatch = '' ··· 111 "-DENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" 112 "-DHIGH_BIT_DEPTH=OFF" 113 "-DENABLE_HDR10_PLUS=ON" 114 + (mkFlag (isCross && stdenv.hostPlatform.isAarch) "CROSS_COMPILE_ARM") 115 (mkFlag cliSupport "ENABLE_CLI") 116 (mkFlag unittestsSupport "ENABLE_TESTS") 117 ] ++ lib.optionals (multibitdepthSupport) [
+28
pkgs/development/libraries/x265/fix-neon-detection.patch
···
··· 1 + commit 72489cd0a1c229258abe4f20e4fdfd414dfa88da 2 + Author: rnhmjoj <rnhmjoj@inventati.org> 3 + Date: Sun Oct 2 00:15:24 2022 +0200 4 + 5 + Fix NEON detection 6 + 7 + diff --git a/cmake/FindNeon.cmake b/cmake/FindNeon.cmake 8 + index 0062449..9c436d9 100644 9 + --- a/cmake/FindNeon.cmake 10 + +++ b/cmake/FindNeon.cmake 11 + @@ -1,10 +1,11 @@ 12 + include(FindPackageHandleStandardArgs) 13 + 14 + # Check the version of neon supported by the ARM CPU 15 + -execute_process(COMMAND cat /proc/cpuinfo | grep Features | grep neon 16 + - OUTPUT_VARIABLE neon_version 17 + - ERROR_QUIET 18 + - OUTPUT_STRIP_TRAILING_WHITESPACE) 19 + -if(neon_version) 20 + - set(CPU_HAS_NEON 1) 21 + +message(STATUS "Detecting NEON support") 22 + +execute_process(COMMAND sed -n "/Features.* neon/q 1" /proc/cpuinfo 23 + + RESULT_VARIABLE CPU_HAS_NEON) 24 + +if(CPU_HAS_NEON) 25 + + message(STATUS "Detecting NEON support - supported") 26 + +else() 27 + + message(STATUS "Detecting NEON support - not supported" ) 28 + endif()