build-system/asdf: Add support for component-less systems.

* guix/build/lisp-utils.scm (make-asd-file): Ensure lib directory exists and
check if prebuilt bundle system was generated.
(generate-system-definition): Add :class and :components only if prebuilt
system was generated.
This commit is contained in:
Pierre Neidhardt 2020-06-18 16:41:08 +02:00
parent 04dd80181f
commit 5a08660ecb
No known key found for this signature in database
GPG key ID: 9BDCF497A4BBCC7F

View file

@ -186,13 +186,17 @@ (define (compiled-system system)
(_ system))))
(define* (generate-system-definition system
#:key version dependencies)
#:key version dependencies component?)
`(asdf:defsystem
,(normalize-string system)
:class asdf/bundle:prebuilt-system
,@(if component?
'(:class asdf/bundle:prebuilt-system)
'())
:version ,version
:depends-on ,dependencies
:components ((:compiled-file ,(compiled-system system)))
,@(if component?
`(:components ((:compiled-file ,(compiled-system system))))
'())
,@(if (string=? "ecl" (%lisp-type))
`(:lib ,(string-append system ".a"))
'())))
@ -311,14 +315,20 @@ (define registry
lisp-input-map)
(map dependency-name dependencies)))
;; Ensure directory exists, which might not be the case for an .asd without components.
(mkdir-p (dirname asd-file))
(call-with-output-file asd-file
(lambda (port)
(display
(replace-escaped-macros
(format #f "~y~%~y~%"
(generate-system-definition system
#:version version
#:dependencies dependencies)
(generate-system-definition
system
#:version version
#:dependencies dependencies
;; Some .asd don't have components, and thus they don't generate any .fasl.
#:component? (pair?
(find-files (dirname asd-file) "--system\\.fasl$")))
(generate-dependency-links registry system)))
port))))