gnu: r-qtl2: Move to (gnu packages cran).
[jackhill/guix/guix.git] / guix / build / gnu-dist.scm
CommitLineData
fe12c345 1;;; GNU Guix --- Functional package management for GNU
2ee1cce3 2;;; Copyright © 2013, 2015, 2020 Ludovic Courtès <ludo@gnu.org>
6d084076 3;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
fe12c345
LC
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (guix build gnu-dist)
21 #:use-module (guix build utils)
22 #:use-module (guix build gnu-build-system)
23 #:use-module (srfi srfi-1)
24 #:export (%dist-phases))
25
26;;; Commentary:
27;;;
28;;; Build phases to build a source tarball with the GNU build system, as with
29;;; "make distcheck".
30;;;
31;;; Code:
32
fe12c345
LC
33(define* (build #:key build-before-dist? make-flags (dist-target "distcheck")
34 #:allow-other-keys
35 #:rest args)
6d084076
MW
36 (when build-before-dist?
37 (let ((build (assq-ref %standard-phases 'build)))
38 (apply build args)))
39 (format #t "building target `~a'~%" dist-target)
40 (apply invoke "make" dist-target make-flags))
fe12c345
LC
41
42(define* (install-dist #:key outputs #:allow-other-keys)
f9a0fc9d 43 (let ((out (assoc-ref outputs "out")))
fe12c345 44 (for-each (lambda (tarball)
f9a0fc9d
LC
45 (install-file tarball out))
46 (find-files "." "\\.tar\\."))
fe12c345
LC
47 #t))
48
49(define %dist-phases
50 ;; Phases for building a source tarball.
f84218ac 51 (modify-phases %standard-phases
f8503e2b
LC
52 (delete 'strip)
53 (replace 'install install-dist)
ba8c09f2
LC
54 (add-after 'build 'build-dist build)
55 (delete 'build)))
fe12c345
LC
56
57;;; gnu-dist.scm ends here