2019-06-16 20:59:06 +01:00
|
|
|
{ stdenv, lib, fetchgit, darwin, writeText
|
2020-03-24 12:54:27 +00:00
|
|
|
, ninja, python3
|
|
|
|
}:
|
2017-07-08 20:12:33 +01:00
|
|
|
|
2018-09-15 22:58:11 +01:00
|
|
|
let
|
2020-03-24 12:54:27 +00:00
|
|
|
# Note: Please use the recommended version for Chromium, e.g.:
|
|
|
|
# https://git.archlinux.org/svntogit/packages.git/tree/trunk/chromium-gn-version.sh?h=packages/gn
|
|
|
|
rev = "fd3d768bcfd44a8d9639fe278581bd9851d0ce3a";
|
|
|
|
revNum = "1718"; # git describe HEAD --match initial-commit | cut -d- -f3
|
|
|
|
version = "2020-03-09";
|
|
|
|
sha256 = "1asc14y8by7qcn10vbk467hvx93s30pif8r0brissl0sihsaqazr";
|
2018-09-15 22:58:11 +01:00
|
|
|
|
2020-03-24 12:54:27 +00:00
|
|
|
revShort = builtins.substring 0 7 rev;
|
2018-09-15 22:58:11 +01:00
|
|
|
lastCommitPosition = writeText "last_commit_position.h" ''
|
|
|
|
#ifndef OUT_LAST_COMMIT_POSITION_H_
|
|
|
|
#define OUT_LAST_COMMIT_POSITION_H_
|
|
|
|
|
2020-03-24 12:54:27 +00:00
|
|
|
#define LAST_COMMIT_POSITION_NUM ${revNum}
|
|
|
|
#define LAST_COMMIT_POSITION "${revNum} (${revShort})"
|
2018-09-15 22:58:11 +01:00
|
|
|
|
|
|
|
#endif // OUT_LAST_COMMIT_POSITION_H_
|
|
|
|
'';
|
|
|
|
|
2020-03-24 12:54:27 +00:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "gn-unstable";
|
|
|
|
inherit version;
|
2018-09-07 19:04:22 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
2020-03-24 12:54:27 +00:00
|
|
|
# Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic!
|
2018-09-07 19:04:22 +01:00
|
|
|
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
|
|
|
|
2020-03-24 12:54:27 +00:00
|
|
|
nativeBuildInputs = [ ninja python3 ];
|
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; {
|
2020-03-24 12:54:27 +00:00
|
|
|
description = "A meta-build system that generates build files for Ninja";
|
|
|
|
homepage = "https://gn.googlesource.com/gn";
|
2018-04-25 02:54:36 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.unix;
|
2020-11-03 19:01:28 +00:00
|
|
|
maintainers = with maintainers; [ stesie matthewbauer primeos ];
|
2018-04-25 02:54:36 +01:00
|
|
|
};
|
|
|
|
}
|