2018-09-15 22:58:11 +01:00
|
|
|
{ stdenv, lib, fetchgit, fetchzip, fetchpatch, darwin, writeText
|
2018-09-07 19:04:22 +01:00
|
|
|
, git, ninja, python }:
|
2017-07-08 20:12:33 +01:00
|
|
|
|
2018-09-15 22:58:11 +01:00
|
|
|
let
|
2018-10-31 23:39:48 +00:00
|
|
|
rev = "96ff462cddf35f98e25fd5d098fc27bc81eab94a";
|
|
|
|
sha256 = "1ny23sprl7ygb2lpdnqxv60m8kaf4h2dmpqjp61l5vc2s7f32g97";
|
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
|
2018-09-07 19:04:22 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-05-24 05:37:33 +01:00
|
|
|
name = "gn-${version}";
|
2018-10-31 23:39:48 +00:00
|
|
|
version = "20181031";
|
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
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# FIXME Needed with old Apple SDKs
|
|
|
|
substituteInPlace base/mac/foundation_util.mm \
|
|
|
|
--replace "NSArray<NSString*>*" "NSArray*"
|
|
|
|
'';
|
|
|
|
|
2018-09-07 19:04:22 +01:00
|
|
|
nativeBuildInputs = [ ninja python git ];
|
|
|
|
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 = ''
|
2018-09-15 22:58:11 +01:00
|
|
|
python build/gen.py --no-sysroot --no-last-commit-position
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|