| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> |
| 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> |
| 5 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
| 6 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
| 7 | ;;; |
| 8 | ;;; This file is part of GNU Guix. |
| 9 | ;;; |
| 10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 11 | ;;; under the terms of the GNU General Public License as published by |
| 12 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 13 | ;;; your option) any later version. |
| 14 | ;;; |
| 15 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | ;;; GNU General Public License for more details. |
| 19 | ;;; |
| 20 | ;;; You should have received a copy of the GNU General Public License |
| 21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 22 | |
| 23 | (define-module (gnu packages ninja) |
| 24 | #:use-module ((guix licenses) #:select (asl2.0)) |
| 25 | #:use-module (guix packages) |
| 26 | #:use-module (guix git-download) |
| 27 | #:use-module (guix build-system gnu) |
| 28 | #:use-module (gnu packages) |
| 29 | #:use-module (gnu packages python)) |
| 30 | |
| 31 | (define-public ninja |
| 32 | (package |
| 33 | (name "ninja") |
| 34 | (version "1.10.0") |
| 35 | (source (origin |
| 36 | (method git-fetch) |
| 37 | (uri (git-reference |
| 38 | (url "https://github.com/ninja-build/ninja") |
| 39 | (commit (string-append "v" version)))) |
| 40 | (file-name (git-file-name name version)) |
| 41 | (sha256 |
| 42 | (base32 |
| 43 | "1fbzl7mrcrwp527sgkc1npfl3k6bbpydpiq98xcf1a1hkrx0z5x4")))) |
| 44 | (build-system gnu-build-system) |
| 45 | (inputs `(("python" ,python-wrapper))) |
| 46 | (arguments |
| 47 | '(#:phases |
| 48 | (modify-phases %standard-phases |
| 49 | (replace 'configure |
| 50 | (lambda _ |
| 51 | (substitute* "src/subprocess-posix.cc" |
| 52 | (("/bin/sh") (which "sh"))) |
| 53 | (substitute* "src/subprocess_test.cc" |
| 54 | (("/bin/echo") (which "echo"))) |
| 55 | #t)) |
| 56 | (replace 'build |
| 57 | (lambda _ |
| 58 | (invoke "./configure.py" "--bootstrap"))) |
| 59 | (replace 'check |
| 60 | (lambda _ |
| 61 | (invoke "./configure.py") |
| 62 | (invoke "./ninja" "ninja_test") |
| 63 | (invoke "./ninja_test"))) |
| 64 | (replace 'install |
| 65 | (lambda* (#:key outputs #:allow-other-keys) |
| 66 | (let* ((out (assoc-ref outputs "out")) |
| 67 | (bin (string-append out "/bin")) |
| 68 | (doc (string-append out "/share/doc/ninja"))) |
| 69 | (install-file "ninja" bin) |
| 70 | (install-file "doc/manual.asciidoc" doc) |
| 71 | #t)))))) |
| 72 | (home-page "https://ninja-build.org/") |
| 73 | (synopsis "Small build system") |
| 74 | (description |
| 75 | "Ninja is a small build system with a focus on speed. It differs from |
| 76 | other build systems in two major respects: it is designed to have its input |
| 77 | files generated by a higher-level build system, and it is designed to run |
| 78 | builds as fast as possible.") |
| 79 | (license asl2.0))) |