From 68a61e9ffb4d1c8b54db68d61a3669bda50f1bd2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 17 Aug 2014 21:20:11 +0200 Subject: gexp: Add #:target parameter to 'gexp->derivation'. * guix/gexp.scm (lower-inputs): Add #:system and #:target. Use 'package->cross-derivation' when TARGET is true. Honor SYSTEM. (gexp->derivation): Add #:target argument. Pass SYSTEM and TARGET to 'lower-inputs' and 'gexp->sexp'. (gexp->sexp): Add #:system and #:target. Pass them in recursive call and to 'package-file'. * tests/gexp.scm (gexp->sexp*): Add 'system' and 'target' parameters. ("gexp->derivation, cross-compilation"): New test. --- tests/gexp.scm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/gexp.scm b/tests/gexp.scm index bdea4b8563..9cc7d41547 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -47,8 +47,11 @@ ;; Make it the default. (%guile-for-build guile-for-build) -(define (gexp->sexp* exp) - (run-with-store %store (gexp->sexp exp) +(define* (gexp->sexp* exp #:optional + (system (%current-system)) target) + (run-with-store %store (gexp->sexp exp + #:system system + #:target target) #:guile-for-build guile-for-build)) (define-syntax-rule (test-assertm name exp) @@ -223,6 +226,20 @@ (mlet %store-monad ((drv mdrv)) (return (string=? system (derivation-system drv)))))) +(test-assertm "gexp->derivation, cross-compilation" + (mlet* %store-monad ((target -> "mips64el-linux") + (exp -> (gexp (list (ungexp coreutils) + (ungexp output)))) + (xdrv (gexp->derivation "foo" exp + #:target target)) + (refs ((store-lift references) + (derivation-file-name xdrv))) + (xcu (package->cross-derivation coreutils + target)) + (cu (package->derivation coreutils))) + (return (and (member (derivation-file-name xcu) refs) + (not (member (derivation-file-name cu) refs)))))) + (define shebang (string-append "#!" (derivation->output-path guile-for-build) "/bin/guile --no-auto-compile")) -- cgit v1.2.3