1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 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 ant)
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 (ice-9 match)
28 #:use-module (srfi srfi-26)
29 #:export (%ant-build-system-modules
35 ;; Standard build procedure for Java packages using Ant.
39 (define %ant-build-system-modules
40 ;; Build-side modules imported by default.
41 `((guix build ant-build-system)
43 ,@%gnu-build-system-modules))
46 "Return the default JDK package."
47 ;; Lazily resolve the binding to avoid a circular dependency.
48 (let ((jdk-mod (resolve-interface '(gnu packages java))))
49 (module-ref jdk-mod 'icedtea)))
52 "Return the default Ant package."
53 ;; Lazily resolve the binding to avoid a circular dependency.
54 (let ((jdk-mod (resolve-interface '(gnu packages java))))
55 (module-ref jdk-mod 'ant)))
58 #:key source inputs native-inputs outputs system target
63 "Return a bag for NAME."
64 (define private-keywords
65 '(#:source #:target #:jdk #:ant #:inputs #:native-inputs))
67 (and (not target) ;XXX: no cross-compilation
71 (host-inputs `(,@(if source
76 ;; Keep the standard inputs of 'gnu-build-system'.
77 ,@(standard-packages)))
78 (build-inputs `(("jdk" ,jdk "jdk")
83 (arguments (strip-keyword-arguments private-keywords arguments)))))
85 (define* (ant-build store name inputs
89 (configure-flags ''())
93 (phases '(@ (guix build ant-build-system)
97 (system (%current-system))
99 (imported-modules %ant-build-system-modules)
100 (modules '((guix build ant-build-system)
101 (guix build utils))))
102 "Build SOURCE with INPUTS."
105 (use-modules ,@modules)
106 (ant-build #:name ,name
107 #:source ,(match (assoc-ref inputs "source")
108 (((? derivation? source))
109 (derivation->output-path source))
114 #:make-flags ,make-flags
115 #:configure-flags ,configure-flags
118 #:test-target ,test-target
119 #:build-target ,build-target
123 #:search-paths ',(map search-path-specification->sexp
125 #:inputs %build-inputs)))
127 (define guile-for-build
130 (package-derivation store guile system #:graft? #f))
132 (let* ((distro (resolve-interface '(gnu packages commencement)))
133 (guile (module-ref distro 'guile-final)))
134 (package-derivation store guile system #:graft? #f)))))
136 (build-expression->derivation store name builder
139 #:modules imported-modules
141 #:guile-for-build guile-for-build))
143 (define ant-build-system
146 (description "The standard Ant build system")
149 ;;; ant.scm ends here