gnu: guile: Move Readline support to a separate 'guile-readline' package.

This reduces the closure of Guile from 131 MiB to 116 MiB and removes
extra readline/ncurses builds from the bootstrap path.

* gnu/packages/guile.scm (guile-2.0)[inputs]: Remove READLINE.
(make-guile-readline): New procedure.
(guile-readline): New variable.
* gnu/system/shadow.scm (default-skeletons): Adjust '.guile' so that it
gracefully deals with missing (ice-9 readline).
This commit is contained in:
Ludovic Courtès 2017-12-08 17:31:22 +01:00
parent 9e111db453
commit 2ba2c98d8a
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 67 additions and 5 deletions

View file

@ -153,7 +153,6 @@ (define-public guile-2.0
(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
@ -265,6 +264,65 @@ (define-public guile-2.2/fixed
(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."

View file

@ -193,10 +193,14 @@ (define copy-guile-wm
(".zlogin" ,zlogin)
(".Xdefaults" ,xdefaults)
(".guile" ,(plain-file "dot-guile"
(string-append
"(use-modules (ice-9 readline))\n\n"
";; Enable completion at the REPL.\n"
"(activate-readline)\n")))
"(cond ((false-if-exception (resolve-interface '(ice-9 readline)))
=>
(lambda (module)
;; Enable completion and input history at the REPL.
((module-ref module 'activate-readline))))
(else
(display \"Consider installing the 'guile-readline' package for
convenient interactive line editing and input history.\\n\\n\")))\n"))
(".guile-wm" ,guile-wm)
(".gdbinit" ,gdbinit))))