From 74f9c19092e6efeef5068dbf6d024c2554d45f07 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Tue, 18 Oct 2016 09:14:34 +0200
Subject: gnu: Add chez-sockets

* gnu/packages/chez.scm (chez-sockets): New variable.
---
 gnu/packages/chez.scm | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

(limited to 'gnu')

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index bfcf1b0467..3971535434 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -273,3 +273,82 @@ and 32-bit PowerPC architectures.")
       (description "ChezWEB is a system for doing Knuthian style WEB
 programming in Scheme.")
       (license expat))))
+
+(define-public chez-sockets
+  (let ((commit "bce96881c06bd69a6757a6bff139744153924140")
+        (revision "1"))
+    (package
+      (name "chez-sockets")
+      (version (string-append "0.0-" revision "."
+                              (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/arcfide/chez-sock</td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=6d01a7f4c45716e72bab1231c4cb8c07e4e3fbd7'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=6d01a7f4c45716e72bab1231c4cb8c07e4e3fbd7'>tree</a><a href='/guix/commit/?id=6d01a7f4c45716e72bab1231c4cb8c07e4e3fbd7'>commit</a><a href='/guix/diff/?id=6d01a7f4c45716e72bab1231c4cb8c07e4e3fbd7'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='6d01a7f4c45716e72bab1231c4cb8c07e4e3fbd7'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
replace 'build
+             (lambda* (#:key outputs inputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (chez-site (string-append out "/lib/csv"
+                                                ,(package-version chez-scheme)
+                                                "-site/arcfide")))
+                 ;; make sure Chez Scheme can find the shared libraries.
+                 (substitute* "sockets.ss"
+                   (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
+                     all cmd so)
+                    (string-append cmd " \"" chez-site "/" so "\""))
+                   (("sockets-stub\\.[sd][oy].*" all)
+                    (string-append chez-site "/" all)))
+                 ;; to compile chez-sockets, the .so files must be
+                 ;; installed (because of the absolute path we
+                 ;; inserted above).
+                 (for-each (lambda (f d) (install-file f d))
+                           '("socket-ffi-values.so" "sockets-stub.so")
+                           (list chez-site chez-site))
+                 (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
+           (replace 'install
+             (lambda* (#:key outputs inputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (lib (string-append out "/lib/chez-sockets"))
+                      (doc (string-append out "/share/doc/" ,name "-" ,version))
+                      (chez-site (string-append out "/lib/csv"
+                                                ,(package-version chez-scheme)
+                                                "-site/arcfide")))
+                 (for-each (lambda (f d) (install-file f d))
+                           '("sockets.pdf" "sockets.so")
+                           (list doc chez-site))
+                 #t))))))
+      (home-page "https://github.com/arcfide/chez-sockets")
+      (synopsis "Extensible sockets library for Chez Scheme")
+      (description "Chez-sockets is an extensible sockets library for
+Chez Scheme.")
+      (license expat))))
-- 
cgit v1.2.3

