gnu: linux-initrd: Add (guix build linux-initrd) and use it.
[jackhill/guix/guix.git] / guix / build / perl-build-system.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
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.
10 ;;;
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.
15 ;;;
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/>.
18
19 (define-module (guix build perl-build-system)
20 #:use-module ((guix build gnu-build-system)
21 #:renamer (symbol-prefix-proc 'gnu:))
22 #:use-module (guix build utils)
23 #:use-module (ice-9 match)
24 #:export (%standard-phases
25 perl-build))
26
27 ;; Commentary:
28 ;;
29 ;; Builder-side code of the standard Perl package build procedure.
30 ;;
31 ;; Code:
32
33 (define* (configure #:key outputs (make-maker-flags '())
34 #:allow-other-keys)
35 "Configure the given Perl package."
36 (let ((out (assoc-ref outputs "out")))
37 (if (file-exists? "Makefile.PL")
38 (let ((args `("Makefile.PL" ,(string-append "PREFIX=" out)
39 "INSTALLDIRS=site" ,@make-maker-flags)))
40 (format #t "running `perl' with arguments ~s~%" args)
41 (zero? (apply system* "perl" args)))
42 (error "no Makefile.PL found"))))
43
44 (define %standard-phases
45 ;; Everything is as with the GNU Build System except for the `configure'
46 ;; phase.
47 (alist-replace 'configure configure
48 gnu:%standard-phases))
49
50 (define* (perl-build #:key inputs (phases %standard-phases)
51 #:allow-other-keys #:rest args)
52 "Build the given Perl package, applying all of PHASES in order."
53 (apply gnu:gnu-build
54 #:inputs inputs #:phases phases
55 args))
56
57 ;;; perl-build-system.scm ends here