diff options
author | Andy Patterson <ajpatter@uwaterloo.ca> | 2017-04-03 09:01:33 -0400 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2017-05-16 15:18:16 +0200 |
commit | 4209c31b8f5ad65f741be1baaf0747abb96c8a56 (patch) | |
tree | f278b841b86ea4acec7c1875f167ba36a5aafce9 /guix/build | |
parent | b9afcb9ed4547e600b7bc89d0fbf0d8453dc2b3b (diff) | |
download | gnu-guix-4209c31b8f5ad65f741be1baaf0747abb96c8a56.tar gnu-guix-4209c31b8f5ad65f741be1baaf0747abb96c8a56.tar.gz |
build-system/asdf: Retain references to source files for binary outputs.
In support of long-running programs in which the users would like to be able
to jump to the source of a definition of any of the dependencies (itself
included) of the program.
* guix/build/asdf-build-system.scm (library-outputs): Move from here ...
* guix/build/lisp-utils.scm (library-outputs): ... to here.
(build-program): Accept dependency-prefixes argument, to allow the caller to
specify references which should be retained. Default to the library's output.
(build-image): Likewise.
(generate-executable): Likewise.
* gnu/packages/lisp.scm (sbcl-stumpwm+slynk, sbcl-slynk, sbcl-stumpwm): Adjust
accordingly to the new interface.
(sbcl-stumpwm+slynk)[native-inputs]: Move to ...
[inputs]: ... here.
Diffstat (limited to 'guix/build')
-rw-r--r-- | guix/build/asdf-build-system.scm | 4 | ||||
-rw-r--r-- | guix/build/lisp-utils.scm | 44 |
2 files changed, 38 insertions, 10 deletions
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm index fd4d84dfa0..1e0a2f6dea 100644 --- a/guix/build/asdf-build-system.scm +++ b/guix/build/asdf-build-system.scm @@ -71,10 +71,6 @@ to it's binary output." (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'." - (or (assoc-ref outputs "lib") (assoc-ref outputs "out"))) - (define (copy-files-to-output out name) "Copy all files from the current directory to OUT. Create an extra link to any system-defining files in the source to a convenient location. This is diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm index 7d5d41d23c..3b441cf802 100644 --- a/guix/build/lisp-utils.scm +++ b/guix/build/lisp-utils.scm @@ -42,7 +42,8 @@ build-image make-asd-file valid-char-set - normalize-string)) + normalize-string + library-output)) ;;; Commentary: ;;; @@ -67,6 +68,10 @@ (define (%bundle-install-prefix) (string-append %source-install-prefix "/" (%lisp-type) "-bundle-systems")) +(define (library-output outputs) + "If a `lib' output exists, build things there. Otherwise use `out'." + (or (assoc-ref outputs "lib") (assoc-ref outputs "out"))) + ;; See nix/libstore/store-api.cc#checkStoreName. (define valid-char-set (string->char-set @@ -298,16 +303,20 @@ which are not nested." (setenv "CL_SOURCE_REGISTRY" (string-append path ":" (or (getenv "CL_SOURCE_REGISTRY") "")))) -(define* (build-program program #:key +(define* (build-program program outputs #:key + (dependency-prefixes (list (library-output outputs))) (dependencies (list (basename program))) entry-program #:allow-other-keys) "Generate an executable program containing all DEPENDENCIES, and which will execute ENTRY-PROGRAM. The result is placed in PROGRAM. When executed, it will run ENTRY-PROGRAM, a list of Common Lisp expressions in which `arguments' -has been bound to the command-line arguments which were passed." +has been bound to the command-line arguments which were passed. Link in any +asd files from DEPENDENCY-PREFIXES to ensure references to those libraries are +retained." (generate-executable program #:dependencies dependencies + #:dependency-prefixes dependency-prefixes #:entry-program entry-program #:type 'asdf:program-op) (let* ((name (basename program)) @@ -317,13 +326,16 @@ has been bound to the command-line arguments which were passed." name))) #t) -(define* (build-image image #:key +(define* (build-image image outputs #:key + (dependency-prefixes (list (library-output outputs))) (dependencies (list (basename image))) #:allow-other-keys) "Generate an image, possibly standalone, which contains all DEPENDENCIES, -placing the result in IMAGE.image." +placing the result in IMAGE.image. Link in any asd files from +DEPENDENCY-PREFIXES to ensure references to those libraries are retained." (generate-executable image #:dependencies dependencies + #:dependency-prefixes dependency-prefixes #:entry-program '(nil) #:type 'asdf:image-op) (let* ((name (basename image)) @@ -335,12 +347,14 @@ placing the result in IMAGE.image." (define* (generate-executable out-file #:key dependencies + dependency-prefixes entry-program type #:allow-other-keys) "Generate an executable by using asdf operation TYPE, containing whithin the image all DEPENDENCIES, and running ENTRY-PROGRAM in the case of an -executable." +executable. Link in any asd files from DEPENDENCY-PREFIXES to ensure +references to those libraries are retained." (let* ((bin-directory (dirname out-file)) (name (basename out-file))) (mkdir-p bin-directory) @@ -361,5 +375,23 @@ executable." (generate-executable-for-system type name) + (let* ((after-store-prefix-index + (string-index out-file #\/ + (1+ (string-length (%store-directory))))) + (output (string-take out-file after-store-prefix-index)) + (hidden-asd-links (string-append output "/.asd-files"))) + + (mkdir-p hidden-asd-links) + (for-each + (lambda (path) + (for-each + (lambda (asd-file) + (symlink asd-file + (string-append hidden-asd-links + "/" (basename asd-file)))) + (find-files (string-append path (%bundle-install-prefix)) + "\\.asd$"))) + dependency-prefixes)) + (delete-file (string-append bin-directory "/" name "-exec.asd")) (delete-file (string-append bin-directory "/" name "-exec.lisp")))) |