Subject: Re: [bug#33920] [PATCH] gnu: Add gauche.

From: Gabriel Hondet <[email-masked]>
Date: Tue, 15 Jan 2019 09:11:10 +0100

* gnu/packages/scheme.scm (gauche): New variable.
---
 gnu/packages/scheme.scm | 82 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 16904dce3..3836f3a3e 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017 Clément Lassieur <[email-masked]>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Adam Massmann <[email-masked]>
+;;; Copyright © 2018 Gabriel Hondet <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1164,3 +1165,84 @@ simple, elegant Scheme dialect.  It is a lisp-1 with lexical scope.
 The core is 12 builtin special forms and 33 builtin functions.")
       (home-page "https://github.com/JeffBezanson/femtolisp")
       (license bsd-3))))
+
+(define-public gauche
+  (package
+    (name "gauche")
+    (version "0.9.7")
+    (home-page "http://practical-scheme.net/gauche/index.html")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/gauche/Gauche/Gauche-"
+             version ".tgz"))
+       (sha256
+        (base32
+         "181nycikma0rwrb1h6mi3kys11f8628pq8g5r3fg5hiz5sabscrd"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   ;; Remove libatomic-ops
+                   (delete-file-recursively "gc/libatomic_ops")
+                   #t))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("libatomic-ops" ,libatomic-ops)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("texinfo" ,texinfo)
+       ("openssl" ,openssl) ; needed for tests
+       ("pkg-config" ,pkg-config))) ; needed to find external libatomic-ops
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-/bin/sh
+           ;; needed only for tests
+           (lambda _
+             (substitute* '("configure"
+                            "test/www.scm"
+                            "ext/tls/test.scm"
+                            "gc/configure"
+                            "lib/gauche/configure.scm"
+                            "lib/gauche/package/util.scm"
+                            "lib/gauche/process.scm")
+               (("/bin/sh") (which "sh")))
+             #t))
+         (add-after 'build 'build-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-directory-excursion "doc"
+                 (for-each
+                  (lambda (target)
+                    (invoke "make" target))
+                  '("info" "html" "htmls"))))
+             #t))
+         (add-before 'check 'patch-normalize-test
+           ;; neutralize sys-normalize-pathname test as it relies on
+           ;; the home directory; (setenv "HOME" xx) isn't enough)
+           (lambda _
+             (substitute* "test/system.scm"
+               (("~/abc") "//abc"))
+             #t))
+         (add-before 'check 'patch-network-tests
+           ;; remove net checks
+           (lambda _
+             (substitute* "ext/Makefile"
+               (("binary net termios") "binary termios"))
+             #t))
+         (add-after 'install 'install-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-directory-excursion "doc"
+                 (invoke "make" "install")))
+             #t)))))
+    (synopsis "Scheme scripting engine")
+    (description "Gauche is a R7RS Scheme scripting engine aiming at being a
+handy tool that helps programmers and system administrators to write small to
+large scripts quickly.  Quick startup, built-in system interface, native
+multilingual support are some of the goals.  Gauche comes with a package
+manager/installer @code{gauche-package} which can download, compile, install
+and list gauche extension packages.  There are currently 58 packages
+available.")
+    (license bsd-3)))
-- 
2.20.1
On Sun 13 Jan 2019 at 21:40 Ludovic Courtès wrote:

> Out of curiosity, do these tests rely on specific host name lookups or
> external services?

Regarding net tests, it seems they only involve localhost.

> As swedebugia noted, Gauche uses libgc and libatomic-ops.  Could you
> try to add these two libraries as inputs and to adjust the package to
> make sure it does not use the bundled copies?

The use of the internal libatomic_ops has been disabled, but on the
other hand, I don't see where libgc is used (is it the full gc thing?),
or at least it seems it can't be disabled via configure scripts.

Gabriel