3
0
Fork 0
forked from mirrors/nixpkgs

x265: refactor & add optionals

This commit is contained in:
codyopel 2015-02-12 17:55:23 -05:00
parent b60f5a004a
commit 3f22fdf7b0

View file

@ -1,12 +1,21 @@
{ stdenv, cmake, fetchhg, mercurial, yasm { stdenv, fetchhg, cmake, yasm
, rev , sha256, version , rev , sha256, version
, highBitDepth ? false , debugSupport ? false # Run-time sanity checks (debugging)
, debuggingSupport ? false , highbitdepthSupport ? false # false=8bits per channel, true=10/12bits per channel
, enableCli ? true , werrorSupport ? false # Warnings as errors
, testSupport ? false , 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 { stdenv.mkDerivation rec {
name = "x265-${version}"; name = "x265-${version}";
@ -20,39 +29,28 @@ stdenv.mkDerivation rec {
sed -i 's/unknown/${version}/g' source/cmake/version.cmake sed -i 's/unknown/${version}/g' source/cmake/version.cmake
''; '';
cmakeFlags = with stdenv.lib; cmakeFlags = with stdenv.lib; [
'' (mkFlag debugSupport "CHECKED_BUILD")
${if debuggingSupport "-DSTATIC_LINK_CRT=OFF"
then "-DCHECKED_BUILD=ON" (mkFlag (highbitdepthSupport && stdenv.isx86_64) "HIGH_BIT_DEPTH")
else "-DCHECKED_BUILD=OFF" (mkFlag werrorSupport "WARNINGS_AS_ERRORS")
} (mkFlag ppaSupport "ENABLE_PPA")
-DSTATIC_LINK_CRT=OFF "-DENABLE_SHARED=ON"
${if (stdenv.system == "x86_64-linux" && highBitDepth) (mkFlag cliSupport "ENABLE_CLI")
then "-DHIGH_BIT_DEPTH=ON" (mkFlag unittestsSupport "ENABLE_TESTS")
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"; preConfigure = ''
cd source
'';
buildInputs = [ cmake yasm ]; nativeBuildInputs = [ cmake yasm ];
meta = with stdenv.lib; { meta = {
homepage = "http://x265.org";
description = "Library for encoding h.265/HEVC video streams"; description = "Library for encoding h.265/HEVC video streams";
license = licenses.gpl2; homepage = http://x265.org;
platforms = platforms.linux; license = licenses.gpl2;
maintainers = with maintainers; [ codyopel ]; maintainers = with maintainers; [ codyopel ];
platforms = platforms.all;
}; };
} }