@@ -1,7 +1,56 @@
1−{ callPackage, ... } @ args:
1+{ stdenv, fetchurl, cmake, yasm
2+, debugSupport ? false # Run-time sanity checks (debugging)
3+, highbitdepthSupport ? false # false=8bits per channel, true=10/12bits per channel
4+, werrorSupport ? false # Warnings as errors
5+, ppaSupport ? false # PPA profiling instrumentation
6+, vtuneSupport ? false # Vtune profiling instrumentation
7+, custatsSupport ? false # Internal profiling of encoder work
8+, cliSupport ? true # Build standalone CLI application
9+, unittestsSupport ? false # Unit tests
10+}:
211
3−callPackage ./generic.nix (args // {
4− version = "1.5";
5− rev = "9f0324125f53a12f766f6ed6f98f16e2f42337f4";
6− sha256 = "1nyim0l975faj7926s4wba8yvjy4rvx005zb7krv0gb5p84nzgi7";
7−})
12+let
13+ mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF";
14+ inherit (stdenv) is64bit;
15+in
16+
17+stdenv.mkDerivation rec {
18+ name = "x265-${version}";
19+ version = "1.6";
20+
21+ src = fetchurl {
22+ url = "https://github.com/videolan/x265/archive/${version}.tar.gz";
23+ sha256 = "17c1phwmgcvvh9bakh1249rj2js77nr7y9igg34i3f8hsrdc4x0w";
24+ };
25+
26+ patchPhase = ''
27+ sed -i 's/unknown/${version}/g' source/cmake/version.cmake
28+ '';
29+
30+ cmakeFlags = [
31+ (mkFlag debugSupport "CHECKED_BUILD")
32+ "-DSTATIC_LINK_CRT=OFF"
33+ (mkFlag (highbitdepthSupport && is64bit) "HIGH_BIT_DEPTH")
34+ (mkFlag werrorSupport "WARNINGS_AS_ERRORS")
35+ (mkFlag ppaSupport "ENABLE_PPA")
36+ (mkFlag vtuneSupport "ENABLE_VTUNE")
37+ (mkFlag custatsSupport "DETAILED_CU_STATS")
38+ "-DENABLE_SHARED=ON"
39+ (mkFlag cliSupport "ENABLE_CLI")
40+ (mkFlag unittestsSupport "ENABLE_TESTS")
41+ ];
42+
43+ preConfigure = ''
44+ cd source
45+ '';
46+
47+ nativeBuildInputs = [ cmake yasm ];
48+
49+ meta = with stdenv.lib; {
50+ description = "Library for encoding h.265/HEVC video streams";
51+ homepage = http://x265.org;
52+ license = licenses.gpl2;
53+ maintainers = with maintainers; [ codyopel ];
54+ platforms = platforms.all;
55+ };
56+}