gnu: guile-git: Add "guile3.0-git" variant.
[jackhill/guix/guix.git] / gnu / packages / guile.scm
index daeadca..2063086 100644 (file)
@@ -59,6 +59,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system guile)
+  #:use-module (guix deprecation)
   #:use-module (guix utils)
   #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:prefix srfi-1:))
                       (substitute* "ice-9/popen.scm"
                         (("/bin/sh") (which "sh")))
                       #t)))))
+
+   ;; When cross-compiling, a native version of Guile itself is needed.
+   (native-inputs (if (%current-target-system)
+                      `(("self" ,this-package))
+                      '()))
+
    (inputs `(("gawk" ,gawk)
              ("readline" ,readline)))
 
    (propagated-inputs `(("gmp" ,gmp)
                         ("libltdl" ,libltdl)))
 
-   ;; When cross-compiling, a native version of Guile itself is needed.
-   (self-native-input? #t)
-
    (native-search-paths
     (list (search-path-specification
            (variable "GUILE_LOAD_PATH")
@@ -141,7 +145,12 @@ without requiring the source code to be rewritten.")
              (base32
               "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
    (build-system gnu-build-system)
-   (native-inputs `(("pkgconfig" ,pkg-config)))
+
+   ;; When cross-compiling, a native version of Guile itself is needed.
+   (native-inputs `(,@(if (%current-target-system)
+                          `(("self" ,this-package))
+                          '())
+                    ("pkgconfig" ,pkg-config)))
    (inputs `(("libffi" ,libffi)
              ,@(libiconv-if-needed)
 
@@ -165,8 +174,6 @@ without requiring the source code to be rewritten.")
       ("bdw-gc" ,libgc)
       ("gmp" ,gmp)))
 
-   (self-native-input? #t)
-
    (outputs '("out" "debug"))
 
    (arguments
@@ -207,24 +214,10 @@ without requiring the source code to be rewritten.")
    (home-page "https://www.gnu.org/software/guile/")
    (license license:lgpl3+)))
 
-(define-public guile-2.0.13
-  ;; For testing a "minimal" Guix
-  (hidden-package
-   (package (inherit guile-2.0)
-     (name "guile")
-     (version "2.0.13")
-     (source (origin
-               (method url-fetch)
-               (uri (string-append "mirror://gnu/guile/guile-" version
-                                   ".tar.xz"))
-               (sha256
-                (base32
-                 "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p")))))))
-
 (define-public guile-2.2
   (package (inherit guile-2.0)
     (name "guile")
-    (version "2.2.4")
+    (version "2.2.6")
     (source (origin
               (method url-fetch)
 
@@ -234,8 +227,10 @@ without requiring the source code to be rewritten.")
                                   ".tar.xz"))
               (sha256
                (base32
-                "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))
+                "1269ymxm56j1z1lvq1y42rm961f2n7rinm3k6l00p9k52hrpcddk"))
               (modules '((guix build utils)))
+              (patches (search-patches
+                        "guile-2.2-skip-oom-test.patch"))
 
               ;; Remove the pre-built object files.  Instead, build everything
               ;; from source, at the expense of significantly longer build
@@ -253,36 +248,7 @@ without requiring the source code to be rewritten.")
             (files '("share/guile/site/2.2")))
            (search-path-specification
             (variable "GUILE_LOAD_COMPILED_PATH")
-            (files '("lib/guile/2.2/site-ccache")))))
-
-    (arguments
-     (if (%current-target-system)
-         (substitute-keyword-arguments (package-arguments guile-2.0)
-           ((#:phases phases '%standard-phases)
-            `(modify-phases ,phases
-               (add-after 'unpack 'sacrifice-elisp-support
-                 (lambda _
-                   ;; Cross-compiling language/elisp/boot.el fails, so
-                   ;; sacrifice it.  See
-                   ;; <https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=988aa29238fca862c7e2cb55f15762a69b4c16ce>
-                   ;; for the upstream fix.
-                   (substitute* "module/Makefile.in"
-                     (("language/elisp/boot\\.el")
-                      "\n"))
-                   #t))
-               ,@(if (hurd-target?)
-                     `((add-after 'unpack 'allow-madvise-ENOSYS
-                         (lambda _
-                           ;; Do not warn about ENOSYS on 'madvise'.  This is
-                           ;; what Guile commit
-                           ;; 45e4ace6603e00b297e6542362273041aebe7305 does.
-                           ;; TODO: Remove for Guile >= 2.2.5.
-                           (substitute* "libguile/vm.c"
-                             (("perror \\(\"madvise failed\"\\)")
-                              "if (errno != ENOSYS) perror (\"madvised failed\");"))
-                           #t)))
-                     '()))))
-         (package-arguments guile-2.0)))))
+            (files '("lib/guile/2.2/site-ccache")))))))
 
 (define-public guile-2.2/fixed
   ;; A package of Guile 2.2 that's rarely changed.  It is the one used
@@ -293,32 +259,41 @@ without requiring the source code to be rewritten.")
                   (timeout . 72000)             ;20 hours
                   (max-silent-time . 36000))))) ;10 hours (needed on ARM
                                                 ;  when heavily loaded)
+(define-public guile-2.2.4
+  (package/inherit
+   guile-2.2
+   (version "2.2.4")
+   (source (origin
+             (inherit (package-source guile-2.2))
+             (uri (string-append "mirror://gnu/guile/guile-" version
+                                 ".tar.xz"))
+             (sha256
+              (base32
+               "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
 
 (define-public guile-next
   ;; This is the upcoming Guile 3.0, with JIT support.
-  (let ((commit "6f3357b0df64c4be17e72079864c09a542f1c779")
-        (revision "1"))
-    (package
-      (inherit guile-2.2)
-      (name "guile-next")
-      (version "2.9.1")
-      (source (origin
-                (inherit (package-source guile-2.2))
-                (uri (string-append "https://alpha.gnu.org/gnu/guile/guile-"
-                                    version ".tar.xz"))
-                (sha256
-                 (base32
-                  "0iba93yqn6mvgid0rfsrg4amym36pg9m8cqdplxsy222blrj9gh1"))))
-      (native-search-paths
-       (list (search-path-specification
-              (variable "GUILE_LOAD_PATH")
-              (files '("share/guile/site/3.0")))
-             (search-path-specification
-              (variable "GUILE_LOAD_COMPILED_PATH")
-              (files '("lib/guile/3.0/site-ccache"
-                       "share/guile/site/3.0")))))
-      (properties '((ftp-server . "alpha.gnu.org")
-                    (upstream-name . "guile"))))))
+  (package
+    (inherit guile-2.2)
+    (name "guile-next")
+    (version "2.9.5")
+    (source (origin
+              (inherit (package-source guile-2.2))
+              (uri (string-append "ftp://alpha.gnu.org/gnu/guile/guile-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "1db91mhvphzmiyw6f41ks9haysphygngv400ivgqf23lg22wn5zr"))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUILE_LOAD_PATH")
+            (files '("share/guile/site/3.0")))
+           (search-path-specification
+            (variable "GUILE_LOAD_COMPILED_PATH")
+            (files '("lib/guile/3.0/site-ccache"
+                     "share/guile/site/3.0")))))
+    (properties '((ftp-server . "alpha.gnu.org")
+                  (upstream-name . "guile")))))
 
 (define (make-guile-readline guile)
   (package
@@ -394,6 +369,10 @@ GNU@tie{}Guile.  Use the @code{(ice-9 readline)} module and call its
   (package-input-rewriting `((,guile-2.2 . ,guile-2.0))
                            (guile-variant-package-name "guile2.0")))
 
+(define package-for-guile-3.0
+  (package-input-rewriting `((,guile-2.2 . ,guile-next))
+                           (guile-variant-package-name "guile3.0")))
+
 (define-public guile-for-guile-emacs
   (package (inherit guile-2.2)
     (name "guile-for-guile-emacs")
@@ -435,15 +414,15 @@ GNU@tie{}Guile.  Use the @code{(ice-9 readline)} module and call its
 ;;; Extensions.
 ;;;
 
-(define-public guile-json
+(define-public guile-json-1
   (package
     (name "guile-json")
     (version "1.2.0")
     (home-page "https://github.com/aconchillo/guile-json")
     (source (origin
               (method url-fetch)
-              (uri (string-append "https://download.savannah.nongnu.org/releases/"
-                                  name "/" name "-" version ".tar.gz"))
+              (uri (string-append "mirror://savannah/guile-json/guile-json-"
+                                  version ".tar.gz"))
               (sha256
                (base32
                 "15gnb84d7hpazqhskkf3g9z4r6knw54wfj4ch5270kakz1lp70c9"))))
@@ -466,25 +445,33 @@ specification.  These are the main features:
     ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
     (license license:gpl3+)))
 
-(define-public guile2.2-json
-  (deprecated-package "guile2.2-json" guile-json))
+;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
+;; 'guile-json-3'.  In the future, we may reuse 'guile-json' as an alias for
+;; 'guile-json-3'.
+(define-deprecated guile-json
+  guile-json-1
+  guile-json-1)
+(export guile-json)
 
 (define-public guile2.0-json
-  (package-for-guile-2.0 guile-json))
+  (package-for-guile-2.0 guile-json-1))
 
 (define-public guile-json-3
   ;; This version is incompatible with 1.x; see the 'NEWS' file.
   (package
-    (inherit guile-json)
+    (inherit guile-json-1)
     (name "guile-json")
-    (version "3.1.0")
+    (version "3.2.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append "https://download.savannah.nongnu.org/releases/"
-                                  name "/" name "-" version ".tar.gz"))
+              (uri (string-append "mirror://savannah/guile-json/guile-json-"
+                                  version ".tar.gz"))
               (sha256
                (base32
-                "1yfqscz74i4vxylabd3s9l0wbdp8bg9qxnv1ixdm3b1l7zdx00z3"))))))
+                "14m6b6g2maw0mkvfm4x63rqb54vgbpn1gcqs715ijw4bikfzlqfz"))))))
+
+(define-public guile3.0-json
+  (package-for-guile-3.0 guile-json-3))
 
 ;; There are two guile-gdbm packages, one using the FFI and one with
 ;; direct C bindings, hence the verbose name.
@@ -538,8 +525,8 @@ Guile's foreign function interface.")
 (define-public guile2.0-gdbm-ffi
   (package-for-guile-2.0 guile-gdbm-ffi))
 
-(define-public guile2.2-gdbm-ffi
-  (deprecated-package "guile2.2-gdbm-ffi" guile-gdbm-ffi))
+(define-public guile3.0-gdbm-ffi
+  (package-for-guile-3.0 guile-gdbm-ffi))
 
 (define-public guile-sqlite3
   (package
@@ -574,7 +561,7 @@ Guile's foreign function interface.")
 (define-public guile-bytestructures
   (package
     (name "guile-bytestructures")
-    (version "1.0.5")
+    (version "1.0.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/TaylanUB/scheme-bytestructures"
@@ -582,7 +569,7 @@ Guile's foreign function interface.")
                                   "/bytestructures-" version ".tar.gz"))
               (sha256
                (base32
-                "0ibk7fjwpb450lnrva4bx45sgln3pbyb645az4ansvh1spgani43"))))
+                "07dffrmc6cnw9mmw0pdrqlkbhzzpz0hm8p26z738l2j5i84dypnk"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
@@ -596,11 +583,15 @@ of the C programming language, to be used on bytevectors.  C's type
 system works on raw memory, and Guile works on bytevectors which are
 an abstraction over raw memory.  It's also more powerful than the C
 type system, elevating types to first-class status.")
-    (license license:gpl3+)))
+    (license license:gpl3+)
+    (properties '((upstream-name . "bytestructures")))))
 
 (define-public guile2.0-bytestructures
   (package-for-guile-2.0 guile-bytestructures))
 
+(define-public guile3.0-bytestructures
+  (package-for-guile-3.0 guile-bytestructures))
+
 (define-public guile-git
   (package
     (name "guile-git")
@@ -613,7 +604,21 @@ type system, elevating types to first-class status.")
               (sha256
                (base32
                 "018hmfsh0rjwfvr4h7y10jc6k8a2k9xsirngghy3pjasin4nd2yz"))
-              (file-name (git-file-name name version))))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Allow builds with Guile 3.0.
+                  (substitute* "configure.ac"
+                    (("^GUILE_PKG.*")
+                     "GUILE_PKG([3.0 2.2 2.0])\n"))
+
+                  ;; The 'guile.m4' that's shipped is too old and fails to
+                  ;; recognize Guile 2.9/3.0.  Delete it and pick the one
+                  ;; provided by the Guile we're using.
+                  (delete-file "m4/guile.m4")
+
+                  #t))))
     (build-system gnu-build-system)
     (native-inputs
      `(("autoconf" ,autoconf)
@@ -631,8 +636,19 @@ type system, elevating types to first-class status.")
 manipulate repositories of the Git version control system.")
     (license license:gpl3+)))
 
+(define-public guile3.0-git
+  (package-for-guile-3.0 guile-git))
+
 (define-public guile2.0-git
-  (package-for-guile-2.0 guile-git))
+  (let ((base (package-for-guile-2.0 guile-git)))
+    (package
+      (inherit base)
+      ;; Libgit2's Guile test driver requires (ice-9 textual-ports), which is
+      ;; not in Guile 2.0.  Thus, keep LIBGIT2 as-is here (i.e., built against
+      ;; Guile 2.2).
+      (inputs `(("libgit2" ,libgit2)
+                ,@(srfi-1:alist-delete "libgit2"
+                                       (package-inputs base)))))))
 
 ;;; guile.scm ends here