summaryrefslogtreecommitdiff
path: root/gnu/packages/build-tools.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-09-12 13:45:34 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-10-22 23:01:18 +0200
commit3ad0a35890ea3142e0ac16a8be6addd1693a10a1 (patch)
tree1c9f2b15193fb6f39cea1254922e664d42cd833c /gnu/packages/build-tools.scm
parentf232c875d2d591eac99e0168652ecbcb3d21a8ff (diff)
downloadguix-patches-3ad0a35890ea3142e0ac16a8be6addd1693a10a1.tar
guix-patches-3ad0a35890ea3142e0ac16a8be6addd1693a10a1.tar.gz
gnu: Add GN.
* gnu/packages/build-tools.scm (gn): New public variable.
Diffstat (limited to 'gnu/packages/build-tools.scm')
-rw-r--r--gnu/packages/build-tools.scm58
1 files changed, 58 insertions, 0 deletions
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 4fc2d5acf7..42de56f8c3 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
;;; Copyright © 2018 Tomáš Čech <sleep_walker@gnu.org>
+;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -98,6 +99,63 @@ it is easy to re-run the compilation with alternate programs. Bear is used to
generate such a compilation database.")
(license license:gpl3+)))
+(define-public gn
+ (let ((commit "f73698ebb33e26a0bf120e2b55d12528fd1dbe7d")
+ (revision "1481")) ;as returned by `git describe`, used below
+ (package
+ (name "gn")
+ (version (git-version "0.0" revision commit))
+ (home-page "https://gn.googlesource.com/gn")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference (url home-page) (commit commit)))
+ (sha256
+ (base32
+ "078ydwak4424bkqh3hd7q955zxp2c3qlw44lsb29i8jqap140f9d"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (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" "--no-sysroot"
+ "--no-last-commit-position")))
+ (add-after 'configure 'create-last-commit-position
+ (lambda _
+ ;; Create "last_commit_position.h" to avoid a dependency
+ ;; on 'git' (and the checkout..).
+ (call-with-output-file "out/last_commit_position.h"
+ (lambda (port)
+ (format port
+ "#define LAST_COMMIT_POSITION \"~a (~a)\"\n"
+ ,revision ,(string-take commit 8))
+ #t))))
+ (replace 'build
+ (lambda _
+ (invoke "ninja" "-C" "out" "gn"
+ "-j" (number->string (parallel-job-count)))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (install-file "out/gn" (string-append out "/bin"))
+ #t))))))
+ (native-inputs
+ `(("ninja" ,ninja)
+ ("python" ,python-2)))
+ (synopsis "Generate Ninja build files")
+ (description
+ "GN is a tool that collects information about a project from @file{.gn}
+files and generates build instructions for the Ninja build system.")
+ ;; GN is distributed as BSD-3, but bundles some files from ICU using the
+ ;; X11 license.
+ (license (list license:bsd-3 license:x11)))))
+
(define-public meson
(package
(name "meson")