1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 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 build-system)
24 #:use-module (guix build-system gnu)
25 #:use-module (guix packages)
26 #:use-module (ice-9 match)
32 ;; Standard build procedure for Perl packages using the "makefile
33 ;; maker"---i.e., "perl Makefile.PL". This is implemented as an extension of
34 ;; `gnu-build-system'.
38 (define (default-perl)
39 "Return the default Perl package."
41 ;; Do not use `@' to avoid introducing circular dependencies.
42 (let ((module (resolve-interface '(gnu packages perl))))
43 (module-ref module 'perl)))
46 #:key source inputs native-inputs outputs target
50 "Return a bag for NAME."
51 (define private-keywords
52 '(#:source #:target #:perl #:inputs #:native-inputs))
54 (and (not target) ;XXX: no cross-compilation
57 (host-inputs `(,@(if source
62 ;; Keep the standard inputs of 'gnu-build-system'.
63 ,@(standard-packages)))
64 (build-inputs `(("perl" ,perl)
68 (arguments (strip-keyword-arguments private-keywords arguments)))))
70 (define* (perl-build store name inputs
76 (make-maker-flags ''())
77 (phases '(@ (guix build perl-build-system)
80 (system (%current-system))
82 (imported-modules '((guix build perl-build-system)
83 (guix build gnu-build-system)
85 (modules '((guix build perl-build-system)
87 "Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE
88 provides a `Makefile.PL' file as its build system."
91 (use-modules ,@modules)
92 (perl-build #:name ,name
93 #:source ,(match (assoc-ref inputs "source")
94 (((? derivation? source))
95 (derivation->output-path source))
100 #:search-paths ',(map search-path-specification->sexp
102 #:make-maker-flags ,make-maker-flags
107 #:parallel-build? ,parallel-build?
108 #:parallel-tests? ,parallel-tests?
110 #:inputs %build-inputs)))
112 (define guile-for-build
115 (package-derivation store guile system))
117 (let* ((distro (resolve-interface '(gnu packages commencement)))
118 (guile (module-ref distro 'guile-final)))
119 (package-derivation store guile system)))))
121 (build-expression->derivation store name builder
124 #:modules imported-modules
126 #:guile-for-build guile-for-build))
128 (define perl-build-system
131 (description "The standard Perl build system")
134 ;;; perl.scm ends here