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 build-system)
25 #:use-module (guix build-system gnu)
26 #:use-module ((guix build-system python)
27 #:select (default-python default-python2))
28 #:use-module (ice-9 match)
29 #:use-module (srfi srfi-26)
30 #:export (%waf-build-system-modules
36 ;; Standard build procedure for applications using 'waf'. This is very
37 ;; similar to the 'python-build-system' and is implemented as an extension of
38 ;; 'gnu-build-system'.
42 (define %waf-build-system-modules
43 ;; Build-side modules imported by default.
44 `((guix build waf-build-system)
45 ,@%gnu-build-system-modules))
48 #:key source inputs native-inputs outputs system target
49 (python (default-python))
52 "Return a bag for NAME."
53 (define private-keywords
54 '(#:source #:target #:python #:inputs #:native-inputs))
56 (and (not target) ;XXX: no cross-compilation
60 (host-inputs `(,@(if source
65 ;; Keep the standard inputs of 'gnu-build-system'.
66 ,@(standard-packages)))
67 (build-inputs `(("python" ,python)
70 (build waf-build) ; only change compared to 'lower' in python.scm
71 (arguments (strip-keyword-arguments private-keywords arguments)))))
73 (define* (waf-build store name inputs
77 (configure-flags ''())
78 (phases '(@ (guix build waf-build-system)
82 (system (%current-system))
84 (imported-modules %waf-build-system-modules)
85 (modules '((guix build waf-build-system)
87 "Build SOURCE with INPUTS. This assumes that SOURCE provides a 'waf' file
91 (use-modules ,@modules)
92 (waf-build #:name ,name
93 #:source ,(match (assoc-ref inputs "source")
94 (((? derivation? source))
95 (derivation->output-path source))
100 #:configure-flags ,configure-flags
102 #:test-target ,test-target
106 #:search-paths ',(map search-path-specification->sexp
108 #:inputs %build-inputs)))
110 (define guile-for-build
113 (package-derivation store guile system #:graft? #f))
115 (let* ((distro (resolve-interface '(gnu packages commencement)))
116 (guile (module-ref distro 'guile-final)))
117 (package-derivation store guile system #:graft? #f)))))
119 (build-expression->derivation store name builder
122 #:modules imported-modules
124 #:guile-for-build guile-for-build))
126 (define waf-build-system
129 (description "The standard waf build system")
132 ;;; waf.scm ends here