all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Patterson <ajpatter@uwaterloo.ca>
To: 26346@debbugs.gnu.org
Subject: bug#26346: [PATCH 04/17] build-system/asdf: Make it possible to use "lib" as the build output.
Date: Mon,  3 Apr 2017 09:01:21 -0400	[thread overview]
Message-ID: <20170403130134.18881-4-ajpatter@uwaterloo.ca> (raw)
In-Reply-To: <20170403130134.18881-1-ajpatter@uwaterloo.ca>
In-Reply-To: <20170403003732.1c3b8afb@uwaterloo.ca>

* guix/build/asdf-build-system.scm (library-output): New variable.
(copy-source, build, check, patch-asd-files, symlink-asd-files)
(cleanup-files): Use it.
(copy-files-to-output): Rework to take an output instead of an outputs and
string pair.
(install, copy-source): Use the new method.
---
 guix/build/asdf-build-system.scm | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index c6770c41d..10873e98d 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -78,14 +78,18 @@ to it's binary output."
 (define (source-asd-file output lisp name asd-file)
   (string-append (lisp-source-directory output lisp name) "/" asd-file))
 
-(define (copy-files-to-output outputs output name)
-  "Copy all files from OUTPUT to \"out\".  Create an extra link to any
-system-defining files in the source to a convenient location.  This is done
-before any compiling so that the compiled source locations will be valid."
-  (let* ((out (assoc-ref outputs output))
-         (source (getcwd))
-         (target (source-directory out name))
-         (system-path (string-append out %system-install-prefix)))
+(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
+done before any compiling so that the compiled source locations will be
+valid."
+  (let ((source (getcwd))
+        (target (source-directory out name))
+        (system-path (string-append out %system-install-prefix)))
     (copy-recursively source target)
     (mkdir-p system-path)
     (for-each
@@ -97,14 +101,14 @@ before any compiling so that the compiled source locations will be valid."
 
 (define* (install #:key outputs #:allow-other-keys)
   "Copy and symlink all the source files."
-  (copy-files-to-output outputs "out" (outputs->name outputs)))
+  (copy-files-to-output (assoc-ref outputs "out") (outputs->name outputs)))
 
 (define* (copy-source #:key outputs lisp #:allow-other-keys)
-  "Copy the source to \"out\"."
-  (let* ((out (assoc-ref outputs "out"))
+  "Copy the source to the library output."
+  (let* ((out (library-output outputs))
          (name (remove-lisp-from-name (output-path->package-name out) lisp))
          (install-path (string-append out %source-install-prefix)))
-    (copy-files-to-output outputs "out" name)
+    (copy-files-to-output out name)
     ;; Hide the files from asdf
     (with-directory-excursion install-path
       (rename-file "source" (string-append lisp "-source"))
@@ -114,7 +118,7 @@ before any compiling so that the compiled source locations will be valid."
 (define* (build #:key outputs inputs lisp asd-file
                 #:allow-other-keys)
   "Compile the system."
-  (let* ((out (assoc-ref outputs "out"))
+  (let* ((out (library-output outputs))
          (name (remove-lisp-from-name (output-path->package-name out) lisp))
          (source-path (lisp-source-directory out lisp name))
          (translations (wrap-output-translations
@@ -148,7 +152,7 @@ before any compiling so that the compiled source locations will be valid."
                 #:allow-other-keys)
   "Test the system."
   (let* ((name (remove-lisp-from-name (outputs->name outputs) lisp))
-         (out (assoc-ref outputs "out"))
+         (out (library-output outputs))
          (asd-file (and=> asd-file (cut source-asd-file out lisp name <>))))
     (if tests?
         (parameterize ((%lisp (string-append
@@ -167,7 +171,7 @@ before any compiling so that the compiled source locations will be valid."
 find their dependencies.  Exclude any TEST-ONLY-SYSTEMS which were only
 included to run tests.  Add any SPECIAL-DEPENDENCIES which the LISP
 implementation itself provides."
-  (let* ((out (assoc-ref outputs "out"))
+  (let* ((out (library-output outputs))
          (name (remove-lisp-from-name (output-path->package-name out) lisp))
          (registry (lset-difference
                     (lambda (input system)
@@ -186,7 +190,7 @@ implementation itself provides."
 
 (define* (symlink-asd-files #:key outputs lisp #:allow-other-keys)
   "Create an extra reference to the system in a convenient location."
-  (let* ((out (assoc-ref outputs "out")))
+  (let* ((out (library-output outputs)))
     (for-each
      (lambda (asd-file)
        (substitute* asd-file
@@ -208,7 +212,7 @@ implementation itself provides."
 (define* (cleanup-files #:key outputs lisp
                              #:allow-other-keys)
   "Remove any compiled files which are not a part of the final bundle."
-  (let ((out (assoc-ref outputs "out")))
+  (let ((out (library-output outputs)))
     (match lisp
       ("sbcl"
        (for-each
-- 
2.11.1

  parent reply	other threads:[~2017-04-03 13:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  4:37 bug#26346: [PATCH] asdf-build-system improvements Andy Patterson
2017-04-03 13:01 ` bug#26346: [PATCH 01/17] gnu: cl-slynk: Clarify the description Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 02/17] gnu: cl-slynk: Explain some naming choices Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 03/17] build-system/asdf: Rename %install-prefix to %source-install-prefix Andy Patterson
2017-04-03 13:01   ` Andy Patterson [this message]
2017-04-03 13:01   ` bug#26346: [PATCH 05/17] gnu: cl-stumpwm: Build the library in "lib" and the program in "bin" Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 06/17] build-system/asdf: Use asdf to determine dependencies Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 07/17] build-system/asdf: Don't rename inputs Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 08/17] build-system/asdf: Keep ecl's generated archive files Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 09/17] build-system/asdf: Make #:lisp a package argument Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 10/17] build-system/asdf: Parameterize the lisp type and implementation globally Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 11/17] build-system/asdf: Pass the system name as an argument to the builder Andy Patterson
2017-04-09  3:48     ` bug#26346: [PATCH v2 11/20] " Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 12/17] build-system/asdf: Always pre-load the system's definition file Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 13/17] build-system/asdf: Handle unusually-named systems Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 14/17] gnu: Add cl-unicode Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 15/17] build-system/asdf: Simplify the use of lisp-eval-program Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 16/17] build-system/asdf: Retain references to source files for binary outputs Andy Patterson
2017-05-16  7:02     ` Ricardo Wurmus
2017-04-03 13:01   ` bug#26346: [PATCH 17/17] gnu: sbcl-slynk-boot0: Give the package an appropriate name Andy Patterson
2017-04-09  3:50     ` bug#26346: [PATCH v2 17/20] " Andy Patterson
2017-04-09  3:43 ` bug#26346: [PATCH 18/20] build-system/asdf: Handle tests defined in external systems Andy Patterson
2017-04-09  3:43   ` bug#26346: [PATCH 19/20] build-system/asdf: Handle versioned asdf dependencies Andy Patterson
2017-05-16  8:17     ` Ricardo Wurmus
2017-05-22  2:35       ` Andy Patterson
2017-04-09  3:43   ` bug#26346: [PATCH 20/20] doc: Update the documentation for the asdf build systems Andy Patterson
2017-04-09  3:58 ` bug#26346: [PATCH] asdf-build-system improvements Andy Patterson
2017-05-16 13:19 ` Ricardo Wurmus
2017-05-17 13:11   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170403130134.18881-4-ajpatter@uwaterloo.ca \
    --to=ajpatter@uwaterloo.ca \
    --cc=26346@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.