diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-07-26 23:48:03 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-07-26 23:50:12 +0200 |
commit | 2e8cabb8d630a8423e2e5a3bf150c1c0310b945d (patch) | |
tree | 246681e13528c29ef1ff9e2f30283ff043f7cb83 /guix/gexp.scm | |
parent | 2cc5ec7f0d64e9e94f6ae637e1f9573d4b948f0a (diff) |
gexp: 'program-file' honors the current system and cross-compilation target.
Fixes <https://bugs.gnu.org/36813>.
Reported by Jakob L. Kreuze <zerodaysfordays.sdf.org@sdf.org>.
* guix/gexp.scm (program-file-compiler): Pass #:system and #:target to
'gexp->script'.
(load-path-expression): Add #:system and #:target and honor them.
(gexp->script): Likewise.
* tests/gexp.scm ("program-file #:system"): New test.
* doc/guix.texi (G-Expressions): Adjust accordingly.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index a83d7168d2..45cd5869f7 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -427,7 +427,9 @@ This is the declarative counterpart of 'gexp->script'." (($ <program-file> name gexp guile module-path) (gexp->script name gexp #:module-path module-path - #:guile (or guile (default-guile)))))) + #:guile (or guile (default-guile)) + #:system system + #:target target)))) (define-record-type <scheme-file> (%scheme-file name gexp splice?) @@ -1512,7 +1514,7 @@ TARGET, a GNU triplet." 'guile-2.2)) (define* (load-path-expression modules #:optional (path %load-path) - #:key (extensions '())) + #:key (extensions '()) system target) "Return as a monadic value a gexp that sets '%load-path' and '%load-compiled-path' to point to MODULES, a list of module names. MODULES are searched for in PATH. Return #f when MODULES and EXTENSIONS are empty." @@ -1520,10 +1522,13 @@ are searched for in PATH. Return #f when MODULES and EXTENSIONS are empty." (with-monad %store-monad (return #f)) (mlet %store-monad ((modules (imported-modules modules - #:module-path path)) + #:module-path path + #:system system)) (compiled (compiled-modules modules #:extensions extensions - #:module-path path))) + #:module-path path + #:system system + #:target target))) (return (gexp (eval-when (expand load eval) (set! %load-path (cons (ungexp modules) @@ -1545,14 +1550,18 @@ are searched for in PATH. Return #f when MODULES and EXTENSIONS are empty." (define* (gexp->script name exp #:key (guile (default-guile)) - (module-path %load-path)) + (module-path %load-path) + (system (%current-system)) + target) "Return an executable script NAME that runs EXP using GUILE, with EXP's imported modules in its search path. Look up EXP's modules in MODULE-PATH." (mlet %store-monad ((set-load-path (load-path-expression (gexp-modules exp) module-path #:extensions - (gexp-extensions exp)))) + (gexp-extensions exp) + #:system system + #:target target))) (gexp->derivation name (gexp (call-with-output-file (ungexp output) @@ -1572,6 +1581,8 @@ imported modules in its search path. Look up EXP's modules in MODULE-PATH." (write '(ungexp exp) port) (chmod port #o555)))) + #:system system + #:target target #:module-path module-path))) (define* (gexp->file name exp #:key |