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