From 3ad0a35890ea3142e0ac16a8be6addd1693a10a1 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 12 Sep 2018 13:45:34 +0200 Subject: gnu: Add GN. * gnu/packages/build-tools.scm (gn): New public variable. --- gnu/packages/build-tools.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'gnu/packages/build-tools.scm') 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 ;;; Copyright © 2018 Fis Trivial ;;; Copyright © 2018 Tomáš Čech +;;; Copyright © 2018 Marius Bakke ;;; ;;; 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") -- cgit v1.2.3