diff options
author | codyopel <codyopel@gmail.com> | 2015-02-12 17:55:23 -0500 |
---|---|---|
committer | codyopel <codyopel@gmail.com> | 2015-02-12 17:55:23 -0500 |
commit | 3f22fdf7b0f03322a08a64c183293984f7a71388 (patch) | |
tree | 1f976149c46e9d84f0317744687318509cab0320 /pkgs/development/libraries/x265 | |
parent | b60f5a004a9a1a312cbb3600e3d950671688c0d7 (diff) | |
download | nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar.gz nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar.bz2 nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar.lz nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar.xz nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.tar.zst nixlib-3f22fdf7b0f03322a08a64c183293984f7a71388.zip |
x265: refactor & add optionals
Diffstat (limited to 'pkgs/development/libraries/x265')
-rw-r--r-- | pkgs/development/libraries/x265/generic.nix | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/pkgs/development/libraries/x265/generic.nix b/pkgs/development/libraries/x265/generic.nix index 58a39dbbe384..2779b5811433 100644 --- a/pkgs/development/libraries/x265/generic.nix +++ b/pkgs/development/libraries/x265/generic.nix @@ -1,12 +1,21 @@ -{ stdenv, cmake, fetchhg, mercurial, yasm +{ stdenv, fetchhg, cmake, yasm , rev , sha256, version -, highBitDepth ? false -, debuggingSupport ? false -, enableCli ? true -, testSupport ? false +, debugSupport ? false # Run-time sanity checks (debugging) +, highbitdepthSupport ? false # false=8bits per channel, true=10/12bits per channel +, werrorSupport ? false # Warnings as errors +, ppaSupport ? false # PPA profiling instrumentation +, vtuneSupport ? false # Vtune profiling instrumentation +, custatsSupport ? false # Internal profiling of encoder work +, cliSupport ? true # Build standalone CLI application +, unittestsSupport ? false # Unit tests , ... }: +let + mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF"; +in + +with stdenv.lib; stdenv.mkDerivation rec { name = "x265-${version}"; @@ -20,39 +29,28 @@ stdenv.mkDerivation rec { sed -i 's/unknown/${version}/g' source/cmake/version.cmake ''; - cmakeFlags = with stdenv.lib; - '' - ${if debuggingSupport - then "-DCHECKED_BUILD=ON" - else "-DCHECKED_BUILD=OFF" - } - -DSTATIC_LINK_CRT=OFF - ${if (stdenv.system == "x86_64-linux" && highBitDepth) - then "-DHIGH_BIT_DEPTH=ON" - else "-DHIGH_BIT_DEPTH=OFF" - } - -DWARNINGS_AS_ERRORS=OFF - -DENABLE_PPA=OFF - -DENABLE_SHARED=ON - ${if enableCli - then "-DENABLE_CLI=ON" - else "-DENABLE_CLI=OFF" - } - ${if testSupport - then "-DENABLE_TESTS=ON" - else "-DENABLE_TESTS=OFF" - } - ''; - - preConfigure = "cd source"; - - buildInputs = [ cmake yasm ]; - - meta = with stdenv.lib; { - homepage = "http://x265.org"; + cmakeFlags = with stdenv.lib; [ + (mkFlag debugSupport "CHECKED_BUILD") + "-DSTATIC_LINK_CRT=OFF" + (mkFlag (highbitdepthSupport && stdenv.isx86_64) "HIGH_BIT_DEPTH") + (mkFlag werrorSupport "WARNINGS_AS_ERRORS") + (mkFlag ppaSupport "ENABLE_PPA") + "-DENABLE_SHARED=ON" + (mkFlag cliSupport "ENABLE_CLI") + (mkFlag unittestsSupport "ENABLE_TESTS") + ]; + + preConfigure = '' + cd source + ''; + + nativeBuildInputs = [ cmake yasm ]; + + meta = { description = "Library for encoding h.265/HEVC video streams"; - license = licenses.gpl2; - platforms = platforms.linux; + homepage = http://x265.org; + license = licenses.gpl2; maintainers = with maintainers; [ codyopel ]; + platforms = platforms.all; }; } \ No newline at end of file |