Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchzip, yasm, perl, cmake, pkg-config, python3 2, enableButteraugli ? true, libjxl 3, enableVmaf ? true, libvmaf 4}: 5 6let 7 isCross = stdenv.buildPlatform != stdenv.hostPlatform; 8in 9stdenv.mkDerivation rec { 10 pname = "libaom"; 11 version = "3.6.1"; 12 13 src = fetchzip { 14 url = "https://aomedia.googlesource.com/aom/+archive/v${version}.tar.gz"; 15 sha256 = "sha256-U7hmKdpjTtqStM4UIjCvgJ2swpZ1x0Px1Q9+gSHbaeQ="; 16 stripRoot = false; 17 }; 18 19 patches = [ ./outputs.patch ]; 20 21 nativeBuildInputs = [ 22 yasm perl cmake pkg-config python3 23 ]; 24 25 propagatedBuildInputs = lib.optional enableButteraugli libjxl 26 ++ lib.optional enableVmaf libvmaf; 27 28 preConfigure = '' 29 # build uses `git describe` to set the build version 30 cat > $NIX_BUILD_TOP/git << "EOF" 31 #!${stdenv.shell} 32 echo v${version} 33 EOF 34 chmod +x $NIX_BUILD_TOP/git 35 export PATH=$NIX_BUILD_TOP:$PATH 36 ''; 37 38 # Configuration options: 39 # https://aomedia.googlesource.com/aom/+/refs/heads/master/build/cmake/aom_config_defaults.cmake 40 41 cmakeFlags = [ 42 "-DBUILD_SHARED_LIBS=ON" 43 "-DENABLE_TESTS=OFF" 44 ] ++ lib.optionals enableButteraugli [ 45 "-DCONFIG_TUNE_BUTTERAUGLI=1" 46 ] ++ lib.optionals enableVmaf [ 47 "-DCONFIG_TUNE_VMAF=1" 48 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 49 # CPU detection isn't supported on Darwin and breaks the aarch64-darwin build: 50 "-DCONFIG_RUNTIME_CPU_DETECT=0" 51 ] ++ lib.optionals (isCross && !stdenv.hostPlatform.isx86) [ 52 "-DAS_EXECUTABLE=${stdenv.cc.targetPrefix}as" 53 ] ++ lib.optionals stdenv.isAarch32 [ 54 # armv7l-hf-multiplatform does not support NEON 55 # see lib/systems/platform.nix 56 "-DENABLE_NEON=0" 57 ]; 58 59 postFixup = '' 60 moveToOutput lib/libaom.a "$static" 61 '' + lib.optionalString stdenv.hostPlatform.isStatic '' 62 ln -s $static $out 63 ''; 64 65 outputs = [ "out" "bin" "dev" "static" ]; 66 67 meta = with lib; { 68 description = "Alliance for Open Media AV1 codec library"; 69 longDescription = '' 70 Libaom is the reference implementation of the AV1 codec from the Alliance 71 for Open Media. It contains an AV1 library as well as applications like 72 an encoder (aomenc) and a decoder (aomdec). 73 ''; 74 homepage = "https://aomedia.org/av1-features/get-started/"; 75 changelog = "https://aomedia.googlesource.com/aom/+/refs/tags/v${version}/CHANGELOG"; 76 maintainers = with maintainers; [ primeos kiloreux dandellion ]; 77 platforms = platforms.all; 78 outputsToInstall = [ "bin" ]; 79 license = licenses.bsd2; 80 }; 81}