[bug#33920] gnu: Add gauche.

Message ID 87muof8pyk.fsf@gmail.com
State Accepted
Headers show
Series [bug#33920] gnu: Add gauche. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Gabriel Hondet Jan. 5, 2019, 8:32 a.m. UTC
* gnu/packages/scheme.scm (gauche): New variable.
---
 gnu/packages/scheme.scm | 73 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

Comments

Ludovic Courtès Jan. 9, 2019, 3:56 p.m. UTC | #1
Hi Gabriel,

Gabriel Hondet <gabrielhondet@gmail.com> skribis:

> * gnu/packages/scheme.scm (gauche): New variable.

Yay for another Scheme!  :-)

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?

> +(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
> +             "http://prdownloads.sourceforge.net/gauche/Gauche-"
> +             version ".tgz"))

Please use mirror://sourceforge here.

> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-/bin/sh
> +           ;; needed only for tests
> +           (lambda _
> +             (begin
> +               (setenv "CONFIG_SHELL" (which "sh"))
> +               (substitute* '("configure"
> +                              "test/www.scm"
> +                              "config.guess"
> +                              "ltmain.sh"
> +                              "ext/tls/test.scm"
> +                              "gc/configure"
> +                              "lib/gauche/configure.scm"
> +                              "lib/gauche/package/util.scm"
> +                              "lib/gauche/process.scm")
> +                 (("/bin/sh") (which "sh")))

This looks redundant with what the standard ‘patch-source-shebangs’ and
‘configure’ phases do, no?

Also, ‘begin’ is unnecessary in the body of a lambda.

> +         (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"))))))

Please return #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"))))

Likewise.

> +         (add-before 'check 'patch-network-tests
> +           ;; remove net checks
> +           (lambda _
> +             (substitute* "ext/Makefile"
> +               (("binary net termios") "binary termios"))))

Likewise.

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

> +         (add-after 'install 'install-docs
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out")))
> +               (with-directory-excursion "doc"
> +                 (invoke "make" "install"))))))))

Please return #t.

Could you send an updated patch?

Thank you!

Ludo’.
Gabriel Hondet Jan. 12, 2019, 10:25 a.m. UTC | #2
Hi Ludovic,

On Wed 09 Jan 2019 at 16:56 Ludovic Courtès wrote:

> 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?

Sure I'll work on it.

>> +(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
>> +             "http://prdownloads.sourceforge.net/gauche/Gauche-"
>> +             version ".tgz"))
>
> Please use mirror://sourceforge here.

As far as I understand, I should use
   "mirror://sourceforge/gauche/Gauche-"
but it does not work (redirections fail with a 404 not found error).

>> +     `(#:phases
>> +       (modify-phases %standard-phases
>> +         (add-after 'unpack 'patch-/bin/sh
>> +           ;; needed only for tests
>> +           (lambda _
>> +             (begin
>> +               (setenv "CONFIG_SHELL" (which "sh"))
>> +               (substitute* '("configure"
>> +                              "test/www.scm"
>> +                              "config.guess"
>> +                              "ltmain.sh"
>> +                              "ext/tls/test.scm"
>> +                              "gc/configure"
>> +                              "lib/gauche/configure.scm"
>> +                              "lib/gauche/package/util.scm"
>> +                              "lib/gauche/process.scm")
>> +                 (("/bin/sh") (which "sh")))
>
> This looks redundant with what the standard ‘patch-source-shebangs’ and
> ‘configure’ phases do, no?

Isn't 'patch-source-shebangs' only patching the shebangs?  Because here
I have to patch other path specifications in the source as well.  On the
other hand, for the 'setenv', you are totally right.

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

I'll look at it.

Thank you for these useful and essential tips,
Gabriel
Ludovic Courtès Jan. 13, 2019, 8:40 p.m. UTC | #3
Hello,

Gabriel Hondet <gabrielhondet@gmail.com> skribis:

> On Wed 09 Jan 2019 at 16:56 Ludovic Courtès wrote:

[...]

>> Please use mirror://sourceforge here.
>
> As far as I understand, I should use
>    "mirror://sourceforge/gauche/Gauche-"
> but it does not work (redirections fail with a 404 not found error).

This one appears to work:

  mirror://sourceforge/gauche/Gauche/Gauche-0.9.7.tgz

Trial and error…

>>> +               (substitute* '("configure"
>>> +                              "test/www.scm"
>>> +                              "config.guess"
>>> +                              "ltmain.sh"
>>> +                              "ext/tls/test.scm"
>>> +                              "gc/configure"
>>> +                              "lib/gauche/configure.scm"
>>> +                              "lib/gauche/package/util.scm"
>>> +                              "lib/gauche/process.scm")
>>> +                 (("/bin/sh") (which "sh")))
>>
>> This looks redundant with what the standard ‘patch-source-shebangs’ and
>> ‘configure’ phases do, no?
>
> Isn't 'patch-source-shebangs' only patching the shebangs?  Because here
> I have to patch other path specifications in the source as well.  On the
> other hand, for the 'setenv', you are totally right.

Oh you’re right.  But at least the Autotools files (configure,
config.guess, ltmain.sh) can be omitted.

Thanks,
Ludo’.

Patch

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 16904dce3..09a7fbf29 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -10,6 +10,7 @@ 
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
+;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1164,3 +1165,75 @@  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
+             "http://prdownloads.sourceforge.net/gauche/Gauche-"
+             version ".tgz"))
+       (sha256
+        (base32
+         "181nycikma0rwrb1h6mi3kys11f8628pq8g5r3fg5hiz5sabscrd"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("texinfo" ,texinfo)
+       ("openssl" ,openssl))) ;needed for tests
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-/bin/sh
+           ;; needed only for tests
+           (lambda _
+             (begin
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (substitute* '("configure"
+                              "test/www.scm"
+                              "config.guess"
+                              "ltmain.sh"
+                              "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"))))))
+         (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"))))
+         (add-before 'check 'patch-network-tests
+           ;; remove net checks
+           (lambda _
+             (substitute* "ext/Makefile"
+               (("binary net termios") "binary termios"))))
+         (add-after 'install 'install-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-directory-excursion "doc"
+                 (invoke "make" "install"))))))))
+    (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 (list gpl2+ ; gc/libatomic_ops/*
+                   bsd-3))))