1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
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 perl)
20 #:use-module (guix store)
21 #:use-module (guix utils)
22 #:use-module (guix derivations)
23 #:use-module (guix search-paths)
24 #:use-module (guix build-system)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix packages)
27 #:use-module (ice-9 match)
28 #:export (%perl-build-system-modules
34 ;; Standard build procedure for Perl packages using the "makefile
35 ;; maker"---i.e., "perl Makefile.PL". This is implemented as an extension of
36 ;; `gnu-build-system'.
40 (define %perl-build-system-modules
41 ;; Build-side modules imported by default.
42 `((guix build perl-build-system)
43 ,@%gnu-build-system-modules))
45 (define (default-perl)
46 "Return the default Perl package."
48 ;; Do not use `@' to avoid introducing circular dependencies.
49 (let ((module (resolve-interface '(gnu packages perl))))
50 (module-ref module 'perl)))
53 #:key source inputs native-inputs outputs
58 "Return a bag for NAME."
59 (define private-keywords
60 '(#:source #:target #:perl #:inputs #:native-inputs))
62 (and (not target) ;XXX: no cross-compilation
66 (host-inputs `(,@(if source
71 ;; Keep the standard inputs of 'gnu-build-system'.
72 ,@(standard-packages)))
73 (build-inputs `(("perl" ,perl)
77 (arguments (strip-keyword-arguments private-keywords arguments)))))
79 (define* (perl-build store name inputs
86 (make-maker-flags ''())
87 (module-build-flags ''())
88 (phases '(@ (guix build perl-build-system)
91 (system (%current-system))
93 (imported-modules %perl-build-system-modules)
94 (modules '((guix build perl-build-system)
96 "Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE
97 provides a `Makefile.PL' file as its build system."
100 (use-modules ,@modules)
101 (perl-build #:name ,name
102 #:source ,(match (assoc-ref inputs "source")
103 (((? derivation? source))
104 (derivation->output-path source))
109 #:search-paths ',(map search-path-specification->sexp
111 #:make-maker? ,make-maker?
112 #:make-maker-flags ,make-maker-flags
113 #:module-build-flags ,module-build-flags
118 #:parallel-build? ,parallel-build?
119 #:parallel-tests? ,parallel-tests?
121 #:inputs %build-inputs)))
123 (define guile-for-build
126 (package-derivation store guile system #:graft? #f))
128 (let* ((distro (resolve-interface '(gnu packages commencement)))
129 (guile (module-ref distro 'guile-final)))
130 (package-derivation store guile system #:graft? #f)))))
132 (build-expression->derivation store name builder
135 #:modules imported-modules
137 #:guile-for-build guile-for-build))
139 (define perl-build-system
142 (description "The standard Perl build system")
145 ;;; perl.scm ends here