2018-10-31 19:00:25 +01:00
|
|
|
{ stdenv, fetchurl, fetchpatch, cmake, yasm
|
2015-04-24 12:51:45 +02:00
|
|
|
, 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
|
|
|
|
}:
|
2014-11-03 01:14:44 +01:00
|
|
|
|
2015-04-24 12:51:45 +02:00
|
|
|
let
|
|
|
|
mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF";
|
|
|
|
inherit (stdenv) is64bit;
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "x265-${version}";
|
2018-10-31 19:00:25 +01:00
|
|
|
version = "2.9";
|
2015-04-24 12:51:45 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-02-07 13:18:48 +01:00
|
|
|
urls = [
|
2018-10-31 19:00:25 +01:00
|
|
|
"https://get.videolan.org/x265/x265_${version}.tar.gz"
|
|
|
|
"ftp://ftp.videolan.org/pub/videolan/x265/x265_${version}.tar.gz"
|
2016-02-07 13:18:48 +01:00
|
|
|
];
|
2018-10-31 19:00:25 +01:00
|
|
|
sha256 = "090hp4216isis8q5gb7bwzia8rfyzni54z21jnwm97x3hiy6ibpb";
|
2015-04-24 12:51:45 +02:00
|
|
|
};
|
|
|
|
|
2016-06-18 13:29:34 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-10-31 19:00:25 +01:00
|
|
|
patches = [
|
|
|
|
# Fix issue #442 (linking issue on non-x86 platforms)
|
|
|
|
# Applies on v2.9 only, this should be removed at next update
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://bitbucket.org/multicoreware/x265/commits/471726d3a0462739ff8e3518eb1a1e8a01de4e8d/raw";
|
|
|
|
sha256 = "0mj8lb8ng8lrhzjavap06vjhqf6j0r3sn76c6rhs3012f86lv928";
|
|
|
|
})
|
2018-12-19 23:14:16 +01:00
|
|
|
# Fix build on ARM (#406)
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://bitbucket.org/multicoreware/x265/issues/attachments/406/multicoreware/x265/1527562952.26/406/X265-2.8-asm-primitives.patch";
|
|
|
|
sha256 = "1vf8bpl37gbd9dcbassgkq9i0rp24qm3bl6hx9zv325174bn402v";
|
|
|
|
})
|
2018-10-31 19:00:25 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2015-04-24 12:51:45 +02:00
|
|
|
sed -i 's/unknown/${version}/g' source/cmake/version.cmake
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
(mkFlag debugSupport "CHECKED_BUILD")
|
|
|
|
"-DSTATIC_LINK_CRT=OFF"
|
|
|
|
(mkFlag (highbitdepthSupport && is64bit) "HIGH_BIT_DEPTH")
|
|
|
|
(mkFlag werrorSupport "WARNINGS_AS_ERRORS")
|
|
|
|
(mkFlag ppaSupport "ENABLE_PPA")
|
|
|
|
(mkFlag vtuneSupport "ENABLE_VTUNE")
|
|
|
|
(mkFlag custatsSupport "DETAILED_CU_STATS")
|
|
|
|
"-DENABLE_SHARED=ON"
|
|
|
|
(mkFlag cliSupport "ENABLE_CLI")
|
|
|
|
(mkFlag unittestsSupport "ENABLE_TESTS")
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
cd source
|
|
|
|
'';
|
|
|
|
|
2016-09-01 16:22:35 +02:00
|
|
|
postInstall = ''
|
|
|
|
rm $out/lib/*.a
|
|
|
|
'';
|
|
|
|
|
2015-04-24 12:51:45 +02:00
|
|
|
nativeBuildInputs = [ cmake yasm ];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Library for encoding h.265/HEVC video streams";
|
|
|
|
homepage = http://x265.org;
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ codyopel ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|