all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
To: ludo@gnu.org
Cc: 31449@debbugs.gnu.org,
	Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
Subject: [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
Date: Tue, 15 May 2018 11:22:04 +0200	[thread overview]
Message-ID: <20180515092204.22179-1-pierre-antoine.rouby@inria.fr> (raw)
In-Reply-To: <87bmdi8kii.fsf@gnu.org>

* gnu/package/guile.scm (guile-simple-zmq): New variable.
---
 gnu/packages/guile.scm | 91 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2af6f875e..3a0158944 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -66,6 +67,8 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2093,4 +2096,92 @@ It has a nice, simple s-expression based syntax.")
      "Guile-colorized provides you with a colorized REPL for GNU Guile.")
     (license license:gpl3+)))
 
+(define-public guile-simple-zmq
+  (let ((commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")
+        (revision "0"))
+    (package
+      (name "guile-simple-zmq")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-simple-zmq")
+               (commit commit)))
+         (sha256
+          (base32
+           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+      (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))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective "/site-ccache/"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-file "simple-zmq.scm")
+                  (guild (string-append (assoc-ref %build-inputs "guile")
+                                        "/bin/guild"))
+                  (zmq  (assoc-ref %build-inputs "zeromq"))
+                  (deps (list zmq))
+                  (path (string-join
+                         (map (cut string-append <>
+                                   "/lib/")
+                              deps)
+                         ":")))
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (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)
+                           (substitute* dest-file
+                             (("\\(dynamic-link \"libzmq\"\\)")
+                              (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
+                                      (assoc-ref %build-inputs "zeromq"))))
+
+                           ;; Install and compile module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   dest-file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       (list scm-file))
+             #t))))
+      (propagated-inputs
+       `(("guile" ,guile-2.2)
+         ("zeromq" ,zeromq)))
+      (home-page "https://github.com/jerry40/guile-simple-zmq")
+      (synopsis "Guile wrapper over ZeroMQ library")
+      (description
+       "This package provides a Guile programming interface to the ZeroMQ
+messaging library.")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0

  reply	other threads:[~2018-05-15  9:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  9:07 [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Rouby Pierre-Antoine
2018-05-14  9:10 ` [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel Rouby Pierre-Antoine
2018-05-14 13:06   ` Ludovic Courtès
2018-05-15  9:24     ` Rouby Pierre-Antoine
2018-05-15 11:33       ` Rouby Pierre-Antoine
2018-05-17  9:42         ` Ludovic Courtès
2018-05-14  9:10 ` [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path Rouby Pierre-Antoine
2018-05-14 13:07   ` Ludovic Courtès
2018-05-17 11:18   ` bug#31449: " Ludovic Courtès
2018-05-14 12:55 ` [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq Ludovic Courtès
2018-05-15  9:22   ` Rouby Pierre-Antoine [this message]
2018-05-15  9:27     ` 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=20180515092204.22179-1-pierre-antoine.rouby@inria.fr \
    --to=pierre-antoine.rouby@inria.fr \
    --cc=31449@debbugs.gnu.org \
    --cc=ludo@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.