1{stdenv, fetchurl, yasm, enable10bit ? false}:
2
3stdenv.mkDerivation rec {
4 version = "20170731-2245";
5 name = "x264-${version}";
6
7 src = fetchurl {
8 url = "http://download.videolan.org/x264/snapshots/x264-snapshot-${version}-stable.tar.bz2";
9 sha256 = "01sgk1ps4qfifdnblwa3fxnd8ah6n6zbmfc1sy09cgqcdgzxgj0z";
10 };
11
12 patchPhase = ''
13 sed -i s,/bin/bash,${stdenv.shell}, configure version.sh
14 '';
15
16 outputs = [ "out" "lib" ]; # leaving 52 kB of headers
17
18 preConfigure = ''
19 # `AS' is set to the binutils assembler, but we need yasm
20 unset AS
21 '';
22
23 configureFlags = [ "--enable-shared" ]
24 ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic"
25 ++ stdenv.lib.optional (enable10bit) "--bit-depth=10";
26
27 buildInputs = [ yasm ];
28
29 meta = with stdenv.lib; {
30 description = "Library for encoding H264/AVC video streams";
31 homepage = http://www.videolan.org/developers/x264.html;
32 license = licenses.gpl2;
33 platforms = platforms.unix;
34 maintainers = [ maintainers.spwhitt ];
35 };
36}