Subject: [bug#44926] [PATCH v2 01/15] gnu: Add gn-for-dart-bootstrap.

From: nixo <[email-masked]>
Date: Sun, 29 Nov 2020 18:34:00 +0100

* gnu/packages/build-tools.scm (gn-for-dart-bootstrap): New variable.
---
 gnu/packages/build-tools.scm | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 3f140efdb3..c58e47dc98 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -177,6 +177,44 @@ files and generates build instructions for the Ninja build system.")
       ;; X11 license.
       (license (list license:bsd-3 license:x11)))))
 
+(define-public gn-for-dart-bootstrap
+  (let ((commit "041ed5e79abc24956f296ca8bc94d04e26cf3d6b")
+        (revision "1353")
+        (hash "1zd41zwggamkqy33cra75cfdx82v3spdfym6hj1lbbanabi4mpl7"))
+    (package
+      (inherit gn)
+      (name "gn-for-dart-bootstrap")
+      (version (git-version "0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gn.googlesource.com/gn")
+               (commit commit)))
+         (sha256 (base32 hash))
+         (file-name (git-file-name name version))))
+      (arguments
+       `(#:tests? #f                    ;FIXME: How to run?
+         #:phases (modify-phases %standard-phases
+		    (add-before 'configure 'set-build-environment
+		      (lambda _
+			(setenv "CC" "gcc")
+			(setenv "CXX" "g++")
+			(setenv "AR" "ar")
+			#t))
+		    (replace 'configure
+		      (lambda _
+			(invoke "python" "build/gen.py")))
+		    (replace 'build
+		      (lambda _
+			(invoke "ninja" "-C" "out" "gn")))
+		    (replace 'install
+		      (lambda* (#:key outputs #:allow-other-keys)
+			(let ((out (assoc-ref outputs "out")))
+			  (install-file "out/gn"
+					(string-append out "/bin"))
+			  #t)))))))))
+
 (define-public meson
   (package
     (name "meson")
-- 
2.29.2