1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 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)
20 #:use-module (guix records)
21 #:use-module (ice-9 match)
22 #:export (build-system
25 build-system-description
42 (define-record-type* <build-system> build-system make-build-system
44 (name build-system-name) ; symbol
45 (description build-system-description) ; short description
46 (lower build-system-lower)) ; args ... -> bags
48 ;; "Bags" are low-level representations of "packages". The system and target
49 ;; of a bag is fixed when it's created. This is because build systems may
50 ;; choose inputs as a function of the system and target.
51 (define-record-type* <bag> bag %make-bag
53 (name bag-name) ;string
55 (system bag-system) ;string
56 (target bag-target ;string | #f
59 ;; Here we use build/host/target in the sense of the GNU tool chain (info
60 ;; "(autoconf) Specifying Target Triplets").
61 (build-inputs bag-build-inputs ;list of packages
63 (host-inputs bag-host-inputs ;list of packages
66 ;; "Target inputs" are packages that are built natively, but that are used
67 ;; by target programs in a cross-compilation environment. Thus, they act
68 ;; like 'inputs' as far as search paths are concerned. The only example of
69 ;; that is the cross-libc: it is an input of 'cross-gcc', thus built
70 ;; natively; yet, we want it to be considered as a target input for the
71 ;; purposes of $CPATH, $LIBRARY_PATH, etc.
72 (target-inputs bag-target-inputs
75 (outputs bag-outputs ;list of strings
77 (arguments bag-arguments ;list
79 (build bag-build)) ;bag -> derivation
81 (define* (make-bag build-system name
82 #:key source (inputs '()) (native-inputs '())
83 (outputs '()) (arguments '())
85 "Ask BUILD-SYSTEM to return a 'bag' for NAME, with the given SOURCE,
86 INPUTS, NATIVE-INPUTS, OUTPUTS, and additional ARGUMENTS. If TARGET is not
87 #f, it must be a string with the GNU triplet of a cross-compilation target.
89 This is the mechanism by which a package is \"lowered\" to a bag, which is the
90 intermediate representation just above derivations."
92 (($ <build-system> _ description lower)
97 #:native-inputs native-inputs