Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/readline/, sys-libs/readline/files/
Date: Thu, 30 Jul 2020 08:53:14
Message-Id: 1596099153.2ad8bd5161e9eafeb37f46c9a9e321903a1797e0.polynomial-c@gentoo
1 commit: 2ad8bd5161e9eafeb37f46c9a9e321903a1797e0
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 30 08:51:59 2020 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 30 08:52:33 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ad8bd51
7
8 Revert "sys-libs/readline: Security cleanup (drop <8)"
9
10 This reverts commit 2280012d7e09b97fb7441ea8c2b353f30a6ed356.
11 because it breaks app-admin/puppet-agent and dev-lisp/clisp
12
13 Bug: https://bugs.gentoo.org/717924
14 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
15
16 sys-libs/readline/Manifest | 15 ++
17 .../readline-6.3-fix-long-prompt-vi-search.patch | 26 +++
18 .../readline/files/readline-6.3-read-eof.patch | 54 +++++++
19 sys-libs/readline/files/readline-7.0-mingw.patch | 152 ++++++++++++++++++
20 .../files/readline-7.0-missing-echo-proto.patch | 14 ++
21 sys-libs/readline/readline-6.3_p8-r3.ebuild | 163 +++++++++++++++++++
22 sys-libs/readline/readline-7.0_p5-r1.ebuild | 174 +++++++++++++++++++++
23 7 files changed, 598 insertions(+)
24
25 diff --git a/sys-libs/readline/Manifest b/sys-libs/readline/Manifest
26 index 8dd67c3a4d8..030cef77bba 100644
27 --- a/sys-libs/readline/Manifest
28 +++ b/sys-libs/readline/Manifest
29 @@ -1,4 +1,19 @@
30 +DIST readline-6.3.tar.gz 2468560 BLAKE2B 24488ec141734c050ba985a93423692396f105619bae3ce5b109bc68a4f43862bcf3a6fb8d82fec1145d665cdb408765e179379bb35f008d09c441fa2e5739df SHA512 f70efaf46d570b85c7637172b0ee2eb9a4aa73ba38a62bb45075e665929d9701b96fba0aea6c767fd9a2a0d39dfe8e70ab06da08f8524aee76a7c502f370a401
31 +DIST readline-7.0.tar.gz 2910016 BLAKE2B 679b8aa7ce003017b729e6d8d4cb69d0f991578441a3e69005090079e61f6aa48b7ad4d0b1f34b6041528cf33254a1bf3ddb05b60db53a06e443d7922d49d0d4 SHA512 18243189d39bf0d4c8a76cddcce75243c1bae8824c686e9b6ba352667607e5b10c5feb79372a1093c1c388d821841670702e940df12eae94bcebdeed90047870
32 DIST readline-8.0.tar.gz 2975937 BLAKE2B 95e08b28cc46582f036379413810ca40c97d4d3bc59a9e03e04e57d531573abfbe955f6f1cb86e39c208bf6c3f4c618cff70a87bec596d0b9120909d6c5a2f69 SHA512 41759d27bc3a258fefd7f4ff3277fa6ab9c21abb7b160e1a75aa8eba547bd90b288514e76264bd94fb0172da8a4faa54aab2c07b68a0356918ecf7f1969e866f
33 +DIST readline63-001 1366 BLAKE2B 82af5be99597719329db3f1d6049e75a5654ccf6597cf557c71ad7ada0ac03be87381a7738931eb78716de65902ae87498f574b84150a69eae9cc308c4bfffdd SHA512 e70f89ca52a4eae7e1cddd70de6a7162252231ee029c89bb3fcb0f6c8c8b46c666be910c8b2eee72e96983ec2f1a23663694dc222f67228d82e8e4684f1504a2
34 +DIST readline63-002 1297 BLAKE2B 5ace4a81381910ee48dee8cdbb2ca95a1bef2d1f8acca6d39a910c078c86de10a0fc29486939b336110ecb0281b3edb16e4b985f41e7ee161904728f289fff04 SHA512 4e23bd67433577e6e361d10a6c32768ea9e13b10e77493e565b870f56069b673fbcb0b860225f79fa9931845fc91d35c9a82c1385c23f8b757ebfd59f27851f4
35 +DIST readline63-003 985 BLAKE2B cf2cda505b100d5f820d8bfc99eed6b50e65c92b6a495073352fc7385c6456478594e5c2dc293ce556b66853dff705050fb97982aa25fce452ae53d2cb272cf4 SHA512 6bfb84a5b980091b995e2b96bdf5680f97fe670e6cac1b8606d2d75a1ef922ff5bd4e73f029f7af98a115006b7ab7828146f2cd6986287543d8a29987c91dc12
36 +DIST readline63-004 1363 BLAKE2B c1aec93f1e23acd51b36068d3aac31b93ffd9c1039be2c45ff4e6479135f153888030c68cf19c5ced950f6fbbb38ee7fa644d5a737f3f8ed511e97bf342940f5 SHA512 6b683e9fe28831885135391b5a23bc580cacf0ffe720951a80f545574eda4eb064fe189801d44329b2eb2d3577db5a90f9e5ad9ed131e7e8a8ae349511632721
37 +DIST readline63-005 1664 BLAKE2B f98f62be8676aca81b91d919bc4eccfe40c382a8baab0e64b1659b714f0d72424e29b709cc5e226fd73daf67eef264a17e07982d2553ce80f5e5f39fad70610b SHA512 b0332d7f999376788155341319d138a899a2278c338a6faaac89ecf3ed1e2248a07413dd810a76996bf25f211de787182b55f34ab3d7d31eb7519d7a48ebed32
38 +DIST readline63-006 1982 BLAKE2B ad6d16ff769eb8e367cf961ffe152c04778b046a04e4a62e0ce21d08fa16b0eca3d278dbdc274b082d24fa2ec959ffb62168ea7693b4de94b59a4526b1f0c4a2 SHA512 e9fbfa38d7b03ab2aff2e9e48918b85b4b67a729862ee47d1cc8e0aeb90c3224394a79f68829951e1377cae65742aa5385eae865f75e9c0b2e2abde42889431c
39 +DIST readline63-007 1428 BLAKE2B 60e64c2dd36457e3992cfbfbbcc261337e515be360a37d71b9de236c62c781f10f0ec37e4e196b4634e5d547edebbf915370091ca42fff873b78cd80cfe3a7f2 SHA512 abee331894846b360203a521d9a66fa02c03214120d5cafbd1cb4d680bd7bbef14321ae845dd67f7b5e8c87322801fd96fc9a5fd0ae026b41d98dc24a8949854
40 +DIST readline63-008 1452 BLAKE2B 4e41c45be1479fba9f74bf9cedb8d1f6237e650962d5b45ea1a61cc48a8323a0fa60d76f68c011b6e7c73a1078b5ff80f9966e983b994f814d471d0efd9efde6 SHA512 8e30bbca3aa5cea8c2ee511abe0ec8f131608d74fe5ab24d68bcf452267f0f97446ed6e7cd482360876ce6c027280e4f4450cae05eb18f56046240f4c224841c
41 +DIST readline70-001 1777 BLAKE2B ab217bd9d27f30351397db2b745cb33ac7e0ce18bbc00112bb87570da0f62ee0e8d182395c97e4ecc21af51e7e1e580ba48076de1095c556f0744475e4019821 SHA512 4402186905af8cd42c609d640c2e13b9ad61c7778e5a3fd2c2d9da301f0deab05b04d7836f31527262f44f406517823dbb18cb07f2c73931186c806b494699ec
42 +DIST readline70-002 2953 BLAKE2B 47d729b1babe904855fe5d4f780a5b2153a743def527479c3cb82759cdee5bb4260be722e1050be680f5c0dd6dec8ca25c4c1ff557415abae6b3fac2bd481f0b SHA512 13d1489578508d4d2c3a1618024198a709dbce74a6bbf0f6d7ec67d2419c55bfec9f0ca9de0ed93f129d21d5c3a94307ccdc49408455bbb301c5e3a772b03185
43 +DIST readline70-003 1294 BLAKE2B 9473e18b582fba69cea83e3f5b9fa278dd8b0544325439307d2b4053cbeca8d2f008104bee181ae5d9405d702e6d3bcf26379c4d46e269906474c8544367b780 SHA512 eaf962a1480eb3870519017b81ecc5cef171e4c41fcf8c17da61ccbfd0379ed6bca85c17b03e2207ae4d51509f33fd010294c75f4bd0433a52118015d4160385
44 +DIST readline70-004 1501 BLAKE2B cebce69a21bee3a4d6a908de09f371d65eab6af51a8dc0f58fc915b916957db420252ce07b06703c05d984f62e1e849b6975f5444b2af6ba35ff7c939acf9d99 SHA512 7be41558eab3b88a3657f8589ecfaff0b8ee7f59083d385f50e8704fe830e05a50652a5feda19ff1f3cfd98bff4bb8e25e1637ec4dac8a618db9c8220a3d954e
45 +DIST readline70-005 1641 BLAKE2B f720508f698b113c6328018f7e6e8775c7c79afc464047405a5c3dae017d611535017dfc2759c11483bb536fab1e9bf72c7a9d3c769b7aea3bd2cee9686bd522 SHA512 eeb27f4f9195cb905d5891f26480d58f59c885dde3457f7a30ff57760ac772e2333ee8aeae979214949f3b52030285b10db013e307ee7311abab677a4427e878
46 DIST readline80-001 927 BLAKE2B 95e3ac33ff4adb65813274864c17781056a8ea065f9a76571b4a6bcb2ebab090c3a021fa2b621832c11b5995e48a8a26dd6e3a8f5864a8e8b520bfcf85d7c4ab SHA512 a148cda6ac97935d51ede1bbacf847d7d2cba8861cf3941d32e3da2f45f16dcc05b20845b63d4264692520db8329e1236cf2bc4fd8ccbe6e40921bbbdeb2cb1c
47 DIST readline80-002 1401 BLAKE2B a2f511272f6d651208469998330059d6bae17bb8b704b64468685bb0368b76df1ca5b1dcd8e5cb0019e80932130c8a92fd1a305679bf79f0b801532a94c4b4ae SHA512 a941d142a59fe592cc45c1cf4d416e2fc0ab543dd6a0496fb8b2ec6f651cedd6fb9e0c105f14880700b69b2d6912653b3f66371e45cbe4adc0cc9554801afd3c
48 DIST readline80-003 2158 BLAKE2B d8910aef1b796a59500b255df8db71ad1738dd164fd69827759eade74b6d9806ecd364839cfa904fc2f2d48352342155f670e5ec43aac0693f36820fb7139a4d SHA512 85235fca047b4ac87b846d998fffc67ae67ed365b068fd2743e84f11fd00086f85e622955192e07e3560965e32ff5f6d014e0146cde528fb0d0f7b5b829875ca
49
50 diff --git a/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch b/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch
51 new file mode 100644
52 index 00000000000..23d785054e7
53 --- /dev/null
54 +++ b/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch
55 @@ -0,0 +1,26 @@
56 +https://lists.gnu.org/archive/html/bug-bash/2014-08/msg00082.html
57 +
58 +From 2774192e93991e3d85ccc37c714aa018e442af6d Mon Sep 17 00:00:00 2001
59 +From: Dylan Cali <calid1984@×××××.com>
60 +Date: Sat, 23 Aug 2014 02:26:05 -0500
61 +Subject: [PATCH] fix vi search prompt bug for long prompts
62 +
63 +---
64 + display.c | 2 +-
65 + 1 file changed, 1 insertion(+), 1 deletion(-)
66 +
67 +diff --git a/display.c b/display.c
68 +index 4df1f73..e575b16 100644
69 +--- a/display.c
70 ++++ b/display.c
71 +@@ -2259,7 +2259,7 @@ rl_message (va_alist)
72 + va_start (args);
73 + format = va_arg (args, char *);
74 + #endif
75 +- vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
76 ++ vsnprintf (msg_buf, msg_bufsiz, format, args);
77 + }
78 + #else
79 + vsprintf (msg_buf, format, args);
80 +--
81 +1.7.10.4
82
83 diff --git a/sys-libs/readline/files/readline-6.3-read-eof.patch b/sys-libs/readline/files/readline-6.3-read-eof.patch
84 new file mode 100644
85 index 00000000000..f74aad63be1
86 --- /dev/null
87 +++ b/sys-libs/readline/files/readline-6.3-read-eof.patch
88 @@ -0,0 +1,54 @@
89 +http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00152.html
90 +
91 +*** ../bash-4.3-patched/lib/readline/readline.c 2014-10-01 13:08:28.000000000 -0400
92 +--- lib/readline/readline.c 2014-12-20 22:37:28.000000000 -0500
93 +***************
94 +*** 580,592 ****
95 + }
96 +
97 +! /* EOF typed to a non-blank line is a <NL>. If we want to change this,
98 +! to force any existing line to be ignored when read(2) reads EOF,
99 +! for example, this is the place to change. */
100 + if (c == EOF && rl_end)
101 +! c = NEWLINE;
102 +
103 + /* The character _rl_eof_char typed to blank line, and not as the
104 +! previous character is interpreted as EOF. */
105 +! if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end)
106 + {
107 + #if defined (READLINE_CALLBACKS)
108 +--- 587,620 ----
109 + }
110 +
111 +! /* EOF typed to a non-blank line is ^D the first time, EOF the second
112 +! time in a row. This won't return any partial line read from the tty.
113 +! If we want to change this, to force any existing line to be returned
114 +! when read(2) reads EOF, for example, this is the place to change. */
115 + if (c == EOF && rl_end)
116 +! {
117 +! if (RL_SIG_RECEIVED ())
118 +! {
119 +! RL_CHECK_SIGNALS ();
120 +! if (rl_signal_event_hook)
121 +! (*rl_signal_event_hook) (); /* XXX */
122 +! }
123 +!
124 +! /* XXX - reading two consecutive EOFs returns EOF */
125 +! if (RL_ISSTATE (RL_STATE_TERMPREPPED))
126 +! {
127 +! if (lastc == _rl_eof_char || lastc == EOF)
128 +! rl_end = 0;
129 +! else
130 +! c = _rl_eof_char;
131 +! }
132 +! else
133 +! c = NEWLINE;
134 +! }
135 +
136 + /* The character _rl_eof_char typed to blank line, and not as the
137 +! previous character is interpreted as EOF. This doesn't work when
138 +! READLINE_CALLBACKS is defined, so hitting a series of ^Ds will
139 +! erase all the chars on the line and then return EOF. */
140 +! if (((c == _rl_eof_char && lastc != c) || c == EOF) && rl_end == 0)
141 + {
142 + #if defined (READLINE_CALLBACKS)
143
144 diff --git a/sys-libs/readline/files/readline-7.0-mingw.patch b/sys-libs/readline/files/readline-7.0-mingw.patch
145 new file mode 100644
146 index 00000000000..f003038d2c0
147 --- /dev/null
148 +++ b/sys-libs/readline/files/readline-7.0-mingw.patch
149 @@ -0,0 +1,152 @@
150 +--- a/colors.c
151 ++++ b/colors.c
152 +@@ -37,6 +37,10 @@
153 + #include "posixstat.h" // stat related macros (S_ISREG, ...)
154 + #include <fcntl.h> // S_ISUID
155 +
156 ++#ifndef S_ISDIR
157 ++#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
158 ++#endif
159 ++
160 + // strlen()
161 + #if defined (HAVE_STRING_H)
162 + # include <string.h>
163 +@@ -182,12 +186,17 @@ _rl_print_color_indicator (const char *f
164 + if (S_ISREG (mode))
165 + {
166 + colored_filetype = C_FILE;
167 +-
168 ++#ifdef S_ISUID
169 + if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
170 + colored_filetype = C_SETUID;
171 +- else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
172 ++ else
173 ++#endif
174 ++#ifdef S_ISGID
175 ++ if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
176 + colored_filetype = C_SETGID;
177 +- else if (is_colored (C_CAP) && 0) //f->has_capability)
178 ++ else
179 ++#endif
180 ++ if (is_colored (C_CAP) && 0) //f->has_capability)
181 + colored_filetype = C_CAP;
182 + else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
183 + colored_filetype = C_EXEC;
184 +@@ -211,12 +220,16 @@ _rl_print_color_indicator (const char *f
185 + colored_filetype = C_STICKY;
186 + #endif
187 + }
188 ++#if defined (S_ISLNK)
189 + else if (S_ISLNK (mode))
190 + colored_filetype = C_LINK;
191 ++#endif
192 + else if (S_ISFIFO (mode))
193 + colored_filetype = C_FIFO;
194 ++#if defined (S_ISSOCK)
195 + else if (S_ISSOCK (mode))
196 + colored_filetype = C_SOCK;
197 ++#endif
198 + else if (S_ISBLK (mode))
199 + colored_filetype = C_BLK;
200 + else if (S_ISCHR (mode))
201 +--- a/histfile.c
202 ++++ b/histfile.c
203 +@@ -606,12 +606,14 @@ history_truncate_file (fname, lines)
204 + history_lines_written_to_file = 0;
205 + }
206 +
207 ++#if defined (HAVE_CHOWN)
208 + /* Make sure the new filename is owned by the same user as the old. If one
209 + user is running this, it's a no-op. If the shell is running after sudo
210 + with a shared history file, we don't want to leave the history file
211 + owned by root. */
212 + if (rv == 0 && exists)
213 + r = chown (filename, finfo.st_uid, finfo.st_gid);
214 ++#endif
215 +
216 + xfree (filename);
217 + FREE (tempname);
218 +@@ -753,12 +755,14 @@ mmap_error:
219 + history_lines_written_to_file = 0;
220 + }
221 +
222 ++#if defined (HAVE_CHOWN)
223 + /* Make sure the new filename is owned by the same user as the old. If one
224 + user is running this, it's a no-op. If the shell is running after sudo
225 + with a shared history file, we don't want to leave the history file
226 + owned by root. */
227 + if (rv == 0 && exists)
228 + mode = chown (histname, finfo.st_uid, finfo.st_gid);
229 ++#endif
230 +
231 + FREE (histname);
232 + FREE (tempname);
233 +--- a/input.c
234 ++++ b/input.c
235 +@@ -71,6 +71,10 @@ extern int errno;
236 + #include "rlshell.h"
237 + #include "xmalloc.h"
238 +
239 ++#if defined (__MINGW32__)
240 ++#include <conio.h>
241 ++#endif
242 ++
243 + /* What kind of non-blocking I/O do we have? */
244 + #if !defined (O_NDELAY) && defined (O_NONBLOCK)
245 + # define O_NDELAY O_NONBLOCK /* Posix style */
246 +--- a/posixstat.h
247 ++++ b/posixstat.h
248 +@@ -78,30 +78,44 @@
249 +
250 + #if defined (S_IFBLK) && !defined (S_ISBLK)
251 + #define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) /* block device */
252 ++#elif !defined (S_IFBLK)
253 ++#define S_ISBLK(m) 0
254 + #endif
255 +
256 + #if defined (S_IFCHR) && !defined (S_ISCHR)
257 + #define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) /* character device */
258 ++#elif !defined (S_IFCHR)
259 ++#define S_ISCHR(m) 0
260 + #endif
261 +
262 + #if defined (S_IFDIR) && !defined (S_ISDIR)
263 + #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
264 ++#elif !defined (S_IFDIR)
265 ++#define S_ISDIR(m) 0
266 + #endif
267 +
268 + #if defined (S_IFREG) && !defined (S_ISREG)
269 + #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) /* file */
270 ++#elif !defined (S_IFREG)
271 ++#define S_ISREG(m) 0
272 + #endif
273 +
274 + #if defined (S_IFIFO) && !defined (S_ISFIFO)
275 + #define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO) /* fifo - named pipe */
276 ++#elif !defined (S_IFIFO)
277 ++#define S_ISFIFO(m) 0
278 + #endif
279 +
280 + #if defined (S_IFLNK) && !defined (S_ISLNK)
281 + #define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK) /* symbolic link */
282 ++#elif !defined (S_IFLNK)
283 ++#define S_ISLNK(m) 0
284 + #endif
285 +
286 + #if defined (S_IFSOCK) && !defined (S_ISSOCK)
287 + #define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK) /* socket */
288 ++#elif !defined (S_IFSOCK)
289 ++#define S_ISSOCK(m) 0
290 + #endif
291 +
292 + /*
293 +@@ -137,6 +151,8 @@
294 + /* These are non-standard, but are used in builtins.c$symbolic_umask() */
295 + #define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
296 + #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
297 ++#if defined(S_IXUSR) && defined(S_IXOTH)
298 + #define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
299 ++#endif
300 +
301 + #endif /* _POSIXSTAT_H_ */
302
303 diff --git a/sys-libs/readline/files/readline-7.0-missing-echo-proto.patch b/sys-libs/readline/files/readline-7.0-missing-echo-proto.patch
304 new file mode 100644
305 index 00000000000..cad3c8ca2c4
306 --- /dev/null
307 +++ b/sys-libs/readline/files/readline-7.0-missing-echo-proto.patch
308 @@ -0,0 +1,14 @@
309 +https://lists.gnu.org/archive/html/bug-readline/2016-11/msg00000.html
310 +
311 +fix from upstream
312 +
313 +--- a/readline.h
314 ++++ b/readline.h
315 +@@ -413,6 +413,7 @@
316 + extern void rl_tty_set_default_bindings PARAMS((Keymap));
317 + extern void rl_tty_unset_default_bindings PARAMS((Keymap));
318 +
319 ++extern int rl_tty_set_echoing PARAMS((int));
320 + extern int rl_reset_terminal PARAMS((const char *));
321 + extern void rl_resize_terminal PARAMS((void));
322 + extern void rl_set_screen_size PARAMS((int, int));
323
324 diff --git a/sys-libs/readline/readline-6.3_p8-r3.ebuild b/sys-libs/readline/readline-6.3_p8-r3.ebuild
325 new file mode 100644
326 index 00000000000..009f74e037f
327 --- /dev/null
328 +++ b/sys-libs/readline/readline-6.3_p8-r3.ebuild
329 @@ -0,0 +1,163 @@
330 +# Copyright 1999-2020 Gentoo Authors
331 +# Distributed under the terms of the GNU General Public License v2
332 +
333 +EAPI=5
334 +
335 +inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal preserve-libs usr-ldscript
336 +
337 +# Official patches
338 +# See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
339 +PLEVEL=${PV##*_p}
340 +MY_PV=${PV/_p*}
341 +MY_PV=${MY_PV/_/-}
342 +MY_P=${PN}-${MY_PV}
343 +[[ ${PV} != *_p* ]] && PLEVEL=0
344 +patches() {
345 + [[ ${PLEVEL} -eq 0 ]] && return 1
346 + local opt=$1
347 + eval set -- {1..${PLEVEL}}
348 + set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
349 + if [[ ${opt} == -s ]] ; then
350 + echo "${@/#/${DISTDIR}/}"
351 + else
352 + local u
353 + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
354 + printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
355 + done
356 + fi
357 +}
358 +
359 +DESCRIPTION="Another cute console display library"
360 +HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html"
361 +SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
362 +
363 +LICENSE="GPL-3"
364 +SLOT="0"
365 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux"
366 +IUSE="static-libs utils"
367 +
368 +RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}]"
369 +DEPEND="${RDEPEND}
370 + virtual/pkgconfig"
371 +
372 +S=${WORKDIR}/${MY_P}
373 +
374 +PATCHES=(
375 + "${FILESDIR}"/${PN}-5.0-no_rpath.patch
376 + "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
377 + "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
378 + "${FILESDIR}"/${PN}-6.3-read-eof.patch
379 +)
380 +
381 +src_unpack() {
382 + unpack ${MY_P}.tar.gz
383 +}
384 +
385 +src_prepare() {
386 + [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
387 + epatch "${PATCHES[@]}"
388 +
389 + # Force ncurses linking. #71420
390 + # Use pkg-config to get the right values. #457558
391 + local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
392 + sed -i \
393 + -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
394 + support/shobj-conf || die
395 + sed -i \
396 + -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
397 + examples/rlfe/configure || die
398 +
399 + # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
400 + # objformat for years, so we don't want to rely on that.
401 + sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
402 +
403 + ln -s ../.. examples/rlfe/readline # for local readline headers
404 +}
405 +
406 +src_configure() {
407 + # fix implicit decls with widechar funcs
408 + append-cppflags -D_GNU_SOURCE
409 + # https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
410 + append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
411 +
412 + # Make sure configure picks a better ar than `ar`. #484866
413 + export ac_cv_prog_AR=$(tc-getAR)
414 +
415 + # Force the test since we used sed above to force it.
416 + export bash_cv_termcap_lib=ncurses
417 +
418 + # Control cross-compiling cases when we know the right answer.
419 + # In cases where the C library doesn't support wide characters, readline
420 + # itself won't work correctly, so forcing the answer below should be OK.
421 + if tc-is-cross-compiler ; then
422 + export bash_cv_func_sigsetjmp='present'
423 + export bash_cv_func_ctype_nonascii='yes'
424 + export bash_cv_wcwidth_broken='no' #503312
425 + fi
426 +
427 + # This is for rlfe, but we need to make sure LDFLAGS doesn't change
428 + # so we can re-use the config cache file between the two.
429 + append-ldflags -L.
430 +
431 + multilib-minimal_src_configure
432 +}
433 +
434 +multilib_src_configure() {
435 + ECONF_SOURCE=${S} \
436 + econf \
437 + --cache-file="${BUILD_DIR}"/config.cache \
438 + --docdir='$(datarootdir)'/doc/${PF} \
439 + --with-curses \
440 + $(use_enable static-libs static)
441 +
442 + if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
443 + # code is full of AC_TRY_RUN()
444 + mkdir -p examples/rlfe || die
445 + cd examples/rlfe || die
446 + ECONF_SOURCE=${S}/examples/rlfe \
447 + econf --cache-file="${BUILD_DIR}"/config.cache
448 + fi
449 +}
450 +
451 +multilib_src_compile() {
452 + emake
453 +
454 + if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
455 + # code is full of AC_TRY_RUN()
456 + cd examples/rlfe || die
457 + local l
458 + for l in readline history ; do
459 + ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
460 + ln -sf ../../lib${l}.a lib${l}.a
461 + done
462 + emake
463 + fi
464 +}
465 +
466 +multilib_src_install() {
467 + default
468 +
469 + if multilib_is_native_abi ; then
470 + gen_usr_ldscript -a readline history #4411
471 +
472 + if use utils && ! tc-is-cross-compiler; then
473 + dobin examples/rlfe/rlfe
474 + fi
475 + fi
476 +}
477 +
478 +multilib_src_install_all() {
479 + einstalldocs
480 + dodoc USAGE
481 + dohtml -r doc/.
482 + docinto ps
483 + dodoc doc/*.ps
484 +}
485 +
486 +pkg_preinst() {
487 + preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
488 +}
489 +
490 +pkg_postinst() {
491 + preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
492 +}
493
494 diff --git a/sys-libs/readline/readline-7.0_p5-r1.ebuild b/sys-libs/readline/readline-7.0_p5-r1.ebuild
495 new file mode 100644
496 index 00000000000..00c928489ec
497 --- /dev/null
498 +++ b/sys-libs/readline/readline-7.0_p5-r1.ebuild
499 @@ -0,0 +1,174 @@
500 +# Copyright 1999-2020 Gentoo Authors
501 +# Distributed under the terms of the GNU General Public License v2
502 +
503 +EAPI=6
504 +
505 +inherit flag-o-matic multilib-minimal toolchain-funcs preserve-libs usr-ldscript
506 +
507 +# Official patches
508 +# See ftp://ftp.cwru.edu/pub/bash/readline-7.0-patches/
509 +PLEVEL="${PV##*_p}"
510 +MY_PV="${PV/_p*}"
511 +MY_PV="${MY_PV/_/-}"
512 +MY_P="${PN}-${MY_PV}"
513 +[[ ${PV} != *_p* ]] && PLEVEL=0
514 +patches() {
515 + [[ ${PLEVEL} -eq 0 ]] && return 1
516 + local opt=$1
517 + eval set -- {1..${PLEVEL}}
518 + set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
519 + if [[ ${opt} == -s ]] ; then
520 + echo "${@/#/${DISTDIR}/}"
521 + else
522 + local u
523 + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
524 + printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
525 + done
526 + fi
527 +}
528 +
529 +DESCRIPTION="Another cute console display library"
530 +HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html"
531 +
532 +case ${PV} in
533 + *_alpha*|*_beta*|*_rc*)
534 + SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
535 + ;;
536 + *)
537 + SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
538 + ;;
539 +esac
540 +
541 +LICENSE="GPL-3"
542 +SLOT="0/7" # subslot matches SONAME major
543 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux"
544 +IUSE="static-libs +unicode utils"
545 +
546 +RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[static-libs?,unicode?,${MULTILIB_USEDEP}]"
547 +DEPEND="${RDEPEND}
548 + virtual/pkgconfig"
549 +
550 +S=${WORKDIR}/${MY_P}
551 +
552 +PATCHES=(
553 + "${FILESDIR}"/${PN}-5.0-no_rpath.patch
554 + "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
555 + "${FILESDIR}"/${PN}-7.0-headers.patch
556 + "${FILESDIR}"/${PN}-7.0-missing-echo-proto.patch
557 + "${FILESDIR}"/${PN}-7.0-mingw.patch
558 +)
559 +
560 +# Needed because we don't want the patches being unpacked
561 +# (which emits annoying and useless error messages)
562 +src_unpack() {
563 + unpack ${MY_P}.tar.gz
564 +}
565 +
566 +src_prepare() {
567 + [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
568 + default
569 +
570 + # Force ncurses linking. #71420
571 + # Use pkg-config to get the right values. #457558
572 + local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses$(usex unicode w '') --libs)
573 + sed -i \
574 + -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
575 + support/shobj-conf || die
576 + sed -i \
577 + -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
578 + examples/rlfe/configure || die
579 +
580 + # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
581 + # objformat for years, so we don't want to rely on that.
582 + sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
583 +
584 + ln -s ../.. examples/rlfe/readline || die # for local readline headers
585 +}
586 +
587 +src_configure() {
588 + # fix implicit decls with widechar funcs
589 + append-cppflags -D_GNU_SOURCE
590 + # https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
591 + append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
592 +
593 + # Make sure configure picks a better ar than `ar`. #484866
594 + export ac_cv_prog_AR=$(tc-getAR)
595 +
596 + # Force the test since we used sed above to force it.
597 + export bash_cv_termcap_lib=ncurses
598 +
599 + # Control cross-compiling cases when we know the right answer.
600 + # In cases where the C library doesn't support wide characters, readline
601 + # itself won't work correctly, so forcing the answer below should be OK.
602 + if tc-is-cross-compiler ; then
603 + use kernel_Winnt || export bash_cv_func_sigsetjmp='present'
604 + export bash_cv_func_ctype_nonascii='yes'
605 + export bash_cv_wcwidth_broken='no' #503312
606 + fi
607 +
608 + # This is for rlfe, but we need to make sure LDFLAGS doesn't change
609 + # so we can re-use the config cache file between the two.
610 + append-ldflags -L.
611 +
612 + multilib-minimal_src_configure
613 +}
614 +
615 +multilib_src_configure() {
616 + local myeconfargs=(
617 + --cache-file="${BUILD_DIR}"/config.cache
618 + --with-curses
619 + $(use_enable static-libs static)
620 + )
621 + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
622 +
623 + if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
624 + # code is full of AC_TRY_RUN()
625 + mkdir -p examples/rlfe || die
626 + cd examples/rlfe || die
627 + ECONF_SOURCE="${S}"/examples/rlfe \
628 + econf --cache-file="${BUILD_DIR}"/config.cache
629 + fi
630 +}
631 +
632 +multilib_src_compile() {
633 + emake
634 +
635 + if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
636 + # code is full of AC_TRY_RUN()
637 + cd examples/rlfe || die
638 + local l
639 + for l in readline history ; do
640 + ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname) || die
641 + ln -s ../../lib${l}.a lib${l}.a || die
642 + done
643 + emake
644 + fi
645 +}
646 +
647 +multilib_src_install() {
648 + default
649 +
650 + if multilib_is_native_abi ; then
651 + gen_usr_ldscript -a readline history #4411
652 +
653 + if use utils && ! tc-is-cross-compiler; then
654 + dobin examples/rlfe/rlfe
655 + fi
656 + fi
657 +}
658 +
659 +multilib_src_install_all() {
660 + HTML_DOCS="doc/history.html doc/readline.html doc/rluserman.html" einstalldocs
661 + dodoc USAGE
662 + docinto ps
663 + dodoc doc/*.ps
664 +}
665 +pkg_preinst() {
666 + # bug #29865
667 + # Reappeared in #595324 with paludis so keeping this for now...
668 + preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5,6}
669 +}
670 +
671 +pkg_postinst() {
672 + preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5,6}
673 +}