From cee81d59ac8c9ca834c97bd20b7529440040b5c6 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 17 Dec 2018 08:32:50 -0600 Subject: [PATCH 1/2] libaom: create shared libraries, fix version reported in aom.pc See added comment for explanation of version fix. --- pkgs/development/libraries/libaom/default.nix | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix index a08a1e335232..77d75a8c1d33 100644 --- a/pkgs/development/libraries/libaom/default.nix +++ b/pkgs/development/libraries/libaom/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, yasm, perl, cmake, pkgconfig, python3Packages }: +{ stdenv, fetchgit, yasm, perl, cmake, pkgconfig, python3Packages, writeText }: stdenv.mkDerivation rec { name = "libaom-${version}"; @@ -13,6 +13,32 @@ stdenv.mkDerivation rec { buildInputs = [ perl yasm ]; nativeBuildInputs = [ cmake pkgconfig python3Packages.python ]; + cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; + + # * libaom tries to detect what version it is + # * I couldn't get it to grab this from git info, + # (which needs at least leaveDotGit=true) + # * it uses a perl script to parse from CHANGELOG, + # but 1.0.0 doesn't contain an entry for itself :( + # * Upstream patch that adds the entry also nukes all of + # the versions before a project change (open-sourcing?) + # and as a result is 34K which is way too big just to fix this! + # * A stable URL to fetch this from works, but... + # * Upon inspection the resulting CHANGELOG is shorter + # than this comment, so while yes this is a bit gross + # adding these 4 lines here does the job without + # a huge patch in spirit of preferring upstream's fix + # instead of `sed -i 's/v0\.1\.0/v1.0.0/g' aom.pc` or so. + postPatch = let actual_changelog = writeText "CHANGELOG" '' + 2018-06-28 v1.0.0 + AOMedia Codec Workgroup Approved version 1.0 + + 2016-04-07 v0.1.0 "AOMedia Codec 1" + This release is the first Alliance for Open Media codec. + ''; in '' + cp ${actual_changelog} CHANGELOG + ''; + meta = with stdenv.lib; { description = "AV1 Bitstream and Decoding Library"; homepage = https://aomedia.org/av1-features/get-started/; From 1720abc263384992c10587dc51f8635bfa4e2391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 17 Dec 2018 23:22:17 +0100 Subject: [PATCH 2/2] libaom: use git stub instead of patching changelog It probably needs less maintenance. --- pkgs/development/libraries/libaom/default.nix | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix index 77d75a8c1d33..f6ff7e758956 100644 --- a/pkgs/development/libraries/libaom/default.nix +++ b/pkgs/development/libraries/libaom/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, yasm, perl, cmake, pkgconfig, python3Packages, writeText }: +{ stdenv, fetchgit, yasm, perl, cmake, pkgconfig, python3, writeText }: stdenv.mkDerivation rec { name = "libaom-${version}"; @@ -10,33 +10,22 @@ stdenv.mkDerivation rec { sha256 = "07h2vhdiq7c3fqaz44rl4vja3dgryi6n7kwbwbj1rh485ski4j82"; }; - buildInputs = [ perl yasm ]; - nativeBuildInputs = [ cmake pkgconfig python3Packages.python ]; + nativeBuildInputs = [ + yasm perl cmake pkgconfig python3 + ]; - cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + ]; - # * libaom tries to detect what version it is - # * I couldn't get it to grab this from git info, - # (which needs at least leaveDotGit=true) - # * it uses a perl script to parse from CHANGELOG, - # but 1.0.0 doesn't contain an entry for itself :( - # * Upstream patch that adds the entry also nukes all of - # the versions before a project change (open-sourcing?) - # and as a result is 34K which is way too big just to fix this! - # * A stable URL to fetch this from works, but... - # * Upon inspection the resulting CHANGELOG is shorter - # than this comment, so while yes this is a bit gross - # adding these 4 lines here does the job without - # a huge patch in spirit of preferring upstream's fix - # instead of `sed -i 's/v0\.1\.0/v1.0.0/g' aom.pc` or so. - postPatch = let actual_changelog = writeText "CHANGELOG" '' - 2018-06-28 v1.0.0 - AOMedia Codec Workgroup Approved version 1.0 - - 2016-04-07 v0.1.0 "AOMedia Codec 1" - This release is the first Alliance for Open Media codec. - ''; in '' - cp ${actual_changelog} CHANGELOG + preConfigure = '' + # build uses `git describe` to set the build version + cat > $NIX_BUILD_TOP/git << "EOF" + #!${stdenv.shell} + echo v${version} + EOF + chmod +x $NIX_BUILD_TOP/git + export PATH=$NIX_BUILD_TOP:$PATH ''; meta = with stdenv.lib; {