at 24.11-pre 61 lines 1.8 kB view raw
1{ stdenv 2, lib 3, fetchFromGitLab 4, nasm 5, enableShared ? !stdenv.hostPlatform.isStatic 6}: 7 8stdenv.mkDerivation rec { 9 pname = "x264"; 10 version = "0-unstable-2023-10-01"; 11 12 src = fetchFromGitLab { 13 domain = "code.videolan.org"; 14 owner = "videolan"; 15 repo = pname; 16 rev = "31e19f92f00c7003fa115047ce50978bc98c3a0d"; 17 hash = "sha256-7/FaaDFmoVhg82BIhP3RbFq4iKGNnhviOPxl3/8PWCM="; 18 }; 19 20 patches = [ 21 # Upstream ./configure greps for (-mcpu|-march|-mfpu) in CFLAGS, which in nix 22 # is put in the cc wrapper anyway. 23 ./disable-arm-neon-default.patch 24 ]; 25 26 postPatch = lib.optionalString stdenv.isDarwin '' 27 substituteInPlace Makefile --replace '$(if $(STRIP), $(STRIP) -x $@)' '$(if $(STRIP), $(STRIP) -S $@)' 28 ''; 29 30 enableParallelBuilding = true; 31 32 outputs = [ "out" "lib" "dev" ]; 33 34 preConfigure = lib.optionalString stdenv.hostPlatform.isx86 '' 35 # `AS' is set to the binutils assembler, but we need nasm 36 unset AS 37 '' + lib.optionalString stdenv.hostPlatform.isAarch '' 38 export AS=$CC 39 ''; 40 41 configureFlags = lib.optional enableShared "--enable-shared" 42 ++ lib.optional (!stdenv.isi686) "--enable-pic" 43 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--cross-prefix=${stdenv.cc.targetPrefix}"; 44 45 makeFlags = [ 46 "BASHCOMPLETIONSDIR=$(out)/share/bash-completion/completions" 47 "install-bashcompletion" 48 "install-lib-shared" 49 ]; 50 51 nativeBuildInputs = lib.optional stdenv.hostPlatform.isx86 nasm; 52 53 meta = with lib; { 54 description = "Library for encoding H264/AVC video streams"; 55 mainProgram = "x264"; 56 homepage = "http://www.videolan.org/developers/x264.html"; 57 license = licenses.gpl2Plus; 58 platforms = platforms.unix ++ platforms.windows; 59 maintainers = with maintainers; [ tadeokondrak ]; 60 }; 61}