From bf6438f46583003cfd851c9f8ff4104aa3107c4d Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 31 May 2020 14:56:57 +0200 Subject: [PATCH] gnu: ccl: Prevent creating invalid derivation on unsupported platforms. * gnu/packages/lisp.scm (ccl)[inputs]: For the "ccl-bootstrap" input, use the x86 origin as the fallback entry. [arguments]: Add (ice-9 match) in #:modules. Rewrite phases to use the scoped SYSTEM variable instead of splicing in a match on %CURRENT-SYSTEM. --- gnu/packages/lisp.scm | 50 +++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 21e1a0449b..97b8f0d80d 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -592,25 +592,24 @@ (define-public ccl (uri (string-append "https://github.com/Clozure/ccl/releases/download/v" version "/" (match (%current-system) - ((or "i686-linux" "x86_64-linux") "linuxx86") ("armhf-linux" "linuxarm") - ;; Prevent errors when querying this package on unsupported - ;; platforms, e.g. when running "guix package --search=" - (_ "UNSUPPORTED")) + ;; XXX: This source only works on x86, but provide it as a + ;; catch-all to prevent errors when querying this package + ;; on unsupported platforms. + (_ "linuxx86")) ".tar.gz")) (sha256 (base32 (match (%current-system) - ((or "i686-linux" "x86_64-linux") - "15l7cfa4a7jkfwdzsfm4q3n22jnb57imxahpql3h77xin57v1gbz") ("armhf-linux" "0x4bjx6cxsjvxyagijhlvmc7jkyxifdvz5q5zvz37028va65243c") - (_ "")))))))) + (_ "15l7cfa4a7jkfwdzsfm4q3n22jnb57imxahpql3h77xin57v1gbz")))))))) (native-inputs `(("m4" ,m4))) (arguments `(#:tests? #f ;no 'check' target - #:modules ((srfi srfi-26) + #:modules ((ice-9 match) + (srfi srfi-26) (guix build utils) (guix build gnu-build-system)) #:phases @@ -622,19 +621,16 @@ (define-public ccl (add-before 'build 'pre-build ;; Enter the source directory for the current platform's lisp ;; kernel, and run 'make clean' to remove the precompiled one. - (lambda _ + (lambda* (#:key system #:allow-other-keys) (substitute* "lisp-kernel/m4macros.m4" (("/bin/pwd") (which "pwd"))) (chdir (string-append "lisp-kernel/" - ,(match (or (%current-target-system) (%current-system)) - ("i686-linux" "linuxx8632") - ("x86_64-linux" "linuxx8664") - ("armhf-linux" "linuxarm") - ;; Prevent errors when querying this package - ;; on unsupported platforms, e.g. when running - ;; "guix package --search=" - (_ "UNSUPPORTED")))) + (match system + ("i686-linux" "linuxx8632") + ("x86_64-linux" "linuxx8664") + ("armhf-linux" "linuxarm") + (_ (string-append "unknown system: " system))))) (substitute* '("Makefile") (("/bin/rm") "rm")) (setenv "CC" "gcc") @@ -642,7 +638,7 @@ (define-public ccl ;; XXX Do we need to recompile the heap image as well for Guix? ;; For now just use the one we already got in the tarball. (replace 'install - (lambda* (#:key outputs inputs #:allow-other-keys) + (lambda* (#:key outputs inputs system #:allow-other-keys) ;; The lisp kernel built by running 'make' in lisp-kernel/$system ;; is put back into the original directory, so go back. The heap ;; image is there as well. @@ -653,20 +649,18 @@ (define-public ccl (wrapper (string-append bindir "ccl")) (bash (assoc-ref inputs "bash")) (kernel - ,(match (or (%current-target-system) (%current-system)) - ("i686-linux" "lx86cl") - ("x86_64-linux" "lx86cl64") - ("armhf-linux" "armcl") - ;; Prevent errors when querying this package - ;; on unsupported platforms, e.g. when running - ;; "guix package --search=" - (_ "UNSUPPORTED"))) + (match system + ("i686-linux" "lx86cl") + ("x86_64-linux" "lx86cl64") + ("armhf-linux" "armcl") + ;; Unlikely to work, but try it anyway... + (_ system))) (heap (string-append kernel ".image"))) (install-file kernel libdir) (install-file heap libdir) - (let ((dirs '("lib" "library" "examples" "tools" "objc-bridge" - ,@(match (%current-system) + (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge" + ,@(match system ("x86_64-linux" '("x86-headers64")) ("i686-linux"