1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (guix build-system waf)
20 #:use-module (guix store)
21 #:use-module (guix utils)
22 #:use-module (guix packages)
23 #:use-module (guix derivations)
24 #:use-module (guix search-paths)
25 #:use-module (guix build-system)
26 #:use-module (guix build-system gnu)
27 #:use-module ((guix build-system python)
28 #:select (default-python default-python2))
29 #:use-module (ice-9 match)
30 #:use-module (srfi srfi-26)
31 #:export (%waf-build-system-modules
37 ;; Standard build procedure for applications using 'waf'. This is very
38 ;; similar to the 'python-build-system' and is implemented as an extension of
39 ;; 'gnu-build-system'.
43 (define %waf-build-system-modules
44 ;; Build-side modules imported by default.
45 `((guix build waf-build-system)
46 ,@%gnu-build-system-modules))
49 #:key source inputs native-inputs outputs system target
50 (python (default-python))
53 "Return a bag for NAME."
54 (define private-keywords
55 '(#:source #:target #:python #:inputs #:native-inputs))
57 (and (not target) ;XXX: no cross-compilation
61 (host-inputs `(,@(if source
66 ;; Keep the standard inputs of 'gnu-build-system'.
67 ,@(standard-packages)))
68 (build-inputs `(("python" ,python)
71 (build waf-build) ; only change compared to 'lower' in python.scm
72 (arguments (strip-keyword-arguments private-keywords arguments)))))
74 (define* (waf-build store name inputs
78 (configure-flags ''())
79 (phases '(@ (guix build waf-build-system)
83 (system (%current-system))
85 (imported-modules %waf-build-system-modules)
86 (modules '((guix build waf-build-system)
88 "Build SOURCE with INPUTS. This assumes that SOURCE provides a 'waf' file
92 (use-modules ,@modules)
93 (waf-build #:name ,name
94 #:source ,(match (assoc-ref inputs "source")
95 (((? derivation? source))
96 (derivation->output-path source))
101 #:configure-flags ,configure-flags
103 #:test-target ,test-target
107 #:search-paths ',(map search-path-specification->sexp
109 #:inputs %build-inputs)))
111 (define guile-for-build
114 (package-derivation store guile system #:graft? #f))
116 (let* ((distro (resolve-interface '(gnu packages commencement)))
117 (guile (module-ref distro 'guile-final)))
118 (package-derivation store guile system #:graft? #f)))))
120 (build-expression->derivation store name builder
123 #:modules imported-modules
125 #:guile-for-build guile-for-build))
127 (define waf-build-system
130 (description "The standard waf build system")
133 ;;; waf.scm ends here