diff mbox

[v2,12/13] gnu: Add cl-slynk.

Message ID 20161003024139.19975-13-ajpatter@uwaterloo.ca
State New
Headers show

Commit Message

Andy Patterson Oct. 3, 2016, 2:41 a.m. UTC
* gnu/packages/lisp.scm (cl-slynk, sbcl-slynk, ecl-slynk): New
  variables.
---
 gnu/packages/lisp.scm | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 283 insertions(+)
diff mbox

Patch

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 3a59c86..05c3101 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -849,3 +849,286 @@  productive, customizable lisp based systems.")
       (inherit base)
       (outputs '("out"))
       (arguments '()))))
+
+(define slynk-change-directory
+  '(lambda _
+     (chdir "slynk")
+     #t))
+
+(define sbcl-slynk-boot0
+  (package
+    (name "sbcl-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 "slynk-" 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/sbcl)
+    (arguments
+     `(#:tests? #f ; No test suite
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'copy-source 'change-directory
+           ,slynk-change-directory)
+         (delete 'cleanup))))
+    (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)
+    (properties `((cl-source-variant . ,(delay cl-slynk))))))
+
+(define-public cl-slynk
+  (let ((base (sbcl-package->cl-source-package sbcl-slynk-boot0)))
+    (package
+      (inherit base)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases/source
+           (add-before 'install 'change-directory
+             ,slynk-change-directory)))))))
+
+(define ecl-slynk-boot0
+  (sbcl-package->ecl-package sbcl-slynk-boot0))
+
+(define sbcl-slynk-arglists
+  (package
+    (inherit sbcl-slynk-boot0)
+    (name "sbcl-slynk-arglists")
+    (inputs `(("sbcl-slynk" ,sbcl-slynk-boot0)))
+    (arguments
+     (substitute-keyword-arguments
+         `(#:compile-dependencies '("slynk")
+           #:modules ((ice-9 match)
+                      ,@%asdf-build-modules)
+           ,@(package-arguments sbcl-slynk-boot0))
+       ((#:phases phases)
+        `(modify-phases %standard-phases
+           (add-before 'copy-source 'change-directory
+             (assoc-ref ,phases 'change-directory))
+           (add-before 'build 'copy-output
+             ;; Copy in slynk's output, so it doesn't have to be re-compiled
+             ;; in each contrib package.
+             (lambda* (#:key outputs inputs lisp #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (slynk (assoc-ref inputs
+                                       (string-append lisp "-slynk"))))
+                 (copy-recursively slynk out)
+                 ;; Hide all asd files providing slynk other than the source
+                 (for-each delete-file
+                           (append (find-files
+                                    (string-append out "/lib/") "\\.asd$")
+                                   (find-files
+                                    (string-append out
+                                                   "/share/common-lisp/"
+                                                   lisp "-bundle-systems/"))))
+                 (unsetenv "XDG_DATA_DIRS")
+                 #t)))
+           (add-after 'copy-output 'delete-bundle
+             ;; Ensure only one system is provided
+             (lambda* (#:key outputs lisp #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (match lisp
+                   ("sbcl"
+                    (delete-file
+                     (string-append out "/lib/" lisp "/slynk--system.fasl")))
+                   ("ecl"
+                    (begin
+                      (delete-file
+                       (string-append out "/lib/" lisp "/slynk.fasb"))
+                      (delete-file
+                       (string-append out "/lib/" lisp "/slynk.a")))))
+                 #t)))))))))
+
+(define ecl-slynk-arglists
+  (sbcl-package->ecl-package sbcl-slynk-arglists))
+
+(define sbcl-slynk-util
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-util")))
+
+(define ecl-slynk-util
+  (sbcl-package->ecl-package sbcl-slynk-util))
+
+(define sbcl-slynk-fuzzy
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-fuzzy")
+    (inputs `(("sbcl-slynk-util" ,sbcl-slynk-util)
+              ,@(package-inputs sbcl-slynk-arglists)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments sbcl-slynk-arglists)
+       ((#:compile-dependencies _)
+        ''("slynk" "slynk-util"))))))
+
+(define ecl-slynk-fuzzy
+  (sbcl-package->ecl-package sbcl-slynk-fuzzy))
+
+(define sbcl-slynk-c-p-c
+  (package
+    (inherit sbcl-slynk-fuzzy)
+    (name "sbcl-slynk-c-p-c")))
+
+(define ecl-slynk-c-p-c
+  (sbcl-package->ecl-package sbcl-slynk-c-p-c))
+
+(define sbcl-slynk-fancy-inspector
+  (package
+    (inherit sbcl-slynk-fuzzy)
+    (name "sbcl-slynk-fancy-inspector")))
+
+(define ecl-slynk-fancy-inspector
+  (sbcl-package->ecl-package sbcl-slynk-fancy-inspector))
+
+(define sbcl-slynk-package-fu
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-package-fu")))
+
+(define ecl-slynk-package-fu
+  (sbcl-package->ecl-package sbcl-slynk-package-fu))
+
+(define sbcl-slynk-mrepl
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-mrepl")))
+
+(define ecl-slynk-mrepl
+  (sbcl-package->ecl-package sbcl-slynk-mrepl))
+
+(define sbcl-slynk-trace-dialog
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-trace-dialog")))
+
+(define ecl-slynk-trace-dialog
+  (sbcl-package->ecl-package sbcl-slynk-trace-dialog))
+
+(define sbcl-slynk-profiler
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-profiler")))
+
+(define ecl-slynk-profiler
+  (sbcl-package->ecl-package sbcl-slynk-profiler))
+
+(define sbcl-slynk-stickers
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-stickers")))
+
+(define ecl-slynk-stickers
+  (sbcl-package->ecl-package sbcl-slynk-stickers))
+
+(define sbcl-slynk-indentation
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-indentation")))
+
+(define ecl-slynk-indentation
+  (sbcl-package->ecl-package sbcl-slynk-indentation))
+
+(define sbcl-slynk-retro
+  (package
+    (inherit sbcl-slynk-arglists)
+    (name "sbcl-slynk-retro")))
+
+(define ecl-slynk-retro
+  (sbcl-package->ecl-package sbcl-slynk-retro))
+
+(define-public sbcl-slynk
+  (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 sbcl-slynk-boot0)
+      (name "sbcl-slynk")
+      (inputs `(("slynk" ,sbcl-slynk-boot0)
+                ("slynk-util" ,sbcl-slynk-util)
+                ("slynk-arglists" ,sbcl-slynk-arglists)
+                ("slynk-c-p-c" ,sbcl-slynk-c-p-c)
+                ("slynk-fuzzy" ,sbcl-slynk-fuzzy)
+                ("slynk-fancy-inspector" ,sbcl-slynk-fancy-inspector)
+                ("slynk-package-fu" ,sbcl-slynk-package-fu)
+                ("slynk-mrepl" ,sbcl-slynk-mrepl)
+                ("slynk-profiler" ,sbcl-slynk-profiler)
+                ("slynk-trace-dialog" ,sbcl-slynk-trace-dialog)
+                ("slynk-stickers" ,sbcl-slynk-stickers)
+                ("slynk-indentation" ,sbcl-slynk-indentation)
+                ("slynk-retro" ,sbcl-slynk-retro)))
+      (outputs '("out" "image"))
+      (arguments
+       (substitute-keyword-arguments
+           `(#:image-dependencies ',dependencies
+             ,@(package-arguments sbcl-slynk-boot0))
+         ((#:phases _)
+          `(modify-phases %standard-phases
+             (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 the asd file for slynk so that it can find
+                   ;; contribs, but doesn't load them. Avoids circular
+                   ;; loading.
+                   (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 'copy-source)
+             (delete 'build)
+             (delete 'check)
+             (delete 'link-dependencies)
+             (delete 'create-symlinks)))))
+      (properties `((ecl-variant . ,(delay ecl-slynk)))))))
+
+(define-public ecl-slynk
+  (package
+    (inherit (sbcl-package->ecl-package sbcl-slynk))
+    (outputs '("out"))))