From b4c9f0c50de39da253dadfde9e85de06d665cd1e Mon Sep 17 00:00:00 2001 From: Andy Patterson Date: Mon, 3 Apr 2017 09:01:27 -0400 Subject: build-system/asdf: Parameterize the lisp type and implementation globally. * guix/build-system/asdf.scm (asdf-build)[builder]: Parameterize %lisp-type and %lisp before invoking the build procedure. Don't pass #:lisp-type as an argument to said procedure. * guix/build/asdf-build-system.scm: Adjust accordingly. (source-install-prefix): Rename to %lisp-source-install-prefix. * guix/build/lisp-utils.scm: Adjust accordingly. (%lisp-type): New parameter. (bundle-install-prefix): Rename to %bundle-install-prefix. * gnu/packages/lisp.scm: Adjust accordingly. --- guix/build/asdf-build-system.scm | 74 +++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 42 deletions(-) (limited to 'guix/build/asdf-build-system.scm') diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm index c5f2c080dc..4305a86af9 100644 --- a/guix/build/asdf-build-system.scm +++ b/guix/build/asdf-build-system.scm @@ -43,8 +43,8 @@ (define %object-prefix "/lib") -(define (source-install-prefix lisp) - (string-append %source-install-prefix "/" lisp "-source")) +(define (%lisp-source-install-prefix) + (string-append %source-install-prefix "/" (%lisp-type) "-source")) (define %system-install-prefix (string-append %source-install-prefix "/systems")) @@ -56,28 +56,27 @@ (output-path->package-name (assoc-ref outputs "out"))) -(define (lisp-source-directory output lisp name) - (string-append output (source-install-prefix lisp) "/" name)) +(define (lisp-source-directory output name) + (string-append output (%lisp-source-install-prefix) "/" name)) (define (source-directory output name) (string-append output %source-install-prefix "/source/" name)) -(define (library-directory output lisp) +(define (library-directory output) (string-append output %object-prefix - "/" lisp)) + "/" (%lisp-type))) (define (output-translation source-path - object-output - lisp) + object-output) "Return a translation for the system's source path to it's binary output." `((,source-path :**/ :*.*.*) - (,(library-directory object-output lisp) + (,(library-directory object-output) :**/ :*.*.*))) -(define (source-asd-file output lisp name asd-file) - (string-append (lisp-source-directory output lisp name) "/" asd-file)) +(define (source-asd-file output name asd-file) + (string-append (lisp-source-directory output name) "/" asd-file)) (define (library-output outputs) "If a `lib' output exists, build things there. Otherwise use `out'." @@ -104,32 +103,29 @@ valid." "Copy and symlink all the source files." (copy-files-to-output (assoc-ref outputs "out") (outputs->name outputs))) -(define* (copy-source #:key outputs lisp-type #:allow-other-keys) +(define* (copy-source #:key outputs #:allow-other-keys) "Copy the source to the library output." (let* ((out (library-output outputs)) - (name (remove-lisp-from-name (output-path->package-name out) - lisp-type)) + (name (remove-lisp-from-name (output-path->package-name out))) (install-path (string-append out %source-install-prefix))) (copy-files-to-output out name) ;; Hide the files from asdf (with-directory-excursion install-path - (rename-file "source" (string-append lisp-type "-source")) + (rename-file "source" (string-append (%lisp-type) "-source")) (delete-file-recursively "systems"))) #t) -(define* (build #:key outputs inputs lisp-type asd-file +(define* (build #:key outputs inputs asd-file #:allow-other-keys) "Compile the system." (let* ((out (library-output outputs)) - (name (remove-lisp-from-name (output-path->package-name out) - lisp-type)) - (source-path (lisp-source-directory out lisp-type name)) + (name (remove-lisp-from-name (output-path->package-name out))) + (source-path (lisp-source-directory out name)) (translations (wrap-output-translations `(,(output-translation source-path - out - lisp-type)))) + out)))) (asd-file (and=> asd-file - (cut source-asd-file out lisp-type name <>)))) + (cut source-asd-file out name <>)))) (setenv "ASDF_OUTPUT_TRANSLATIONS" (replace-escaped-macros (format #f "~S" translations))) @@ -141,9 +137,7 @@ valid." (setenv "HOME" out) ; ecl's asdf sometimes wants to create $HOME/.cache - (parameterize ((%lisp (string-append - (assoc-ref inputs lisp-type) "/bin/" lisp-type))) - (compile-system name lisp-type asd-file)) + (compile-system name asd-file) ;; As above, ecl will sometimes create this even though it doesn't use it @@ -152,48 +146,44 @@ valid." (delete-file-recursively cache-directory)))) #t) -(define* (check #:key lisp-type tests? outputs inputs asd-file +(define* (check #:key tests? outputs inputs asd-file #:allow-other-keys) "Test the system." - (let* ((name (remove-lisp-from-name (outputs->name outputs) lisp-type)) + (let* ((name (remove-lisp-from-name (outputs->name outputs))) (out (library-output outputs)) (asd-file (and=> asd-file - (cut source-asd-file out lisp-type name <>)))) + (cut source-asd-file out name <>)))) (if tests? - (parameterize ((%lisp (string-append - (assoc-ref inputs lisp-type) "/bin/" lisp-type))) - (test-system name lisp-type asd-file)) + (test-system name asd-file) (format #t "test suite not run~%"))) #t) (define* (create-asd-file #:key outputs inputs - lisp-type asd-file #:allow-other-keys) "Create a system definition file for the built system." (let*-values (((out) (library-output outputs)) ((full-name version) (package-name->name+version (strip-store-file-name out))) - ((name) (remove-lisp-from-name full-name lisp-type)) - ((new-asd-file) (string-append (library-directory out lisp-type) + ((name) (remove-lisp-from-name full-name)) + ((new-asd-file) (string-append (library-directory out) "/" name ".asd"))) (make-asd-file new-asd-file - #:lisp lisp-type #:system name #:version version #:inputs inputs #:system-asd-file asd-file)) #t) -(define* (symlink-asd-files #:key outputs lisp-type #:allow-other-keys) +(define* (symlink-asd-files #:key outputs #:allow-other-keys) "Create an extra reference to the system in a convenient location." (let* ((out (library-output outputs))) (for-each (lambda (asd-file) (receive (new-asd-file asd-file-directory) - (bundle-asd-file out asd-file lisp-type) + (bundle-asd-file out asd-file) (mkdir-p asd-file-directory) (symlink asd-file new-asd-file) ;; Update the source registry for future phases which might want to @@ -204,11 +194,11 @@ valid." (find-files (string-append out %object-prefix) "\\.asd$"))) #t) -(define* (cleanup-files #:key outputs lisp-type +(define* (cleanup-files #:key outputs #:allow-other-keys) "Remove any compiled files which are not a part of the final bundle." (let ((out (library-output outputs))) - (match lisp-type + (match (%lisp-type) ("sbcl" (for-each (lambda (file) @@ -220,7 +210,7 @@ valid." (append (find-files out "\\.fas$") (find-files out "\\.o$"))))) - (with-directory-excursion (library-directory out lisp-type) + (with-directory-excursion (library-directory out) (for-each (lambda (file) (rename-file file @@ -235,9 +225,9 @@ valid." (string<> ".." file))))))) #t) -(define* (strip #:key lisp-type #:allow-other-keys #:rest args) +(define* (strip #:rest args) ;; stripping sbcl binaries removes their entry program and extra systems - (or (string=? lisp-type "sbcl") + (or (string=? (%lisp-type) "sbcl") (apply (assoc-ref gnu:%standard-phases 'strip) args))) (define %standard-phases/source -- cgit v1.2.3