1 { stdenv, lib, fetchFromGitLab, fetchpatch, nasm
2 , enableShared ? !stdenv.hostPlatform.isStatic
5 stdenv.mkDerivation rec {
7 version = "unstable-2021-06-13";
9 src = fetchFromGitLab {
10 domain = "code.videolan.org";
13 rev = "5db6aa6cab1b146e07b60cc1736a01f21da01154";
14 sha256 = "0swyrkz6nvajivxvrr08py0jrfcsjvpxw78xm1k5gd9xbdrxvknh";
17 # Upstream ./configure greps for (-mcpu|-march|-mfpu) in CFLAGS, which in nix
18 # is put in the cc wrapper anyway.
20 ./disable-arm-neon-default.patch
22 # https://code.videolan.org/videolan/x264/-/merge_requests/114
23 name = "fix-parallelism.patch";
24 url = "https://code.videolan.org/videolan/x264/-/commit/e067ab0b530395f90b578f6d05ab0a225e2efdf9.patch";
25 hash = "sha256-16h2IUCRjYlKI2RXYq8QyXukAdfoQxyBKsK/nI6vhRI=";
33 enableParallelBuilding = true;
35 outputs = [ "out" "lib" "dev" ];
37 preConfigure = lib.optionalString (stdenv.buildPlatform.isx86_64 || stdenv.hostPlatform.isi686) ''
38 # `AS' is set to the binutils assembler, but we need nasm
40 '' + lib.optionalString stdenv.hostPlatform.isAarch ''
44 configureFlags = lib.optional enableShared "--enable-shared"
45 ++ lib.optional (!stdenv.isi686) "--enable-pic"
46 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--cross-prefix=${stdenv.cc.targetPrefix}";
48 nativeBuildInputs = lib.optional stdenv.hostPlatform.isx86 nasm;
51 description = "Library for encoding H264/AVC video streams";
52 homepage = "http://www.videolan.org/developers/x264.html";
53 license = licenses.gpl2Plus;
54 platforms = platforms.unix;
55 maintainers = with maintainers; [ spwhitt tadeokondrak ];