# GNU Guix --- Functional package management for GNU # Copyright © 2012-2014, 2016-2024 Ludovic Courtès # Copyright © 2020 Marius Bakke # Copyright © 2021 Chris Marusich # # This file is part of GNU Guix. # # GNU Guix is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Guix is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Guix. If not, see . # # Test the `guix build' command-line utility. # guix build --version # Should fail. guix build -e + && false # Source-less packages are accepted; they jus
aboutsummaryrefslogtreecommitdiff
blob: 11ee472d56108f7c30beefb5a31e3eda32fdfc22 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ninja)
  #:use-module ((guix licenses) #:select (asl2.0))
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages python))

(define-public ninja
  (package
    (name "ninja")
    (version "1.10.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ninja-build/ninja")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1fbzl7mrcrwp527sgkc1npfl3k6bbpydpiq98xcf1a1hkrx0z5x4"))))
    (build-system gnu-build-system)
    (inputs `(("python" ,python-wrapper)))
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda _
             (substitute* "src/subprocess-posix.cc"
               (("/bin/sh") (which "sh")))
             (substitute* "src/subprocess_test.cc"
               (("/bin/echo") (which "echo")))
             #t))
         (replace 'build
           (lambda _
             (invoke "./configure.py" "--bootstrap")))
         (replace 'check
           (lambda _
             (invoke "./configure.py")
             (invoke "./ninja" "ninja_test")
             (invoke "./ninja_test")))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (doc (string-append out "/share/doc/ninja")))
               (install-file "ninja" bin)
               (install-file "doc/manual.asciidoc" doc)
               #t))))))
    (home-page "https://ninja-build.org/")
    (synopsis "Small build system")
    (description
     "Ninja is a small build system with a focus on speed.  It differs from
other build systems in two major respects: it is designed to have its input
files generated by a higher-level build system, and it is designed to run
builds as fast as possible.")
    (license asl2.0)))
"t-result-$$" guix build -r "$result" \ -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' test -x "$result/bin/guile" # Should fail, because $result already exists. guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' && false rm -f "$result" # Check relative file name canonicalization: . mkdir "$result" guix build -r "$result/x" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' test -x "$result/x/bin/guile" rm "$result/x" rmdir "$result" # Cross building. guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes # Likewise, but with '-e' (see ). guix build --target=arm-linux-gnueabihf --dry-run \ -e '(@ (gnu packages base) coreutils)' # Replacements. drv1=`guix build guix --with-input=guile-zstd=idutils -d` drv2=`guix build guix -d` test "$drv1" != "$drv2" drv1=`guix build guile -d` drv2=`guix build guile --with-input=gimp=ruby -d` test "$drv1" = "$drv2" # See . drv1=`guix build glib -d` drv2=`guix build glib -d --with-input=libreoffice=inkscape` test "$drv1" = "$drv2" # '--with-graft' should have no effect when using '--no-grafts'. # See . drv1=`guix build inkscape -d --no-grafts` drv2=`guix build inkscape -d --no-grafts --with-graft=glib=glib-networking` test "$drv1" = "$drv2" # Rewriting implicit inputs. drv1=`guix build grep -d` drv2=`guix build grep -d --with-input=coreutils=hello` test "$drv1" != "$drv2" guix gc -R "$drv2" | grep `guix build -d hello` guix build guile --with-input=libunistring=something-really-silly && false # Deprecated/superseded packages. test "`guix build superseded -d`" = "`guix build bar -d`" # Parsing package names and versions. guix build -n time # PASS guix build -n time@1.9 # PASS, version found guix build -n time@3.2 && false # FAIL, version not found guix build -n something-that-will-never-exist && false # FAIL # Invoking a monadic procedure. guix build -e "(begin (use-modules (guix gexp)) (lambda () (gexp->derivation \"test\" (gexp (mkdir (ungexp output))))))" \ --dry-run # Running a gexp. guix build -e '#~(mkdir #$output)' -d guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv' # Same with a file-like object. guix build -e '(computed-file "foo" #~(mkdir #$output))' -d guix build -e '(computed-file "foo" #~(mkdir #$output))' -d | grep 'foo\.drv' # Building from a package file. cat > "$module_dir/package.scm"< "$module_dir/proc.scm"<derivation "test" (gexp (mkdir (ungexp output))))) EOF guix build --file="$module_dir/proc.scm" --dry-run # Building from a gexp file. cat > "$module_dir/gexp.scm"< "$module_dir/manifest.scm"<manifest '("hello" "guix")) EOF test `guix build -d --manifest="$module_dir/manifest.scm" \ | grep -e '-hello-' -e '-guix-' \ | wc -l` -eq 2 # Building from a manifest that contains a non-package object. cat > "$module_dir/manifest.scm"<manifest (list "guile"))') -n fi # Using 'GUIX_BUILD_OPTIONS'. GUIX_BUILD_OPTIONS="--dry-run --no-grafts" export GUIX_BUILD_OPTIONS guix build emacs GUIX_BUILD_OPTIONS="--something-completely-crazy" guix build emacs && false exit 0