From 2282ec3a04ccc037af57dbf4099999ffeeac6d06 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 12 Jul 2012 16:53:18 +0200 Subject: distro: Add GNU Readline. * distro/base.scm (readline): New variable. (guile-1.8, guile-2.0): Use it. * distro/readline-link-ncurses.patch: New file. * Makefile.am (nobase_dist_guilemodule_DATA): Add it. --- Makefile.am | 3 ++- distro/base.scm | 38 ++++++++++++++++++++++++++++++++++++-- distro/readline-link-ncurses.patch | 18 ++++++++++++++++++ 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 distro/readline-link-ncurses.patch diff --git a/Makefile.am b/Makefile.am index c9653505e7..e1754a777b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,8 @@ nobase_dist_guilemodule_DATA = \ $(MODULES) \ distro/guile-1.8-cpp-4.5.patch \ distro/m4-readlink-EINVAL.patch \ - distro/m4-s_isdir.patch + distro/m4-s_isdir.patch \ + distro/readline-link-ncurses.patch nobase_nodist_guilemodule_DATA = $(GOBJECTS) diff --git a/distro/base.scm b/distro/base.scm index 935f313da3..c3abce1914 100644 --- a/distro/base.scm +++ b/distro/base.scm @@ -198,6 +198,40 @@ faster algorithms.") (license "LGPLv3+") (home-page "http://gmplib.org/"))) +(define-public readline + (package + (name "readline") + (version "6.2") + (source (origin + (method http-fetch) + (uri (string-append "http://ftp.gnu.org/gnu/readline/readline-" + version ".tar.gz")) + (sha256 + (base32 + "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr")))) + (build-system gnu-build-system) + (propagated-inputs `(("ncurses" ,(nixpkgs-derivation* "ncurses")))) + (inputs `(("patch/link-ncurses" + ,(search-path %load-path + "distro/readline-link-ncurses.patch")))) + (arguments `(#:patches (list (assoc-ref %build-inputs + "patch/link-ncurses")) + #:patch-flags '("-p0"))) + (description "GNU Readline, a library for interactive line editing") + (long-description + "The GNU Readline library provides a set of functions for use by +applications that allow users to edit command lines as they are typed in. +Both Emacs and vi editing modes are available. The Readline library includes +additional functions to maintain a list of previously-entered command lines, +to recall and perhaps reedit those lines, and perform csh-like history +expansion on previous commands. + +The history facilites are also placed into a separate library, the History +library, as part of the build process. The History library may be used +without Readline in applications which desire its capabilities.") + (license "GPLv3+") + (home-page "http://savannah.gnu.org/projects/readline/"))) + (define-public libtool (package (name "libtool") @@ -290,7 +324,7 @@ internal in-memory representation.") (inputs `(("patch/snarf" ,(search-path %load-path "distro/guile-1.8-cpp-4.5.patch")) ("gawk" ,gawk) - ("readline" ,(nixpkgs-derivation* "readline")))) + ("readline" ,readline))) ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be ;; propagated. @@ -323,7 +357,7 @@ extensible. It supports many SRFIs.") (native-inputs `(("xz" ,(nixpkgs-derivation* "xz")) ("pkgconfig" ,(nixpkgs-derivation* "pkgconfig")))) (inputs `(("libffi" ,(nixpkgs-derivation* "libffi")) - ("readline" ,(nixpkgs-derivation* "readline")))) + ("readline" ,readline))) (propagated-inputs `( ;; These ones aren't normally needed here, but since `libguile-2.0.la' diff --git a/distro/readline-link-ncurses.patch b/distro/readline-link-ncurses.patch new file mode 100644 index 0000000000..0fd0598f46 --- /dev/null +++ b/distro/readline-link-ncurses.patch @@ -0,0 +1,18 @@ +This patch is to make sure that `libncurses' is among the `NEEDED' +dependencies of `libreadline.so' and `libhistory.so'. + +Failing to do that, applications linking against Readline are +forced to explicitly link against libncurses as well; in addition, +this trick doesn't work when using GNU ld's `--as-needed'. + +--- shlib/Makefile.in 2009-01-06 18:03:22.000000000 +0100 ++++ shlib/Makefile.in 2009-07-27 14:43:25.000000000 +0200 +@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ + SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@ + SHOBJ_LIBS = @SHOBJ_LIBS@ + +-SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ ++SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses + SHLIB_LIBS = @SHLIB_LIBS@ + + SHLIB_DOT = @SHLIB_DOT@ -- cgit v1.2.3