lol

Merge pull request #233470 from alyssais/x265-cross

authored by

Artturi and committed by
GitHub
4b8824f6 fb93bf2a

+40 -38
+40 -38
pkgs/development/libraries/x265/default.nix
··· 26 26 mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF"; 27 27 28 28 isCross = stdenv.buildPlatform != stdenv.hostPlatform; 29 - 30 - cmakeCommonFlags = [ 31 - "-Wno-dev" 32 - (mkFlag custatsSupport "DETAILED_CU_STATS") 33 - (mkFlag debugSupport "CHECKED_BUILD") 34 - (mkFlag ppaSupport "ENABLE_PPA") 35 - (mkFlag vtuneSupport "ENABLE_VTUNE") 36 - (mkFlag werrorSupport "WARNINGS_AS_ERRORS") 37 - # Potentially riscv cross could be fixed by providing the correct CMAKE_SYSTEM_PROCESSOR flag 38 - ] ++ lib.optional (isCross && stdenv.hostPlatform.isRiscV) "-DENABLE_ASSEMBLY=OFF"; 39 - 40 - cmakeStaticLibFlags = [ 41 - "-DHIGH_BIT_DEPTH=ON" 42 - "-DENABLE_CLI=OFF" 43 - "-DENABLE_SHARED=OFF" 44 - "-DEXPORT_C_API=OFF" 45 - ] ++ lib.optionals stdenv.hostPlatform.isPower [ 46 - "-DENABLE_ALTIVEC=OFF" # https://bitbucket.org/multicoreware/x265_git/issues/320/fail-to-build-on-power8-le 47 - ]; 48 - 49 29 in 50 30 51 31 stdenv.mkDerivation rec { ··· 96 76 97 77 nativeBuildInputs = [ cmake nasm ] ++ lib.optionals (numaSupport) [ numactl ]; 98 78 79 + cmakeFlags = [ 80 + "-Wno-dev" 81 + (mkFlag custatsSupport "DETAILED_CU_STATS") 82 + (mkFlag debugSupport "CHECKED_BUILD") 83 + (mkFlag ppaSupport "ENABLE_PPA") 84 + (mkFlag vtuneSupport "ENABLE_VTUNE") 85 + (mkFlag werrorSupport "WARNINGS_AS_ERRORS") 86 + ]; 87 + 88 + cmakeStaticLibFlags = [ 89 + "-DHIGH_BIT_DEPTH=ON" 90 + "-DENABLE_CLI=OFF" 91 + "-DENABLE_SHARED=OFF" 92 + "-DEXPORT_C_API=OFF" 93 + ] ++ lib.optionals stdenv.hostPlatform.isPower [ 94 + "-DENABLE_ALTIVEC=OFF" # https://bitbucket.org/multicoreware/x265_git/issues/320/fail-to-build-on-power8-le 95 + ]; 96 + 97 + preConfigure = lib.optionalString multibitdepthSupport '' 98 + cmake -B build-10bits $cmakeFlags "''${cmakeFlagsArray[@]}" $cmakeStaticLibFlags 99 + cmake -B build-12bits $cmakeFlags "''${cmakeFlagsArray[@]}" $cmakeStaticLibFlags -DMAIN12=ON 100 + cmakeFlagsArray+=( 101 + -DEXTRA_LIB="x265-10.a;x265-12.a" 102 + -DEXTRA_LINK_FLAGS=-L. 103 + -DLINKED_10BIT=ON 104 + -DLINKED_12BIT=ON 105 + ) 106 + '' + '' 107 + cmakeFlagsArray+=( 108 + -DGIT_ARCHETYPE=1 # https://bugs.gentoo.org/814116 109 + ${mkFlag (!stdenv.hostPlatform.isStatic) "ENABLE_SHARED"} 110 + -DHIGH_BIT_DEPTH=OFF 111 + -DENABLE_HDR10_PLUS=ON 112 + ${mkFlag (isCross && stdenv.hostPlatform.isAarch) "CROSS_COMPILE_ARM"} 113 + ${mkFlag cliSupport "ENABLE_CLI"} 114 + ${mkFlag unittestsSupport "ENABLE_TESTS"} 115 + ) 116 + ''; 117 + 99 118 # Builds 10bits and 12bits static libs on the side if multi bit-depth is wanted 100 119 # (we are in x265_<version>/source/build) 101 - preBuild = lib.optionalString (multibitdepthSupport) '' 102 - cmake -S ../ -B ../build-10bits ${toString cmakeCommonFlags} ${toString cmakeStaticLibFlags} 120 + preBuild = lib.optionalString multibitdepthSupport '' 103 121 make -C ../build-10bits -j $NIX_BUILD_CORES 104 - cmake -S ../ -B ../build-12bits ${toString cmakeCommonFlags} ${toString cmakeStaticLibFlags} -DMAIN12=ON 105 122 make -C ../build-12bits -j $NIX_BUILD_CORES 106 123 ln -s ../build-10bits/libx265.a ./libx265-10.a 107 124 ln -s ../build-12bits/libx265.a ./libx265-12.a 108 125 ''; 109 - 110 - cmakeFlags = cmakeCommonFlags ++ [ 111 - "-DGIT_ARCHETYPE=1" # https://bugs.gentoo.org/814116 112 - "-DENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" 113 - "-DHIGH_BIT_DEPTH=OFF" 114 - "-DENABLE_HDR10_PLUS=ON" 115 - (mkFlag (isCross && stdenv.hostPlatform.isAarch) "CROSS_COMPILE_ARM") 116 - (mkFlag cliSupport "ENABLE_CLI") 117 - (mkFlag unittestsSupport "ENABLE_TESTS") 118 - ] ++ lib.optionals (multibitdepthSupport) [ 119 - "-DEXTRA_LIB=x265-10.a;x265-12.a" 120 - "-DEXTRA_LINK_FLAGS=-L." 121 - "-DLINKED_10BIT=ON" 122 - "-DLINKED_12BIT=ON" 123 - ]; 124 126 125 127 doCheck = unittestsSupport; 126 128 checkPhase = ''