gn1924: init at 2021-08-08, use generic derivation generator

Split into "current" version, as used by most things (aka gn),
and "gn1924", which uses a more recent version of gn which is
incompatible with the currently packaged version of v8 in nixpkgs.

We can't win, but I need a newer version of gn for envoy.

Note that the newer gn matches the version in Chromium's DEPS for
v93.0.4577.82, the current Linux stable build as of September.
This commit is contained in:
Luke Granger-Brown 2021-09-18 02:55:10 +00:00
parent a98017a5f9
commit 786b4216c5
3 changed files with 70 additions and 56 deletions

View file

@ -1,64 +1,10 @@
{ stdenv, lib, fetchgit, darwin, writeText
, ninja, python3
}:
{ callPackage, ... } @ args:
let
callPackage ./generic.nix args {
# 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";
revShort = 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_NUM ${revNum}
#define LAST_COMMIT_POSITION "${revNum} (${revShort})"
#endif // OUT_LAST_COMMIT_POSITION_H_
'';
in stdenv.mkDerivation {
pname = "gn-unstable";
inherit version;
src = fetchgit {
# Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic!
url = "https://gn.googlesource.com/gn";
inherit rev sha256;
};
nativeBuildInputs = [ ninja python3 ];
buildInputs = lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
libobjc
cctools
# frameworks
ApplicationServices
Foundation
AppKit
]);
buildPhase = ''
python build/gen.py --no-last-commit-position
ln -s ${lastCommitPosition} out/last_commit_position.h
ninja -j $NIX_BUILD_CORES -C out gn
'';
installPhase = ''
install -vD out/gn "$out/bin/gn"
'';
setupHook = ./setup-hook.sh;
meta = with lib; {
description = "A meta-build system that generates build files for Ninja";
homepage = "https://gn.googlesource.com/gn";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ stesie matthewbauer primeos ];
};
}

View file

@ -0,0 +1,60 @@
{ stdenv, lib, fetchgit, darwin, writeText
, ninja, python3
, ...
}:
{ rev, revNum, version, sha256 }:
let
revShort = 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_NUM ${revNum}
#define LAST_COMMIT_POSITION "${revNum} (${revShort})"
#endif // OUT_LAST_COMMIT_POSITION_H_
'';
in stdenv.mkDerivation {
pname = "gn-unstable";
inherit version;
src = fetchgit {
# Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic!
url = "https://gn.googlesource.com/gn";
inherit rev sha256;
};
nativeBuildInputs = [ ninja python3 ];
buildInputs = lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
libobjc
cctools
# frameworks
ApplicationServices
Foundation
AppKit
]);
buildPhase = ''
python build/gen.py --no-last-commit-position
ln -s ${lastCommitPosition} out/last_commit_position.h
ninja -j $NIX_BUILD_CORES -C out gn
'';
installPhase = ''
install -vD out/gn "$out/bin/gn"
'';
setupHook = ./setup-hook.sh;
meta = with lib; {
description = "A meta-build system that generates build files for Ninja";
homepage = "https://gn.googlesource.com/gn";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ stesie matthewbauer primeos ];
};
}

View file

@ -0,0 +1,8 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix args {
rev = "24e2f7df92641de0351a96096fb2c490b2436bb8";
revNum = "1924"; # git describe HEAD --match initial-commit | cut -d- -f3
version = "2021-08-08";
sha256 = "1lwkyhfhw0zd7daqz466n7x5cddf0danr799h4jg3s0yvd4galjl";
}