Subject: Re: bug#32770: Packaging SLIME/SWANK as Common Lisp library

From: Andy Patterson <[email-masked]>
Date: Sat, 29 Sep 2018 15:16:30 -0400

Hey Pierre,

Sorry for taking so long to get back to you.

On Wed, 19 Sep 2018 09:19:46 +0200
Pierre Neidhardt <[email-masked]> wrote:

> On the long road to packaging Next browser (bug #32729), I've hit a
> big obstacle: packaging the SLIME/SWANK dependency.
> 
> We currently have an emacs-slime package, but that cannot be used as a
> Common Lisp dependency.
> 

I've managed to figure out why that is.  With the branch you're using
for the package, the asd file defines the package and variables that
get used - but in guix that asd file gets discarded.  I think the right
way is to have those definitions defined in a separate file, and
actually they are defined in one as well.  The following patch adds
that file to the asd and makes sure it compiles successfully.

I've noticed that the pull request that branch was made for is closed
though - I'll try to see if I can get things building with the other
one that's open and maybe co-ordinate with upstream to get that in.

For now though, maybe this will unblock you.  The patch was made after
rebasing your branch unto master.  I was also able to drop the commit
named "build-system/asdf: Fix normalize-string to support versioned
dependencies", since there's a more general version of it in master
now.

--
Andy

From a7b945bb58f22ac6c0bcee1bee62e40ffa9873a6 Mon Sep 17 00:00:00 2001
From: Andy Patterson <[email-masked]>
Date: Sat, 29 Sep 2018 15:04:40 -0400
Subject: [PATCH] gnu: slime-swank: Make it loadable.

* gnu/packages/lisp.scm (sbcl-slime-swank)[origin]<modules>: Add
(guix build utils).
<snippet>: Patch the asd file to load swank-loader-asdf.
---
 gnu/packages/lisp.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index aa146c9a5..a05d95f60 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -2223,12 +2223,18 @@ writing code that contains string literals that
contain code themselves.") (base32
          ;; "065bc4y6iskazdfwlhgcjlzg9bi2hyjbhmyjw3461506pgkj08vi"
          "0pkmg94wn4ii1zhlrncn44mdc5i6c5v0i9gbldx4dwl2yy7ibz5c"))
+       (modules '((guix build utils)))
        (snippet
         '(begin
            (substitute* "contrib/swank-listener-hooks.lisp"
              ((":compile-toplevel :load-toplevel ") ""))
            (substitute* "contrib/swank-presentations.lisp"
              ((":compile-toplevel :load-toplevel ") ""))
+           (substitute* "swank.asd"
+             ((":file \"packages\".*" all)
+              (string-append all "(:file \"swank-loader-asdf\")\n")))
+           (substitute* "swank-loader-asdf.lisp"
+             ((":common-lisp" all) (string-append all " #:asdf")))
            #t))))
     (build-system asdf-build-system/sbcl)
     (arguments
-- 
2.19.0