diff options
author | Yuriy Taraday <yorik.sar@gmail.com> | 2018-09-16 01:58:11 +0400 |
---|---|---|
committer | Yuriy Taraday <yorik.sar@gmail.com> | 2018-09-16 01:58:11 +0400 |
commit | b53e495a3891163eb888544e8f7b35ee6128511e (patch) | |
tree | da6855b6152af11e084a99c270d84a0bbd1fc578 | |
parent | 13c500ae165b3e3f3237667895099d498aef64bd (diff) | |
download | nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar.gz nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar.bz2 nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar.lz nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar.xz nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.tar.zst nixlib-b53e495a3891163eb888544e8f7b35ee6128511e.zip |
gn: generate last_commit_position.h without git
For Git to work properly, I used fetchgit with leaveDotGit. This seems to be causing hash to change on different systems in different times. I've replaced generation of last_commit_position.h in tools/gen.py with just plain nix template. "gn --version" will loose a bit (just commit hash, without commit height in front of it), but I hope noone relies on it.
-rw-r--r-- | pkgs/development/tools/build-managers/gn/default.nix | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/pkgs/development/tools/build-managers/gn/default.nix b/pkgs/development/tools/build-managers/gn/default.nix index 75719036c107..a273afd71580 100644 --- a/pkgs/development/tools/build-managers/gn/default.nix +++ b/pkgs/development/tools/build-managers/gn/default.nix @@ -1,16 +1,28 @@ -{ stdenv, lib, fetchgit, fetchzip, fetchpatch, darwin +{ stdenv, lib, fetchgit, fetchzip, fetchpatch, darwin, writeText , git, ninja, python }: +let + rev = "106b823805adcc043b2bfe5bc21d58f160a28a7b"; + sha256 = "1a5s6i07s8l4f1bakh3fyaym00xz7zgd49sp6awm10xb7yjh95ba"; + + shortRev = builtins.substring 0 7 rev; + lastCommitPosition = writeText "last_commit_position.h" '' + #ifndef OUT_LAST_COMMIT_POSITION_H_ + #define OUT_LAST_COMMIT_POSITION_H_ + + #define LAST_COMMIT_POSITION "(${shortRev})" + + #endif // OUT_LAST_COMMIT_POSITION_H_ + ''; + +in stdenv.mkDerivation rec { name = "gn-${version}"; version = "20180830"; src = fetchgit { url = "https://gn.googlesource.com/gn"; - rev = "106b823805adcc043b2bfe5bc21d58f160a28a7b"; - leaveDotGit = true; # gen.py uses "git describe" to generate last_commit_position.h - deepClone = true; - sha256 = "00xl7rfcwyig23q6qnqzv13lvzm3n30di242zcz2m9rdlfspiayb"; + inherit rev sha256; }; postPatch = '' @@ -31,7 +43,8 @@ stdenv.mkDerivation rec { ]); buildPhase = '' - python build/gen.py --no-sysroot + python build/gen.py --no-sysroot --no-last-commit-position + ln -s ${lastCommitPosition} out/last_commit_position.h ninja -j $NIX_BUILD_CORES -C out gn ''; |