summary refs log tree commit diff
path: root/gnu/packages/guile.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-05-21 13:22:32 -0400
committerMark H Weaver <mhw@netris.org>2018-05-21 13:22:32 -0400
commit0661758e133c0384d20043d3526b5ebc794e1f04 (patch)
tree46fb6d731fd0e562379ecfffba499deb17847a23 /gnu/packages/guile.scm
parent539bf8f2c071b53834829259bb3fabf0390c5dc6 (diff)
parentc036959b1a61c37c9b7d72e655e1441f2feefb6e (diff)
downloadguix-0661758e133c0384d20043d3526b5ebc794e1f04.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/guile.scm')
-rw-r--r--gnu/packages/guile.scm153
1 files changed, 153 insertions, 0 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 578b4513f8..4fdd404de5 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages maths)
@@ -2214,4 +2215,156 @@ It has a nice, simple s-expression based syntax.")
 messaging library.")
       (license license:gpl3+))))
 
+(define-public jupyter-guile-kernel
+  (let ((commit "a5c5f3ea3215b65e770bcb62f71117b0ec4575ed")
+        (revision "0"))
+    (package
+      (name "jupyter-guile-kernel")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-kernel")
+               (commit commit)))
+         (sha256
+          (base32
+           "0y5jr0f0dyskvsawqbf6n0bpg8jirw4mhqbarf2a6p9lxhqha9s9"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective
+                                             "/site-ccache"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-files '("hmac.scm"
+                               "tools.scm"
+                               "guile-jupyter-kernel.scm"))
+                  (kernel-file "kernel.json")
+                  (guild  (string-append (assoc-ref %build-inputs "guile")
+                                         "/bin/guild"))
+                  (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                  (json   (assoc-ref %build-inputs "guile-json"))
+                  (deps   (list g-szmq json))
+                  (path   (string-join
+                           (map (cut string-append <>
+                                     "/share/guile/site/"
+                                     effective)
+                                deps)
+                           ":"))
+                  (gopath (string-join
+                           (map (cut string-append <>
+                                     "/lib/guile/" effective
+                                     "/site-ccache/")
+                                deps)
+                           ":")))
+
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p kernel-dir)
+             (mkdir-p go-dir)
+
+             ;; Make a writable copy of SOURCE.
+             (copy-recursively source ".")
+
+             ;; Record the absolute file name of the 'openssl' command.
+             (substitute* "hmac.scm"
+               (("openssl")
+                (string-append (assoc-ref %build-inputs "openssl")
+                               "/bin/openssl")))
+
+             ;; Compile .scm files and install.
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (setenv "GUILE_LOAD_PATH" path)
+             (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
+
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+
+                           ;; Install compiled module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       scm-files)
+
+             ;; Install kernel
+             (copy-file kernel-file (string-append kernel-dir "/"
+                                                   kernel-file))
+             ;; Fix hard-coded file name in the kernel
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
+                (string-append module-dir "/guile-jupyter-kernel.scm"))
+               (("\"guile\"")
+                (string-append "\"" (assoc-ref %build-inputs "guile")
+                               "/bin/guile\""))
+               (("-s")
+                (string-append "--no-auto-compile\", \"-s")))
+
+             #t))))
+      (inputs
+       `(("openssl" ,openssl)
+         ("guile" ,guile-2.2)))
+      (propagated-inputs
+       `(("guile-json" ,guile-json)
+         ("guile-simple-zmq" ,guile-simple-zmq)))
+      (synopsis "Guile kernel for the Jupyter Notebook")
+      (description
+       "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It
+allows users to interact with the Guile REPL through Jupyter.")
+      (home-page "https://github.com/jerry40/guile-kernel")
+      (license license:gpl3+))))
+
+(define-public guile-sparql
+  (package
+   (name "guile-sparql")
+   (version "0.0.7")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append
+                  "https://github.com/roelj/guile-sparql/releases/download/"
+                  version "/guile-sparql-" version ".tar.gz"))
+            (sha256
+             (base32 "1drnvhsgl0gc5crmb16yyw1j98nkhwwcgssv9vgm36ng43nnzffd"))))
+   (build-system gnu-build-system)
+   (arguments `(#:tests? #f)) ; There are no tests.
+   (native-inputs
+    `(("pkg-config" ,pkg-config)))
+   (inputs
+    `(("guile" ,guile-2.2)))
+   (home-page "https://github.com/roelj/guile-sparql")
+   (synopsis "SPARQL module for Guile")
+   (description "This package provides the functionality to query a SPARQL
+endpoint.  Additionally, it provides an interface to write SPARQL queries
+using S-expressions.")
+   (license license:gpl3+)))
+
 ;;; guile.scm ends here