From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI9Tg-0007dd-PX for guix-patches@gnu.org; Mon, 14 May 2018 05:09:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fI9Ta-0003z3-ML for guix-patches@gnu.org; Mon, 14 May 2018 05:09:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fI9Ta-0003yt-I0 for guix-patches@gnu.org; Mon, 14 May 2018 05:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fI9Ta-0002Bq-DM for guix-patches@gnu.org; Mon, 14 May 2018 05:09:02 -0400 Subject: [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI9T3-0007Vk-8M for guix-patches@gnu.org; Mon, 14 May 2018 05:08:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fI9Sz-0003mo-Vb for guix-patches@gnu.org; Mon, 14 May 2018 05:08:29 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:43643) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fI9Sz-0003lk-JL for guix-patches@gnu.org; Mon, 14 May 2018 05:08:25 -0400 From: Rouby Pierre-Antoine Date: Mon, 14 May 2018 11:07:51 +0200 Message-Id: <20180514090751.1021-1-pierre-antoine.rouby@inria.fr> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31449@debbugs.gnu.org Cc: Rouby Pierre-Antoine * gnu/package/guile.scm (guile-simple-zmq): New variable. --- gnu/packages/guile.scm | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 2af6f875e..9df59ba1d 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -66,6 +66,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 +2095,89 @@ 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 + (package + (name "guile-simple-zmq") + (version "0.0.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/jerry40/guile-simple-zmq") + (commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c"))) + (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 is Guile wrapper over ZeroMQ library.") + (license license:gpl3+))) + ;;; guile.scm ends here -- 2.17.0