gnu: r-igraph: Move to (gnu packages cran).
[jackhill/guix/guix.git] / guix / build / scons-build-system.scm
CommitLineData
3d0aa7f7
AI
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
2eeffc0a 3;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
3d0aa7f7
AI
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (guix build scons-build-system)
21 #:use-module ((guix build gnu-build-system) #:prefix gnu:)
22 #:use-module (guix build utils)
23 #:export (%standard-phases
24 scons-build))
25
26;; Commentary:
27;;
28;; Builder-side code of the SCons build system.
29;;
30;; Code:
31
e214a220 32(define* (build #:key outputs (build-targets '()) (scons-flags '()) (parallel-build? #t) #:allow-other-keys)
3d0aa7f7
AI
33 (let ((out (assoc-ref outputs "out")))
34 (mkdir-p out)
2eeffc0a
MW
35 (apply invoke "scons"
36 (append (if parallel-build?
37 (list "-j" (number->string
38 (parallel-job-count)))
39 (list))
e214a220
CD
40 scons-flags
41 build-targets))))
3d0aa7f7
AI
42
43(define* (check #:key tests? test-target (scons-flags '()) #:allow-other-keys)
44 "Run the test suite of a given SCons application."
2eeffc0a
MW
45 (if tests?
46 (apply invoke "scons" test-target scons-flags)
47 (format #t "test suite not run~%"))
48 #t)
3d0aa7f7 49
e214a220 50(define* (install #:key outputs (install-targets '("install")) (scons-flags '()) #:allow-other-keys)
3d0aa7f7 51 "Install a given SCons application."
e214a220 52 (apply invoke "scons" (append scons-flags install-targets)))
3d0aa7f7
AI
53
54(define %standard-phases
55 (modify-phases gnu:%standard-phases
189be331 56 (delete 'bootstrap)
3d0aa7f7
AI
57 (delete 'configure)
58 (replace 'build build)
59 (replace 'check check)
60 (replace 'install install)))
61
62(define* (scons-build #:key inputs (phases %standard-phases)
63 #:allow-other-keys #:rest args)
64 "Build a given SCons application, applying all of PHASES in order."
65 (apply gnu:gnu-build #:inputs inputs #:phases phases args))
66
67;;; scons-build-system.scm ends here