projects/guix·blob javascript-team · refs

191 lines · 8.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2014, 2020 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016, 2019 Efraim Flashner <[email protected]>
4;;; Copyright © 2016 Jan Nieuwenhuizen <[email protected]>
5;;; Copyright © 2018, 2021 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2019, 2020, 2022 Marius Bakke <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
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 ;; Replace outdated config.guess and config.sub.
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 ;; This test does an 'AC_TRY_RUN', which aborts when
118 ;; cross-compiling, so provide the correct answer.
119 #$@(if (%current-target-system)
120 '("bash_cv_wcwidth_broken=no")
121 '())
122 ;; MinGW: ncurses provides the termcap api.
123 #$@(if (target-mingw?)
124 '("bash_cv_termcap_lib=ncurses")
125 '()))
126
127 #:make-flags
128 (if (target-mingw?)
129 ;; MinGW: termcap in ncurses
130 ;; some SIG_* #defined in _POSIX
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
140are typed in. It can maintain a searchable history of previously entered
141commands, letting you easily recall, edit and re-enter past commands. It
142features both Emacs-like and vi-like keybindings, making its usage
143comfortable 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
186readline library to allow the editing of keyboard input for any command. You
187should consider rlwrap especially when you need user-defined completion (by way
188of 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+)))