1 { lib, stdenv, fetchzip, yasm, perl, cmake, pkg-config, python3
2 , enableButteraugli ? true, libjxl
3 , enableVmaf ? true, libvmaf
7 isCross = stdenv.buildPlatform != stdenv.hostPlatform;
9 stdenv.mkDerivation rec {
14 url = "https://aomedia.googlesource.com/aom/+archive/v${version}.tar.gz";
15 sha256 = "sha256-kEU8DVgB4JoyB6Lbh/XfC3LZcsVEM2STkZV8iZBCNis=";
19 patches = [ ./outputs.patch ];
22 yasm perl cmake pkg-config python3
25 propagatedBuildInputs = lib.optional enableButteraugli libjxl
26 ++ lib.optional enableVmaf libvmaf;
29 # build uses `git describe` to set the build version
30 cat > $NIX_BUILD_TOP/git << "EOF"
34 chmod +x $NIX_BUILD_TOP/git
35 export PATH=$NIX_BUILD_TOP:$PATH
38 # Configuration options:
39 # https://aomedia.googlesource.com/aom/+/refs/heads/master/build/cmake/aom_config_defaults.cmake
42 "-DBUILD_SHARED_LIBS=ON"
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
60 moveToOutput lib/libaom.a "$static"
61 '' + lib.optionalString stdenv.hostPlatform.isStatic ''
65 outputs = [ "out" "bin" "dev" "static" ];
68 description = "Alliance for Open Media AV1 codec library";
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).
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;