| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu packages readline)
|
| 24 | #:use-module (guix licenses)
|
| 25 | #:use-module (gnu packages)
|
| 26 | #:use-module (gnu packages autotools)
|
| 27 | #:use-module (gnu packages ncurses)
|
| 28 | #:use-module (gnu packages perl)
|
| 29 | #:use-module (gnu packages terminals)
|
| 30 | #:use-module (guix packages)
|
| 31 | #:use-module (guix gexp)
|
| 32 | #:use-module (guix download)
|
| 33 | #:use-module (guix git-download)
|
| 34 | #:use-module (guix build-system gnu)
|
| 35 | #:use-module (guix utils)
|
| 36 | #:use-module (ice-9 format))
|
| 37 |
|
| 38 | (define (patch-url version seqno)
|
| 39 | (format #f "mirror://gnu/readline/readline-~a-patches/readline~a-~3,'0d"
|
| 40 | version (string-join (string-split version #\.) "") seqno))
|
| 41 |
|
| 42 | (define (readline-patch version seqno sha256-bv)
|
| 43 | "Return the origin of Readline patch SEQNO, with expected hash SHA256-BV"
|
| 44 | (origin
|
| 45 | (method url-fetch)
|
| 46 | (uri (patch-url version seqno))
|
| 47 | (sha256 sha256-bv)))
|
| 48 |
|
| 49 | (define-syntax-rule (patch-series version (seqno hash) ...)
|
| 50 | (list (readline-patch version seqno (base32 hash))
|
| 51 | ...))
|
| 52 |
|
| 53 | (define %patch-series-8.2
|
| 54 | (patch-series
|
| 55 | "8.2"
|
| 56 | (1 "1xxgfgr6hn3ads8m8xsrdi1kbx1f3s69k0danpd9x4haqhg7zydv")
|
| 57 | (2 "0ly0siy6qy3l7hv12847adpfa34yq1w4qz9qkw6vrxv25j106rg0")
|
| 58 | (3 "1c5cwvvkx9mfmpaapymq9cavmzh4fnagkjlchsqx4vml8sx8gx94")
|
| 59 | (4 "1b15sndx9v5vj3x1f3h73099nlagknx4rbfpd5ldrbw2xgm2wmvr")
|
| 60 | (5 "16ac25jz1a1mgkpfp1sydqf6qpsfh0s0dcmrnjpqbhg5va3s6av2")
|
| 61 | (6 "18gmh6y3klh0vv28cyqz4is3rlb32pl7f1kf5r482kfjq3w5zd67")
|
| 62 | (7 "1xmnpahs983n4w0gn3j0wr8nh1dpva33yj7fvfmhm46ph2wsa4ar")
|
| 63 | (8 "0smjjzhwxi2ibpdisnk53lh1pzgka6rhlqyh3662xy69v34ysxx1")
|
| 64 | (9 "05m1fwbs7mbs3pz3pg87gbbayandrrcgaqawzliqb6g1jbk8b61x")
|
| 65 | (10 "0k3vyrjs2g6y2cfs03l2gp37fhxgqpiwvxb1c7z4q88cbb32x3km")
|
| 66 | (11 "1msdahvz56l9m5m69a87zp2c7qrfv0dxwd09rj1697isgy83s0g0")
|
| 67 | (12 "1lybzig73pqpcbw79im0kn6299lkcbnh24yigygn5jm2sj7dz2kc")
|
| 68 | (13 "1a48lyrhvn6nbj5qhradfpbbs3md5maz7wb32yvaghvfgnak990y")))
|
| 69 |
|
| 70 | (define %patch-series-7.0
|
| 71 | (patch-series
|
| 72 | "7.0"
|
| 73 | (1 "0xm3sxvwmss7ddyfb11n6pgcqd1aglnpy15g143vzcf75snb7hcs")
|
| 74 | (2 "0n1dxmqsbjgrfxb1hgk5c6lsraw4ncbnzxlsx7m35nym6lncjiw7")
|
| 75 | (3 "1027kmymniizcy0zbdlrczxfx3clxcdln5yq05q9yzlc6y9slhwy")
|
| 76 | (4 "0r3bbaf12iz8m02z6p3fzww2m365fhn71xmzab2p62gj54s6h9gr")
|
| 77 | (5 "0lxpa4f72y2nsgj6fgrhjk2nmmxvccys6aciwfxwchb5f21rq5fa")))
|
| 78 |
|
| 79 | (define-public readline
|
| 80 | (package
|
| 81 | (name "readline")
|
| 82 | (version (string-append "8.2."
|
| 83 | (number->string (length %patch-series-8.2))))
|
| 84 | (source (origin
|
| 85 | (method url-fetch)
|
| 86 | (uri (string-append "mirror://gnu/readline/readline-"
|
| 87 | (version-major+minor version) ".tar.gz"))
|
| 88 | (sha256
|
| 89 | (base32
|
| 90 | "0dbw02ai0z8x6d9s14pl0hnaa2g1kdxnv8qqra1fx13ay5qp3srz"))
|
| 91 | (patches (append %patch-series-8.2
|
| 92 | (search-patches "readline-link-ncurses.patch")))
|
| 93 | (patch-flags '("-p0"))))
|
| 94 | (build-system gnu-build-system)
|
| 95 | (propagated-inputs (list ncurses))
|
| 96 | (arguments
|
| 97 | (append
|
| 98 | (if (target-loongarch64?)
|
| 99 | (list #:phases
|
| 100 | #~(modify-phases %standard-phases
|
| 101 | (add-after 'unpack 'update-config-scripts
|
| 102 | (lambda* (#:key inputs native-inputs #:allow-other-keys)
|
| 103 | |
| 104 | (for-each (lambda (file)
|
| 105 | (install-file
|
| 106 | (search-input-file
|
| 107 | (or native-inputs inputs)
|
| 108 | (string-append "/bin/" file)) "./support"))
|
| 109 | '("config.guess" "config.sub"))))))
|
| 110 | '())
|
| 111 | (list #:configure-flags
|
| 112 | #~(list (string-append
|
| 113 | "LDFLAGS=-Wl,-rpath -Wl,"
|
| 114 | (dirname (search-input-file %build-inputs
|
| 115 | "lib/libncurses.so")))
|
| 116 |
|
| 117 | |
| 118 | |
| 119 | #$@(if (%current-target-system)
|
| 120 | '("bash_cv_wcwidth_broken=no")
|
| 121 | '())
|
| 122 | |
| 123 | #$@(if (target-mingw?)
|
| 124 | '("bash_cv_termcap_lib=ncurses")
|
| 125 | '()))
|
| 126 |
|
| 127 | #:make-flags
|
| 128 | (if (target-mingw?)
|
| 129 | |
| 130 | |
| 131 | #~'("TERMCAP_LIB=-lncurses"
|
| 132 | "CPPFLAGS=-D_POSIX -D'chown(f,o,g)=0'")
|
| 133 | #~'()))))
|
| 134 | (native-inputs (if (target-loongarch64?)
|
| 135 | (list config)
|
| 136 | '()))
|
| 137 | (synopsis "Edit command lines while typing, with history support")
|
| 138 | (description
|
| 139 | "The GNU readline library allows users to edit command lines as they
|
| 140 | are typed in. It can maintain a searchable history of previously entered
|
| 141 | commands, letting you easily recall, edit and re-enter past commands. It
|
| 142 | features both Emacs-like and vi-like keybindings, making its usage
|
| 143 | comfortable for anyone.")
|
| 144 | (license gpl3+)
|
| 145 | (home-page "https://savannah.gnu.org/projects/readline/")))
|
| 146 |
|
| 147 | (define-public readline-7
|
| 148 | (package (inherit readline)
|
| 149 | (name "readline")
|
| 150 | (version (string-append "7.0."
|
| 151 | (number->string (length %patch-series-7.0))))
|
| 152 | (source (origin
|
| 153 | (method url-fetch)
|
| 154 | (uri (string-append "mirror://gnu/readline/readline-"
|
| 155 | (version-major+minor version) ".tar.gz"))
|
| 156 | (sha256
|
| 157 | (base32
|
| 158 | "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
|
| 159 | (patches (append
|
| 160 | %patch-series-7.0
|
| 161 | (search-patches "readline-link-ncurses.patch")))
|
| 162 | (patch-flags '("-p0"))))))
|
| 163 |
|
| 164 | (define-public rlwrap
|
| 165 | (package
|
| 166 | (name "rlwrap")
|
| 167 | (version "0.48")
|
| 168 | (source
|
| 169 | (origin
|
| 170 | (method git-fetch)
|
| 171 | (uri (git-reference
|
| 172 | (url "https://github.com/hanslub42/rlwrap")
|
| 173 | (commit (string-append "v" version))))
|
| 174 | (file-name (git-file-name name version))
|
| 175 | (sha256
|
| 176 | (base32 "13iqss291sapivryix91ri62ws4v4n2mz2gf68cm2i6avy734f2b"))
|
| 177 | (patches (search-patches "rlwrap-no-rbgen.patch"))))
|
| 178 | (build-system gnu-build-system)
|
| 179 | (native-inputs
|
| 180 | (list autoconf automake perl))
|
| 181 | (inputs
|
| 182 | (list readline libptytty))
|
| 183 | (synopsis "Wrapper to allow the editing of keyboard commands")
|
| 184 | (description
|
| 185 | "Rlwrap is a 'readline wrapper', a small utility that uses the GNU
|
| 186 | readline library to allow the editing of keyboard input for any command. You
|
| 187 | should consider rlwrap especially when you need user-defined completion (by way
|
| 188 | of completion word lists) and persistent history, or if you want to program
|
| 189 | `special effects' using the filter mechanism.")
|
| 190 | (home-page "https://github.com/hanslub42/rlwrap")
|
| 191 | (license gpl2+)))
|