summary refs log tree commit diff
path: root/gnu/packages/guile.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/guile.scm')
-rw-r--r--gnu/packages/guile.scm96
1 files changed, 78 insertions, 18 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2a41a525e8..3acb48a96d 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -156,7 +156,6 @@ without requiring the source code to be rewritten.")
    (build-system gnu-build-system)
    (native-inputs `(("pkgconfig" ,pkg-config)))
    (inputs `(("libffi" ,libffi)
-             ("readline" ,readline)
              ,@(libiconv-if-needed)
 
              ;; We need Bash when cross-compiling because some of the scripts
@@ -224,7 +223,7 @@ without requiring the source code to be rewritten.")
 (define-public guile-2.2
   (package (inherit guile-2.0)
     (name "guile")
-    (version "2.2.2")                      ;TODO: Update to 2.2.3 (see below).
+    (version "2.2.3")
     (source (origin
               (method url-fetch)
 
@@ -234,7 +233,7 @@ without requiring the source code to be rewritten.")
                                   ".tar.xz"))
               (sha256
                (base32
-                "1azm25zcmxif0skxfrp11d2wc89nrzpjaann9yxdw6pvjxhs948w"))
+                "11j01agvnci2cx32wwpqs9078856yxmvs15gcsz7ganpkj2ahlw3"))
               (modules '((guix build utils)))
 
               ;; Remove the pre-built object files.  Instead, build everything
@@ -252,22 +251,24 @@ without requiring the source code to be rewritten.")
            (search-path-specification
             (variable "GUILE_LOAD_COMPILED_PATH")
             (files '("lib/guile/2.2/site-ccache"
-                     "share/guile/site/2.2")))))))
+                     "share/guile/site/2.2")))))
 
-(define-public guile-2.2.3
-  ;; TODO: Make it the new 'guile-2.2' on the next rebuild cycle.
-  (package
-    (inherit guile-2.2)
-    (version "2.2.3")
-    (source (origin (inherit (package-source guile-2.2))
-                    (uri (list (string-append "mirror://gnu/guile/guile-"
-                                              version ".tar.xz")
-                               (string-append
-                                "https://wingolog.org/priv/guile-"
-                                version ".tar.xz")))
-                    (sha256
-                     (base32
-                      "11j01agvnci2cx32wwpqs9078856yxmvs15gcsz7ganpkj2ahlw3"))))))
+    (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)))))
+         (package-arguments guile-2.0)))))
 
 (define-public guile-2.2/fixed
   ;; A package of Guile 2.2 that's rarely changed.  It is the one used
@@ -283,6 +284,65 @@ without requiring the source code to be rewritten.")
 (define-public guile-next
   (deprecated-package "guile-next" guile-2.2))
 
+(define (make-guile-readline guile)
+  (package
+    (name "guile-readline")
+    (version (package-version guile))
+    (source (package-source guile))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:configure-flags '("--disable-silent-rules")
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'chdir
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (invoke "make" "-C" "libguile" "scmconfig.h")
+                      (invoke "make" "-C" "lib")
+                      (chdir "guile-readline")
+
+                      (substitute* "Makefile"
+                        (("../libguile/libguile-[[:graph:]]+\\.la")
+                         ;; Remove dependency on libguile-X.Y.la.
+                         "")
+                        (("^READLINE_LIBS = (.*)$" _ libs)
+                         ;; Link against the provided libguile.
+                         (string-append "READLINE_LIBS = "
+                                        "-lguile-$(GUILE_EFFECTIVE_VERSION) "
+                                        libs "\n"))
+                        (("\\$\\(top_builddir\\)/meta/build-env")
+                         ;; Use the provided Guile, not the one from
+                         ;; $(builddir).
+                         "")
+
+                        ;; Install modules to the 'site' directories.
+                        (("^moddir = .*$")
+                         "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
+                        (("^ccachedir = .*$")
+                         "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
+
+                      ;; Load 'guile-readline.so' from the right place.
+                      (substitute* "ice-9/readline.scm"
+                        (("load-extension \"guile-readline\"")
+                         (format #f "load-extension \
+ (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
+                                 (assoc-ref outputs "out"))))
+                      #t)))))
+    (home-page (package-home-page guile))
+    (native-inputs (package-native-inputs guile))
+    (inputs
+     `(,@(package-inputs guile)                   ;to placate 'configure'
+       ,@(package-propagated-inputs guile)
+       ("guile" ,guile)
+       ("readline" ,readline)))
+    (synopsis "Line editing support for GNU Guile")
+    (description
+     "This module provides line editing support via the Readline library for
+GNU@tie{}Guile.  Use the @code{(ice-9 readline)} module and call its
+@code{activate-readline} procedure to enable it.")
+    (license license:gpl3+)))
+
+(define-public guile-readline
+  (make-guile-readline guile-2.2))
+
 (define (guile-variant-package-name prefix)
   (lambda (name)
     "Return NAME with PREFIX instead of \"guile-\", when applicable."