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