Update license headers.
[jackhill/guix/guix.git] / guix / build-system / trivial.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
be13fbfa 3;;;
233e7676 4;;; This file is part of GNU Guix.
be13fbfa 5;;;
233e7676 6;;; GNU Guix is free software; you can redistribute it and/or modify it
be13fbfa
LC
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;;;
233e7676 11;;; GNU Guix is distributed in the hope that it will be useful, but
be13fbfa
LC
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
233e7676 17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
be13fbfa
LC
18
19(define-module (guix build-system trivial)
20 #:use-module (guix store)
21 #:use-module (guix utils)
22 #:use-module (guix derivations)
12d5aa0f 23 #:use-module (guix packages)
be13fbfa 24 #:use-module (guix build-system)
12d5aa0f 25 #:use-module (ice-9 match)
be13fbfa
LC
26 #:export (trivial-build-system))
27
28(define* (trivial-build store name source inputs
12d5aa0f 29 #:key outputs guile system builder (modules '()))
be13fbfa
LC
30 "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
31ignored."
12d5aa0f
LC
32 (define guile-for-build
33 (match guile
81c7948d
LC
34 ((? package?)
35 (package-derivation store guile system))
36 ((and (? string?) (? derivation-path?))
37 guile)
12d5aa0f
LC
38 (#f ; the default
39 (let* ((distro (resolve-interface '(distro packages base)))
40 (guile (module-ref distro 'guile-final)))
81c7948d 41 (package-derivation store guile system)))))
12d5aa0f 42
be13fbfa
LC
43 (build-expression->derivation store name system builder inputs
44 #:outputs outputs
12d5aa0f
LC
45 #:modules modules
46 #:guile-for-build guile-for-build))
be13fbfa
LC
47
48(define trivial-build-system
49 (build-system (name 'trivial)
50 (description
51 "Trivial build system, to run arbitrary Scheme build expressions")
52 (build trivial-build)
53 (cross-build trivial-build)))