Patchwork [10/12] gnu: Add slynk.

login
register
mail settings
Submitter Andy Patterson
Date Sept. 27, 2016, 4:15 a.m.
Message ID <20160927041532.27097-11-ajpatter@uwaterloo.ca>
Download mbox | patch
Permalink /patch/16043/
State New
Headers show

Comments

Andy Patterson - Sept. 27, 2016, 4:15 a.m.
* gnu/packages/lisp.scm (slynk, slynk-sbcl, slynk-ecl): New variables.
---
 gnu/packages/lisp.scm | 333 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 333 insertions(+)
Ludovic Courtès - Oct. 8, 2016, 12:59 p.m.
Andy Patterson <ajpatter@uwaterloo.ca> skribis:

> * gnu/packages/lisp.scm (slynk, slynk-sbcl, slynk-ecl): New variables.

[...]

> +    (synopsis "Common Lisp IDE for Emacs")
> +    (description "SLY is a fork of SLIME.  It also featrues a completely

To make it more standalone, maybe something like: “SLY is a fork of
SLIME, the foobar IDEish mode for Emacs.”

Typo: “features”.

> +redesigned REPL based on Emacs's own full-featured comint.el, live code

@file{comint.el}

> +(define slynk-sbcl-boot0
> +  (package
> +    (inherit slynk)
> +    (name "slynk-sbcl")

It’s best to include “-boot0” in ‘name’ too.

However, could you add a comment as to what this “boot” package does,
and what the general idea is?

> +(define slynk-mrepl-sbcl
> +  (package
> +    (inherit slynk-arglists-sbcl)
> +    (name "slynk-mrepl-sbcl")))
> +
> +(define slynk-mrepl-ecl
> +  (package
> +    (inherit slynk-arglists-ecl)
> +    (name "slynk-mrepl-ecl")))
> +
> +(define slynk-trace-dialog-sbcl
> +  (package
> +    (inherit slynk-arglists-sbcl)
> +    (name "slynk-trace-dialog-sbcl")))
> +
> +(define slynk-trace-dialog-ecl
> +  (package
> +    (inherit slynk-arglists-ecl)
> +    (name "slynk-trace-dialog-ecl")))
> +
> +(define slynk-profiler-sbcl
> +  (package
> +    (inherit slynk-arglists-sbcl)
> +    (name "slynk-profiler-sbcl")))

I don’t follow what’s going on here.  These are all the same packages as
“arglists” but with a different name?  What for?

> +                   (patch-asd-file
> +                    asd-file
> +                    (map
> +                     (lambda (dependency)
> +                       `(,dependency
> +                         . ,(string-append
> +                             (assoc-ref inputs dependency))))

Simply: (cons dependency (assoc-ref …)), more readable than the dot
notation here.

Thanks,
Ludo’.

Patch

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 1c78875..21ca073 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -918,3 +918,336 @@  Type=Application
               ("clx-ecl" ,clx-ecl)))
     (propagated-inputs '())
     (outputs '("out"))))
+
+(define-public slynk
+  (package
+    (name "slynk")
+    (version "1.0.0-beta")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/capitaomorte/sly/archive/"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "0mc3w6afgx97y2bh3pjv29dndidm016adpd11zn86kp7zq6xf8sv"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Move the contribs into the main source directory for easier
+           ;; access
+           (substitute* "slynk/slynk.asd"
+             (("\\.\\./contrib")
+              "contrib"))
+           (substitute* "contrib/slynk-trace-dialog.lisp"
+             (("\\(slynk::reset-inspector\\)") ; Causes problems on load
+              "nil"))
+           (mkdir-p "slynk/contrib")
+           (copy-recursively "contrib" "slynk/contrib")))))
+    (build-system asdf-build-system/source)
+    (synopsis "Common Lisp IDE for Emacs")
+    (description "SLY is a fork of SLIME.  It also featrues a completely
+redesigned REPL based on Emacs's own full-featured comint.el, live code
+annotations, and a consistent interactive button interface.  Everything can be
+copied to the REPL.  One can create multiple inspectors with independent
+history.")
+    (home-page "https://github.com/capitaomorte/sly")
+    (license license:public-domain)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases/source
+         (add-before 'install 'change-directory
+           (lambda _
+             (chdir "slynk")
+             #t)))))))
+
+(define slynk-sbcl-boot0
+  (package
+    (inherit slynk)
+    (name "slynk-sbcl")
+    (build-system asdf-build-system/sbcl)
+    (inputs `(("slynk" ,slynk)))
+    (arguments
+     '(#:tests? #f ; no test suite
+       #:phases
+       (modify-phases %standard-phases/sbcl
+         (delete 'cleanup))))))
+
+(define slynk-ecl-boot0
+  (package
+    (inherit slynk-sbcl-boot0)
+    (name "slynk-ecl")
+    (build-system asdf-build-system/ecl)
+    (arguments
+     (substitute-keyword-arguments (package-arguments slynk-sbcl-boot0)
+       ((#:phases _)
+        '(modify-phases %standard-phases/ecl
+           (delete 'cleanup)))))))
+
+(define slynk-arglists-sbcl
+  (package
+    (inherit slynk-sbcl-boot0)
+    (name "slynk-arglists-sbcl")
+    (inputs `(("slynk-sbcl" ,slynk-sbcl-boot0)
+              ,@(package-inputs slynk-sbcl-boot0)))
+    (arguments
+     (substitute-keyword-arguments
+         `(#:compile-dependencies '("slynk")
+           #:source-input "slynk"
+           ,@(package-arguments slynk-sbcl-boot0))
+       ((#:phases _)
+        '(modify-phases %standard-phases/sbcl
+           (add-before 'build 'copy-output
+             (lambda* (#:key outputs inputs lisp #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (slynk (assoc-ref inputs
+                                       (string-append "slynk-" lisp))))
+                 (copy-recursively slynk out)
+                 (for-each delete-file
+                           (find-files out "\\.asd$")))))
+           (add-after 'copy-output 'delete-bundle
+             (lambda* (#:key outputs lisp #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (delete-file
+                  (string-append out "/lib/" lisp "/slynk--system.fasl")))))))))))
+
+(define slynk-arglists-ecl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-arglists-ecl")
+    (inputs `(("slynk-ecl" ,slynk-ecl-boot0)
+              ,@(package-inputs slynk-ecl-boot0)))
+    (build-system asdf-build-system/ecl)
+    (arguments
+     (substitute-keyword-arguments (package-arguments slynk-arglists-sbcl)
+       ((#:phases phases)
+        `(modify-phases %standard-phases/ecl
+           (add-before 'build 'copy-output
+             (assoc-ref ,phases 'copy-output))
+           (add-after 'copy-output 'delete-bundle
+             (lambda* (#:key outputs inputs lisp #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (delete-file
+                  (string-append out "/lib/" lisp "/slynk.fasb"))
+                 (delete-file
+                  (string-append out "/lib/" lisp "/slynk.a")))))))))))
+
+(define slynk-util-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-util-sbcl")))
+
+(define slynk-util-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-util-ecl")))
+
+(define slynk-fuzzy-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-fuzzy-sbcl")
+    (inputs `(("slynk-util-sbcl" ,slynk-util-sbcl)
+              ,@(package-inputs slynk-arglists-sbcl)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments slynk-arglists-sbcl)
+       ((#:compile-dependencies _)
+        ''("slynk" "slynk-util"))))))
+
+(define slynk-fuzzy-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-fuzzy-ecl")
+    (inputs `(("slynk-util-ecl" ,slynk-util-ecl)
+              ,@(package-inputs slynk-arglists-ecl)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments slynk-arglists-ecl)
+       ((#:compile-dependencies _)
+        ''("slynk" "slynk-util"))))))
+
+(define slynk-c-p-c-sbcl
+  (package
+    (inherit slynk-fuzzy-sbcl)
+    (name "slynk-c-p-c-sbcl")))
+
+(define slynk-c-p-c-ecl
+  (package
+    (inherit slynk-fuzzy-ecl)
+    (name "slynk-c-p-c-ecl")))
+
+(define slynk-fancy-inspector-sbcl
+  (package
+    (inherit slynk-fuzzy-sbcl)
+    (name "slynk-fancy-inspector-sbcl")))
+
+(define slynk-fancy-inspector-ecl
+  (package
+    (inherit slynk-fuzzy-ecl)
+    (name "slynk-fancy-inspector-ecl")))
+
+(define slynk-package-fu-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-package-fu-sbcl")))
+
+(define slynk-package-fu-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-package-fu-ecl")))
+
+(define slynk-mrepl-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-mrepl-sbcl")))
+
+(define slynk-mrepl-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-mrepl-ecl")))
+
+(define slynk-trace-dialog-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-trace-dialog-sbcl")))
+
+(define slynk-trace-dialog-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-trace-dialog-ecl")))
+
+(define slynk-profiler-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-profiler-sbcl")))
+
+(define slynk-profiler-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-profiler-ecl")))
+
+(define slynk-stickers-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-stickers-sbcl")))
+
+(define slynk-stickers-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-stickers-ecl")))
+
+(define slynk-indentation-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-indentation-sbcl")))
+
+(define slynk-indentation-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-indentation-ecl")))
+
+(define slynk-retro-sbcl
+  (package
+    (inherit slynk-arglists-sbcl)
+    (name "slynk-retro-sbcl")))
+
+(define slynk-retro-ecl
+  (package
+    (inherit slynk-arglists-ecl)
+    (name "slynk-retro-ecl")))
+
+(define-public slynk-sbcl
+  (let ((dependencies
+         '("slynk-util"
+           "slynk-arglists"
+           "slynk-c-p-c"
+           "slynk-fuzzy"
+           "slynk-fancy-inspector"
+           "slynk-package-fu"
+           "slynk-mrepl"
+           "slynk-profiler"
+           "slynk-trace-dialog"
+           "slynk-stickers"
+           "slynk-indentation"
+           "slynk-retro")))
+    (package
+      (inherit slynk-sbcl-boot0)
+      (name "slynk-sbcl")
+      (inputs `(("slynk" ,slynk-sbcl-boot0)
+                ("slynk-util" ,slynk-util-sbcl)
+                ("slynk-arglists" ,slynk-arglists-sbcl)
+                ("slynk-c-p-c" ,slynk-c-p-c-sbcl)
+                ("slynk-fuzzy" ,slynk-fuzzy-sbcl)
+                ("slynk-fancy-inspector" ,slynk-fancy-inspector-sbcl)
+                ("slynk-package-fu" ,slynk-package-fu-sbcl)
+                ("slynk-mrepl" ,slynk-mrepl-sbcl)
+                ("slynk-profiler" ,slynk-profiler-sbcl)
+                ("slynk-trace-dialog" ,slynk-trace-dialog-sbcl)
+                ("slynk-stickers" ,slynk-stickers-sbcl)
+                ("slynk-indentation" ,slynk-indentation-sbcl)
+                ("slynk-retro" ,slynk-retro-sbcl)))
+      (outputs '("out" "image"))
+      (arguments
+       (substitute-keyword-arguments
+           `(#:image-dependencies ',dependencies
+             ,@(package-arguments slynk-sbcl-boot0))
+         ((#:phases _)
+          `(modify-phases %standard-phases/sbcl
+             (add-before 'build 'copy-slynk
+               (lambda* (#:key outputs inputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "out"))
+                       (slynk (assoc-ref inputs "slynk")))
+                   (copy-recursively slynk out))))
+             (add-after 'generate-image 'link-contribs
+               (lambda* (#:key outputs inputs lisp #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (asd-file (string-append out "/lib/" lisp "/slynk.asd"))
+                        (link-file (string-append
+                                    out "/share/common-lisp/" lisp
+                                    "-bundle-systems/slynk.asd")))
+                   (patch-asd-file
+                    asd-file
+                    (map
+                     (lambda (dependency)
+                       `(,dependency
+                         . ,(string-append
+                             (assoc-ref inputs dependency))))
+                     ',dependencies)
+                    lisp
+                    '())
+                   (delete-file link-file)
+                   (symlink asd-file link-file))))
+             (delete 'build)
+             (delete 'check)
+             (delete 'link-dependencies)
+             (delete 'create-symlinks))))))))
+
+(define-public slynk-ecl
+  (package
+    (inherit slynk-sbcl)
+    (name "slynk-ecl")
+    (inputs `(("slynk" ,slynk-ecl-boot0)
+              ("slynk-util" ,slynk-util-ecl)
+              ("slynk-arglists" ,slynk-arglists-ecl)
+              ("slynk-c-p-c" ,slynk-c-p-c-ecl)
+              ("slynk-fuzzy" ,slynk-fuzzy-ecl)
+              ("slynk-fancy-inspector" ,slynk-fancy-inspector-ecl)
+              ("slynk-package-fu" ,slynk-package-fu-ecl)
+              ("slynk-mrepl" ,slynk-mrepl-ecl)
+              ("slynk-profiler" ,slynk-profiler-ecl)
+              ("slynk-trace-dialog" ,slynk-trace-dialog-ecl)
+              ("slynk-stickers" ,slynk-stickers-ecl)
+              ("slynk-indentation" ,slynk-indentation-ecl)
+              ("slynk-retro" ,slynk-retro-ecl)))
+    (outputs '("out"))
+    (build-system asdf-build-system/ecl)
+    (arguments
+     (substitute-keyword-arguments (package-arguments slynk-sbcl)
+       ((#:phases phases)
+        `(modify-phases %standard-phases/ecl
+           (add-before 'build 'copy-slynk
+             (assoc-ref ,phases 'copy-slynk))
+           (add-after 'generate-image 'link-contribs
+             (assoc-ref ,phases 'link-contribs))
+           (delete 'build)
+           (delete 'check)
+           (delete 'link-dependencies)
+           (delete 'create-symlinks)))))))