summary refs log tree commit diff
path: root/guix/build-system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-05 16:32:25 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-05 21:58:42 +0200
commitd3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2 (patch)
tree4b1c5c20515e88fdecf1626673d1f9864942ab1f /guix/build-system.scm
parentb4469d8c12905f07a6825654bc3313beb0563cad (diff)
downloadguix-d3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2.tar.gz
build-system: Bags record their system and target.
* guix/build-system.scm (<bag>)[system, target]: New fields.
  (make-bag): Add #:system parameter and pass it to LOWER.
* gnu/packages/bootstrap.scm (make-raw-bag): Initialize 'system' field.
* guix/build-system/cmake.scm (lower): Likewise.
* guix/build-system/perl.scm (lower): Likewise.
* guix/build-system/python.scm (lower): Likewise.
* guix/build-system/ruby.scm (lower): Likewise.
* guix/build-system/trivial.scm (lower): Likewise.
* guix/build-system/gnu.scm (lower): Initialize 'system' and 'target'
  fields.
* guix/packages.scm (bag->derivation, bag->cross-derivation): New
  procedures.
  (package-derivation, package-cross-derivation): Use 'bag->derivation'.
* tests/packages.scm ("search paths"): Initialize 'system' and 'target'
  fields.
  ("package->bag", "package->bag, cross-compilation", "bag->derivation",
  "bag->derivation, cross-compilation"): New tests.
Diffstat (limited to 'guix/build-system.scm')
-rw-r--r--guix/build-system.scm18
1 files changed, 14 insertions, 4 deletions
diff --git a/guix/build-system.scm b/guix/build-system.scm
index f185d5704f..4174972b98 100644
--- a/guix/build-system.scm
+++ b/guix/build-system.scm
@@ -28,6 +28,8 @@
             bag
             bag?
             bag-name
+            bag-system
+            bag-target
             bag-build-inputs
             bag-host-inputs
             bag-target-inputs
@@ -43,12 +45,19 @@
   (description build-system-description)  ; short description
   (lower       build-system-lower))       ; args ... -> bags
 
-;; "Bags" are low-level representations of "packages".  Here we use
-;; build/host/target in the sense of the GNU tool chain (info "(autoconf)
-;; Specifying Target Triplets").
+;; "Bags" are low-level representations of "packages".  The system and target
+;; of a bag is fixed when it's created.  This is because build systems may
+;; choose inputs as a function of the system and target.
 (define-record-type* <bag> bag %make-bag
   bag?
   (name          bag-name)               ;string
+
+  (system        bag-system)             ;string
+  (target        bag-target              ;string | #f
+                 (default #f))
+
+  ;; Here we use build/host/target in the sense of the GNU tool chain (info
+  ;; "(autoconf) Specifying Target Triplets").
   (build-inputs  bag-build-inputs        ;list of packages
                  (default '()))
   (host-inputs   bag-host-inputs         ;list of packages
@@ -72,7 +81,7 @@
 (define* (make-bag build-system name
                    #:key source (inputs '()) (native-inputs '())
                    (outputs '()) (arguments '())
-                   target)
+                   system target)
   "Ask BUILD-SYSTEM to return a 'bag' for NAME, with the given SOURCE,
 INPUTS, NATIVE-INPUTS, OUTPUTS, and additional ARGUMENTS.  If TARGET is not
 #f, it must be a string with the GNU triplet of a cross-compilation target.
@@ -82,6 +91,7 @@ intermediate representation just above derivations."
   (match build-system
     (($ <build-system> _ description lower)
      (apply lower name
+            #:system system
             #:source source
             #:inputs inputs
             #:native-inputs native-inputs