2019-06-16 20:59:06 +01:00
|
|
|
{ stdenv, lib, fetchgit, darwin, writeText
|
2019-01-17 23:45:26 +00:00
|
|
|
, git, ninja, python2 }:
|
2017-07-08 20:12:33 +01:00
|
|
|
|
2018-09-15 22:58:11 +01:00
|
|
|
let
|
2019-07-30 03:30:53 +01:00
|
|
|
rev = "64b846c96daeb3eaf08e26d8a84d8451c6cb712b";
|
|
|
|
sha256 = "1v2kzsshhxn0ck6gd5w16gi2m3higwd9vkyylmsczxfxnw8skgpy";
|
2018-09-15 22:58:11 +01:00
|
|
|
|
|
|
|
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
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "gn";
|
2019-07-30 03:30:53 +01:00
|
|
|
version = "20190403";
|
2018-09-07 19:04:22 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://gn.googlesource.com/gn";
|
2018-09-15 22:58:11 +01:00
|
|
|
inherit rev sha256;
|
2018-09-07 19:04:22 +01:00
|
|
|
};
|
2018-04-25 02:54:36 +01:00
|
|
|
|
2019-01-17 23:45:26 +00:00
|
|
|
nativeBuildInputs = [ ninja python2 git ];
|
2018-09-07 19:04:22 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
|
2018-04-25 02:54:36 +01:00
|
|
|
libobjc
|
|
|
|
cctools
|
|
|
|
|
|
|
|
# frameworks
|
|
|
|
ApplicationServices
|
|
|
|
Foundation
|
|
|
|
AppKit
|
|
|
|
]);
|
|
|
|
|
|
|
|
buildPhase = ''
|
2019-07-28 20:47:26 +01:00
|
|
|
python build/gen.py --no-last-commit-position
|
2018-09-15 22:58:11 +01:00
|
|
|
ln -s ${lastCommitPosition} out/last_commit_position.h
|
2018-09-07 19:04:22 +01:00
|
|
|
ninja -j $NIX_BUILD_CORES -C out gn
|
2018-04-25 02:54:36 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2018-09-07 19:04:22 +01:00
|
|
|
install -vD out/gn "$out/bin/gn"
|
2018-04-25 02:54:36 +01:00
|
|
|
'';
|
|
|
|
|
2019-03-01 00:19:04 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2018-04-25 02:54:36 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A meta-build system that generates NinjaBuild files";
|
2018-09-07 19:04:22 +01:00
|
|
|
homepage = https://gn.googlesource.com/gn;
|
2018-04-25 02:54:36 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ stesie matthewbauer ];
|
|
|
|
};
|
|
|
|
}
|