Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
bdb36958 | 2 | ;;; Copyright © 2012, 2013, 2014 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 | ||
5dce8218 LC |
28 | (define (guile-for-build store guile system) |
29 | (match guile | |
30 | ((? package?) | |
31 | (package-derivation store guile system)) | |
5dce8218 | 32 | (#f ; the default |
bdb36958 | 33 | (let* ((distro (resolve-interface '(gnu packages commencement))) |
5dce8218 LC |
34 | (guile (module-ref distro 'guile-final))) |
35 | (package-derivation store guile system))))) | |
36 | ||
0d5a559f LC |
37 | (define* (lower name |
38 | #:key source inputs native-inputs outputs target | |
39 | guile builder modules) | |
40 | "Return a bag for NAME." | |
41 | (bag | |
42 | (name name) | |
43 | (host-inputs `(,@(if source | |
44 | `(("source" ,source)) | |
45 | '()) | |
46 | ,@inputs)) | |
47 | (build-inputs native-inputs) | |
48 | (outputs outputs) | |
49 | (build (if target trivial-cross-build trivial-build)) | |
50 | (arguments `(#:guile ,guile | |
51 | #:builder ,builder | |
52 | #:modules ,modules)))) | |
53 | ||
54 | (define* (trivial-build store name inputs | |
a18eda27 LC |
55 | #:key |
56 | outputs guile system builder (modules '()) | |
57 | search-paths) | |
be13fbfa LC |
58 | "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is |
59 | ignored." | |
dd1a5a15 | 60 | (build-expression->derivation store name builder |
0d5a559f | 61 | #:inputs inputs |
dd1a5a15 | 62 | #:system system |
be13fbfa | 63 | #:outputs outputs |
12d5aa0f | 64 | #:modules modules |
5dce8218 LC |
65 | #:guile-for-build |
66 | (guile-for-build store guile system))) | |
67 | ||
0d5a559f | 68 | (define* (trivial-cross-build store name |
5dce8218 | 69 | #:key |
0d5a559f | 70 | target native-drvs target-drvs |
5dce8218 LC |
71 | outputs guile system builder (modules '()) |
72 | search-paths native-search-paths) | |
0d5a559f LC |
73 | "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is |
74 | ignored." | |
dd1a5a15 | 75 | (build-expression->derivation store name builder |
0d5a559f | 76 | #:inputs (append native-drvs target-drvs) |
dd1a5a15 | 77 | #:system system |
5dce8218 LC |
78 | #:outputs outputs |
79 | #:modules modules | |
80 | #:guile-for-build | |
81 | (guile-for-build store guile system))) | |
be13fbfa LC |
82 | |
83 | (define trivial-build-system | |
0d5a559f LC |
84 | (build-system |
85 | (name 'trivial) | |
86 | (description | |
87 | "Trivial build system, to run arbitrary Scheme build expressions") | |
88 | (lower lower))) |