readline: upgraded package to upstream

Upgraded sys-libs/readline to version 8.0_p4 on amd64

This is needed to break circular dependencies involving pkgconfg.

BUG=chromium:1117585
TEST=CQ passes

Cq-Depend: chromium:2487214
Change-Id: Iabf4fd755787d9f48efef3dc7539596934bcddb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2360512
Tested-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/metadata/md5-cache/sys-libs/readline-8.0_p4 b/metadata/md5-cache/sys-libs/readline-8.0_p4
new file mode 100644
index 0000000..d603524
--- /dev/null
+++ b/metadata/md5-cache/sys-libs/readline-8.0_p4
@@ -0,0 +1,14 @@
+BDEPEND=virtual/pkgconfig
+DEFINED_PHASES=compile configure install postinst preinst prepare test unpack
+DEPEND=>=sys-libs/ncurses-5.9-r3:0=[static-libs?,unicode?,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?,abi_arm_32(-)?,abi_arm_64(-)?]
+DESCRIPTION=Another cute console display library
+EAPI=7
+HOMEPAGE=https://tiswww.case.edu/php/chet/readline/rltop.html
+IUSE=static-libs +unicode utils abi_x86_32 abi_x86_64 abi_x86_x32 abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_ppc_32 abi_ppc_64 abi_s390_32 abi_s390_64 abi_arm_32 abi_arm_64 split-usr
+KEYWORDS=*
+LICENSE=GPL-3
+RDEPEND=>=sys-libs/ncurses-5.9-r3:0=[static-libs?,unicode?,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?,abi_arm_32(-)?,abi_arm_64(-)?]
+SLOT=0/8
+SRC_URI=mirror://gnu/readline/readline-8.0.tar.gz ftp://ftp.cwru.edu/pub/bash/readline-8.0-patches/readline80-001 ftp://ftp.cwru.edu/pub/bash/readline-8.0-patches/readline80-002 ftp://ftp.cwru.edu/pub/bash/readline-8.0-patches/readline80-003 ftp://ftp.cwru.edu/pub/bash/readline-8.0-patches/readline80-004 mirror://gnu/readline/readline-8.0-patches/readline80-001 mirror://gnu/readline/readline-8.0-patches/readline80-002 mirror://gnu/readline/readline-8.0-patches/readline80-003 mirror://gnu/readline/readline-8.0-patches/readline80-004
+_eclasses_=eutils	fcb2aa98e1948b835b5ae66ca52868c5	flag-o-matic	5d5921a298e95441da2f85be419894c0	multibuild	40fe59465edacd730c644ec2bc197809	multilib	2477ebe553d3e4d2c606191fe6c33602	multilib-build	1979aa0ff4d356d32507ca4650d9f37d	multilib-minimal	8bddda43703ba94d8341f4e247f97566	preserve-libs	ef207dc62baddfddfd39a164d9797648	toolchain-funcs	605c126bed8d87e4378d5ff1645330cb	usr-ldscript	766f0a506b45f02361ad1b8ca205b7e1
+_md5_=7755d2fb88629ce355184d8fdeed2eac
diff --git a/sys-libs/readline/Manifest b/sys-libs/readline/Manifest
index 9500f71..ba744a2 100644
--- a/sys-libs/readline/Manifest
+++ b/sys-libs/readline/Manifest
@@ -1,9 +1,14 @@
-DIST readline-6.3.tar.gz 2468560 SHA256 56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43 SHA512 f70efaf46d570b85c7637172b0ee2eb9a4aa73ba38a62bb45075e665929d9701b96fba0aea6c767fd9a2a0d39dfe8e70ab06da08f8524aee76a7c502f370a401 WHIRLPOOL 7c68627559890dbebf1394b911cfd4675ec8862b84d4e067a207dd37a0a94482c8d92216195df2873bcdf03a0a86150663a9604cd65a0d78363376bc8ee4cfda
-DIST readline63-001 1366 SHA256 1a79bbb6eaee750e0d6f7f3d059b30a45fc54e8e388a8e05e9c3ae598590146f SHA512 e70f89ca52a4eae7e1cddd70de6a7162252231ee029c89bb3fcb0f6c8c8b46c666be910c8b2eee72e96983ec2f1a23663694dc222f67228d82e8e4684f1504a2 WHIRLPOOL ed0b0ce066ab4764851d81e44d708cc9e2f3fe36ac4788243c81b3e25aa0995d054c1caf0a788c25969c7cdc6b2bad55a9c9c64286f485194b4e76bc453edf74
-DIST readline63-002 1297 SHA256 39e304c7a526888f9e112e733848215736fb7b9d540729b9e31f3347b7a1e0a5 SHA512 4e23bd67433577e6e361d10a6c32768ea9e13b10e77493e565b870f56069b673fbcb0b860225f79fa9931845fc91d35c9a82c1385c23f8b757ebfd59f27851f4 WHIRLPOOL ca878e614ee233748f7017f5606fe2e96bb8374b33e4a571c5901594d7f329fd19b217abcf9cb844fa96374bff9e044712ed1017d6d99936f700da030202231d
-DIST readline63-003 985 SHA256 ec41bdd8b00fd884e847708513df41d51b1243cecb680189e31b7173d01ca52f SHA512 6bfb84a5b980091b995e2b96bdf5680f97fe670e6cac1b8606d2d75a1ef922ff5bd4e73f029f7af98a115006b7ab7828146f2cd6986287543d8a29987c91dc12 WHIRLPOOL 3615b462024e836f0854c2ffaf1282b42462a0da90c8ce248a47e9ea5a0ce00892135c1b725f9fb8ef1fafb1e88e02649c664373ba41683ca2457aafdd12ac93
-DIST readline63-004 1363 SHA256 4547b906fb2570866c21887807de5dee19838a60a1afb66385b272155e4355cc SHA512 6b683e9fe28831885135391b5a23bc580cacf0ffe720951a80f545574eda4eb064fe189801d44329b2eb2d3577db5a90f9e5ad9ed131e7e8a8ae349511632721 WHIRLPOOL 49deb89325cb582538027855169067c4224504d8aa944f8c6f34c07afd0bab30690e01a573ab67279d851b75c6e33e236f19a9fc9eb0271cd1f10d9b91fd0203
-DIST readline63-005 1664 SHA256 877788f9228d1a9907a4bcfe3d6dd0439c08d728949458b41208d9bf9060274b SHA512 b0332d7f999376788155341319d138a899a2278c338a6faaac89ecf3ed1e2248a07413dd810a76996bf25f211de787182b55f34ab3d7d31eb7519d7a48ebed32 WHIRLPOOL d10a4a6a9ea20e2e9bb9180e0a0511796ea0ca247bec17f2357ee8a759ac5adc877f5f838c3d1f45157014d88306f1b1dc7e9633c2bbd4a7125b9b8df5c0c0e8
-DIST readline63-006 1982 SHA256 5c237ab3c6c97c23cf52b2a118adc265b7fb411b57c93a5f7c221d50fafbe556 SHA512 e9fbfa38d7b03ab2aff2e9e48918b85b4b67a729862ee47d1cc8e0aeb90c3224394a79f68829951e1377cae65742aa5385eae865f75e9c0b2e2abde42889431c WHIRLPOOL 7b88ad9fcad9eee0762d881307d2f865c66a9ee246bc1a648d6203677fc307759ca7ee216fb632114d3da76ca27a67222aefd830bcf99ee9a96d1ba2f2105290
-DIST readline63-007 1428 SHA256 4d79b5a2adec3c2e8114cbd3d63c1771f7c6cf64035368624903d257014f5bea SHA512 abee331894846b360203a521d9a66fa02c03214120d5cafbd1cb4d680bd7bbef14321ae845dd67f7b5e8c87322801fd96fc9a5fd0ae026b41d98dc24a8949854 WHIRLPOOL fc9d866a6e0f0c2a2f752c65e6fcae56a1b0e1b5cef45154ff51b5d1b49fc75ffaa30bdf90c221fb6493381b9d67eb20168bdfd273fa0dd89602f18680bb3e5f
-DIST readline63-008 1452 SHA256 3bc093cf526ceac23eb80256b0ec87fa1735540d659742107b6284d635c43787 SHA512 8e30bbca3aa5cea8c2ee511abe0ec8f131608d74fe5ab24d68bcf452267f0f97446ed6e7cd482360876ce6c027280e4f4450cae05eb18f56046240f4c224841c WHIRLPOOL 94d9371e6ca35e72565c1990e0ec8bedf8a141f0a3d061e4928f6184c3ef4a4b472f4278d443b990a53977ad6f3f7bdbf41e51a999202b48414df3a946bb9796
+DIST readline-6.3.tar.gz 2468560 BLAKE2B 24488ec141734c050ba985a93423692396f105619bae3ce5b109bc68a4f43862bcf3a6fb8d82fec1145d665cdb408765e179379bb35f008d09c441fa2e5739df SHA512 f70efaf46d570b85c7637172b0ee2eb9a4aa73ba38a62bb45075e665929d9701b96fba0aea6c767fd9a2a0d39dfe8e70ab06da08f8524aee76a7c502f370a401
+DIST readline-8.0.tar.gz 2975937 BLAKE2B 95e08b28cc46582f036379413810ca40c97d4d3bc59a9e03e04e57d531573abfbe955f6f1cb86e39c208bf6c3f4c618cff70a87bec596d0b9120909d6c5a2f69 SHA512 41759d27bc3a258fefd7f4ff3277fa6ab9c21abb7b160e1a75aa8eba547bd90b288514e76264bd94fb0172da8a4faa54aab2c07b68a0356918ecf7f1969e866f
+DIST readline63-001 1366 BLAKE2B 82af5be99597719329db3f1d6049e75a5654ccf6597cf557c71ad7ada0ac03be87381a7738931eb78716de65902ae87498f574b84150a69eae9cc308c4bfffdd SHA512 e70f89ca52a4eae7e1cddd70de6a7162252231ee029c89bb3fcb0f6c8c8b46c666be910c8b2eee72e96983ec2f1a23663694dc222f67228d82e8e4684f1504a2
+DIST readline63-002 1297 BLAKE2B 5ace4a81381910ee48dee8cdbb2ca95a1bef2d1f8acca6d39a910c078c86de10a0fc29486939b336110ecb0281b3edb16e4b985f41e7ee161904728f289fff04 SHA512 4e23bd67433577e6e361d10a6c32768ea9e13b10e77493e565b870f56069b673fbcb0b860225f79fa9931845fc91d35c9a82c1385c23f8b757ebfd59f27851f4
+DIST readline63-003 985 BLAKE2B cf2cda505b100d5f820d8bfc99eed6b50e65c92b6a495073352fc7385c6456478594e5c2dc293ce556b66853dff705050fb97982aa25fce452ae53d2cb272cf4 SHA512 6bfb84a5b980091b995e2b96bdf5680f97fe670e6cac1b8606d2d75a1ef922ff5bd4e73f029f7af98a115006b7ab7828146f2cd6986287543d8a29987c91dc12
+DIST readline63-004 1363 BLAKE2B c1aec93f1e23acd51b36068d3aac31b93ffd9c1039be2c45ff4e6479135f153888030c68cf19c5ced950f6fbbb38ee7fa644d5a737f3f8ed511e97bf342940f5 SHA512 6b683e9fe28831885135391b5a23bc580cacf0ffe720951a80f545574eda4eb064fe189801d44329b2eb2d3577db5a90f9e5ad9ed131e7e8a8ae349511632721
+DIST readline63-005 1664 BLAKE2B f98f62be8676aca81b91d919bc4eccfe40c382a8baab0e64b1659b714f0d72424e29b709cc5e226fd73daf67eef264a17e07982d2553ce80f5e5f39fad70610b SHA512 b0332d7f999376788155341319d138a899a2278c338a6faaac89ecf3ed1e2248a07413dd810a76996bf25f211de787182b55f34ab3d7d31eb7519d7a48ebed32
+DIST readline63-006 1982 BLAKE2B ad6d16ff769eb8e367cf961ffe152c04778b046a04e4a62e0ce21d08fa16b0eca3d278dbdc274b082d24fa2ec959ffb62168ea7693b4de94b59a4526b1f0c4a2 SHA512 e9fbfa38d7b03ab2aff2e9e48918b85b4b67a729862ee47d1cc8e0aeb90c3224394a79f68829951e1377cae65742aa5385eae865f75e9c0b2e2abde42889431c
+DIST readline63-007 1428 BLAKE2B 60e64c2dd36457e3992cfbfbbcc261337e515be360a37d71b9de236c62c781f10f0ec37e4e196b4634e5d547edebbf915370091ca42fff873b78cd80cfe3a7f2 SHA512 abee331894846b360203a521d9a66fa02c03214120d5cafbd1cb4d680bd7bbef14321ae845dd67f7b5e8c87322801fd96fc9a5fd0ae026b41d98dc24a8949854
+DIST readline63-008 1452 BLAKE2B 4e41c45be1479fba9f74bf9cedb8d1f6237e650962d5b45ea1a61cc48a8323a0fa60d76f68c011b6e7c73a1078b5ff80f9966e983b994f814d471d0efd9efde6 SHA512 8e30bbca3aa5cea8c2ee511abe0ec8f131608d74fe5ab24d68bcf452267f0f97446ed6e7cd482360876ce6c027280e4f4450cae05eb18f56046240f4c224841c
+DIST readline80-001 927 BLAKE2B 95e3ac33ff4adb65813274864c17781056a8ea065f9a76571b4a6bcb2ebab090c3a021fa2b621832c11b5995e48a8a26dd6e3a8f5864a8e8b520bfcf85d7c4ab SHA512 a148cda6ac97935d51ede1bbacf847d7d2cba8861cf3941d32e3da2f45f16dcc05b20845b63d4264692520db8329e1236cf2bc4fd8ccbe6e40921bbbdeb2cb1c
+DIST readline80-002 1401 BLAKE2B a2f511272f6d651208469998330059d6bae17bb8b704b64468685bb0368b76df1ca5b1dcd8e5cb0019e80932130c8a92fd1a305679bf79f0b801532a94c4b4ae SHA512 a941d142a59fe592cc45c1cf4d416e2fc0ab543dd6a0496fb8b2ec6f651cedd6fb9e0c105f14880700b69b2d6912653b3f66371e45cbe4adc0cc9554801afd3c
+DIST readline80-003 2158 BLAKE2B d8910aef1b796a59500b255df8db71ad1738dd164fd69827759eade74b6d9806ecd364839cfa904fc2f2d48352342155f670e5ec43aac0693f36820fb7139a4d SHA512 85235fca047b4ac87b846d998fffc67ae67ed365b068fd2743e84f11fd00086f85e622955192e07e3560965e32ff5f6d014e0146cde528fb0d0f7b5b829875ca
+DIST readline80-004 1275 BLAKE2B ac260bab163f17ccc783e0c2a21351b05e9e86ad973383d228d10ec749f265df8588c38946c9da15e987192b50f1bcb81141c2f4e171f65455f58521e864a534 SHA512 301ced2361e7583468f9932038936387a016c20d1c41966658a78c7f7c48c70308bf66b3228de0a3c6fc880427b6a90ee1ac4d2693daed432e5ae970671a7461
diff --git a/sys-libs/readline/files/readline-5.0-no_rpath.patch b/sys-libs/readline/files/readline-5.0-no_rpath.patch
index 624b2d7..befad63 100644
--- a/sys-libs/readline/files/readline-5.0-no_rpath.patch
+++ b/sys-libs/readline/files/readline-5.0-no_rpath.patch
@@ -1,7 +1,7 @@
 ripped from Fedora
 
---- support/shobj-conf
-+++ support/shobj-conf
+--- a/support/shobj-conf
++++ b/support/shobj-conf
 @@ -102,7 +102,7 @@
  	SHOBJ_LD='${CC}'
  	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
diff --git a/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch b/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch
deleted file mode 100644
index fc63491..0000000
--- a/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-dont ignore errors in the shlib subdir
-
-http://bugs.gentoo.org/216952
-
---- Makefile.in
-+++ Makefile.in
-@@ -194,7 +194,7 @@
- 
- shared:	force
- 	-test -d shlib || mkdir shlib
--	-( cd shlib ; ${MAKE} ${MFLAGS} all )
-+	( cd shlib ; ${MAKE} ${MFLAGS} all )
- 
- documentation: force
- 	-test -d doc || mkdir doc
-@@ -238,7 +238,7 @@
- 	-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
- 
- install-shared: installdirs install-headers shared install-doc
--	-( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
-+	( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
- 	
- uninstall-shared: maybe-uninstall-headers
- 	-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
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
index 8bf2994..23d7850 100644
--- 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
@@ -1,3 +1,5 @@
+https://lists.gnu.org/archive/html/bug-bash/2014-08/msg00082.html
+
 From 2774192e93991e3d85ccc37c714aa018e442af6d Mon Sep 17 00:00:00 2001
 From: Dylan Cali <calid1984@gmail.com>
 Date: Sat, 23 Aug 2014 02:26:05 -0500
diff --git a/sys-libs/readline/files/readline-7.0-headers.patch b/sys-libs/readline/files/readline-7.0-headers.patch
new file mode 100644
index 0000000..892ec21
--- /dev/null
+++ b/sys-libs/readline/files/readline-7.0-headers.patch
@@ -0,0 +1,24 @@
+From 4bc0aa68aff12a59628dd3c99a53360a9aa1ce93 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 11 Aug 2016 17:49:27 +0800
+Subject: [PATCH] include ctype.h for isdigit usage
+
+---
+ lib/readline/histexpand.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c
+index 46a99aa62e30..13248db83048 100644
+--- a/histexpand.c
++++ b/histexpand.c
+@@ -26,6 +26,7 @@
+ #endif
+ 
+ #include <stdio.h>
++#include <ctype.h>
+ 
+ #if defined (HAVE_STDLIB_H)
+ #  include <stdlib.h>
+-- 
+2.9.0
+
diff --git a/sys-libs/readline/files/readline-8.0-headers.patch b/sys-libs/readline/files/readline-8.0-headers.patch
new file mode 100644
index 0000000..f19a3b1
--- /dev/null
+++ b/sys-libs/readline/files/readline-8.0-headers.patch
@@ -0,0 +1,17 @@
+Required by bash-5.0 or else compilation fails:
+
+ bashline.c:69:10: fatal error: readline/rlmbutil.h: No such file or directory
+  #include <readline/rlmbutil.h>
+           ^~~~~~~~~~~~~~~~~~~~~
+
+--- readline-8.0/Makefile.in
++++ readline-8.0/Makefile.in
+@@ -153,7 +153,7 @@
+ CREATED_TAGS = TAGS tags
+ 
+ INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
+-		    rlstdc.h rlconf.h rltypedefs.h
++		    rlstdc.h rlconf.h rltypedefs.h rlmbutil.h
+ 
+ OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/INSTALL $(srcdir)/README
+ OTHER_INSTALLED_DOCS = CHANGES INSTALL README
diff --git a/sys-libs/readline/metadata.xml b/sys-libs/readline/metadata.xml
index d1a0fab..6bce632 100644
--- a/sys-libs/readline/metadata.xml
+++ b/sys-libs/readline/metadata.xml
@@ -1,9 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-<herd>base-system</herd>
+<maintainer type="project">
+	<email>base-system@gentoo.org</email>
+	<name>Gentoo Base System</name>
+</maintainer>
 <use>
-	<flag name='utils'>Install rlfe (ReadLine Front-End) helper tool -- a wrapper program for making any stdin use readline</flag>
+	<flag name="utils">Install rlfe (ReadLine Front-End) helper tool -- a wrapper program for making any stdin use readline</flag>
 </use>
 <upstream>
 	<remote-id type="cpe">cpe:/a:gnu:readline</remote-id>
diff --git a/sys-libs/readline/readline-6.3_p8-r2.ebuild b/sys-libs/readline/readline-6.3_p8-r3.ebuild
similarity index 83%
rename from sys-libs/readline/readline-6.3_p8-r2.ebuild
rename to sys-libs/readline/readline-6.3_p8-r3.ebuild
index ae2910a..edc039c 100644
--- a/sys-libs/readline/readline-6.3_p8-r2.ebuild
+++ b/sys-libs/readline/readline-6.3_p8-r3.ebuild
@@ -1,10 +1,9 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/readline/readline-6.3_p8-r2.ebuild,v 1.9 2015/05/27 04:44:00 jer Exp $
 
-EAPI=4
+EAPI=5
 
-inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal preserve-libs usr-ldscript
 
 # Official patches
 # See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
@@ -29,7 +28,7 @@
 }
 
 DESCRIPTION="Another cute console display library"
-HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html"
 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
 
 LICENSE="GPL-3"
@@ -37,26 +36,26 @@
 KEYWORDS="*"
 IUSE="static-libs utils"
 
-RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
-	abi_x86_32? (
-		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
-		!<=app-emulation/emul-linux-x86-baselibs-20131008-r7
-	)"
+RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}]"
 DEPEND="${RDEPEND}
 	virtual/pkgconfig"
 
 S=${WORKDIR}/${MY_P}
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.0-no_rpath.patch
+	"${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+	"${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
+	"${FILESDIR}"/${PN}-6.3-read-eof.patch
+)
+
 src_unpack() {
 	unpack ${MY_P}.tar.gz
 }
 
 src_prepare() {
 	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
-	epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
-	epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
-	epatch "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
-	epatch "${FILESDIR}"/${PN}-6.3-read-eof.patch
+	epatch "${PATCHES[@]}"
 
 	# Force ncurses linking. #71420
 	# Use pkg-config to get the right values. #457558
@@ -78,7 +77,7 @@
 src_configure() {
 	# fix implicit decls with widechar funcs
 	append-cppflags -D_GNU_SOURCE
-	# http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+	# https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
 	append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
 
 	# Make sure configure picks a better ar than `ar`. #484866
@@ -107,7 +106,7 @@
 	ECONF_SOURCE=${S} \
 	econf \
 		--cache-file="${BUILD_DIR}"/config.cache \
-		--docdir=/usr/share/doc/${PF} \
+		--docdir='$(datarootdir)'/doc/${PF} \
 		--with-curses \
 		$(use_enable static-libs static)
 
diff --git a/sys-libs/readline/readline-6.3_p8-r2.ebuild b/sys-libs/readline/readline-8.0_p4.ebuild
similarity index 61%
copy from sys-libs/readline/readline-6.3_p8-r2.ebuild
copy to sys-libs/readline/readline-8.0_p4.ebuild
index ae2910a..530bd1c 100644
--- a/sys-libs/readline/readline-6.3_p8-r2.ebuild
+++ b/sys-libs/readline/readline-8.0_p4.ebuild
@@ -1,17 +1,16 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/readline/readline-6.3_p8-r2.ebuild,v 1.9 2015/05/27 04:44:00 jer Exp $
 
-EAPI=4
+EAPI=7
 
-inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+inherit flag-o-matic multilib-minimal preserve-libs toolchain-funcs usr-ldscript
 
 # Official patches
-# See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
-PLEVEL=${PV##*_p}
-MY_PV=${PV/_p*}
-MY_PV=${MY_PV/_/-}
-MY_P=${PN}-${MY_PV}
+# See ftp://ftp.cwru.edu/pub/bash/readline-7.0-patches/
+PLEVEL="${PV##*_p}"
+MY_PV="${PV/_p*}"
+MY_PV="${MY_PV/_/-}"
+MY_P="${PN}-${MY_PV}"
 [[ ${PV} != *_p* ]] && PLEVEL=0
 patches() {
 	[[ ${PLEVEL} -eq 0 ]] && return 1
@@ -29,38 +28,50 @@
 }
 
 DESCRIPTION="Another cute console display library"
-HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
-SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html"
+
+case ${PV} in
+	*_alpha*|*_beta*|*_rc*)
+		SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz"
+	;;
+	*)
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+	;;
+esac
 
 LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="*"
-IUSE="static-libs utils"
+SLOT="0/8"  # subslot matches SONAME major
+KEYWORDS="~*"
+IUSE="static-libs +unicode utils"
 
-RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
-	abi_x86_32? (
-		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
-		!<=app-emulation/emul-linux-x86-baselibs-20131008-r7
-	)"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig"
+RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[static-libs?,unicode?,${MULTILIB_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	virtual/pkgconfig
+"
 
-S=${WORKDIR}/${MY_P}
+S="${WORKDIR}/${MY_P}"
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.0-no_rpath.patch
+	"${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+	"${FILESDIR}"/${PN}-7.0-headers.patch
+	"${FILESDIR}"/${PN}-8.0-headers.patch
+)
+
+# Needed because we don't want the patches being unpacked
+# (which emits annoying and useless error messages)
 src_unpack() {
 	unpack ${MY_P}.tar.gz
 }
 
 src_prepare() {
-	[[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
-	epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
-	epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
-	epatch "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
-	epatch "${FILESDIR}"/${PN}-6.3-read-eof.patch
+	[[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
+	default
 
 	# Force ncurses linking. #71420
 	# Use pkg-config to get the right values. #457558
-	local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
+	local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses$(usex unicode w '') --libs)
 	sed -i \
 		-e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
 		support/shobj-conf || die
@@ -72,13 +83,13 @@
 	# objformat for years, so we don't want to rely on that.
 	sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
 
-	ln -s ../.. examples/rlfe/readline # for local readline headers
+	ln -s ../.. examples/rlfe/readline || die # for local readline headers
 }
 
 src_configure() {
 	# fix implicit decls with widechar funcs
 	append-cppflags -D_GNU_SOURCE
-	# http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+	# https://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
 	append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
 
 	# Make sure configure picks a better ar than `ar`. #484866
@@ -91,7 +102,7 @@
 	# In cases where the C library doesn't support wide characters, readline
 	# itself won't work correctly, so forcing the answer below should be OK.
 	if tc-is-cross-compiler ; then
-		export bash_cv_func_sigsetjmp='present'
+		use kernel_Winnt || export bash_cv_func_sigsetjmp='present'
 		export bash_cv_func_ctype_nonascii='yes'
 		export bash_cv_wcwidth_broken='no' #503312
 	fi
@@ -104,18 +115,18 @@
 }
 
 multilib_src_configure() {
-	ECONF_SOURCE=${S} \
-	econf \
-		--cache-file="${BUILD_DIR}"/config.cache \
-		--docdir=/usr/share/doc/${PF} \
-		--with-curses \
+	local myeconfargs=(
+		--cache-file="${BUILD_DIR}"/config.cache
+		--with-curses
 		$(use_enable static-libs static)
+	)
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
 
 	if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
 		# code is full of AC_TRY_RUN()
 		mkdir -p examples/rlfe || die
 		cd examples/rlfe || die
-		ECONF_SOURCE=${S}/examples/rlfe \
+		ECONF_SOURCE="${S}"/examples/rlfe \
 		econf --cache-file="${BUILD_DIR}"/config.cache
 	fi
 }
@@ -128,8 +139,8 @@
 		cd examples/rlfe || die
 		local l
 		for l in readline history ; do
-			ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
-			ln -sf ../../lib${l}.a lib${l}.a
+			ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname) || die
+			ln -s ../../lib${l}.a lib${l}.a || die
 		done
 		emake
 	fi
@@ -148,17 +159,17 @@
 }
 
 multilib_src_install_all() {
-	einstalldocs
+	HTML_DOCS="doc/history.html doc/readline.html doc/rluserman.html" einstalldocs
 	dodoc USAGE
-	dohtml -r doc/.
 	docinto ps
 	dodoc doc/*.ps
 }
-
 pkg_preinst() {
-	preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
+	# bug #29865
+	# Reappeared in #595324 with paludis so keeping this for now...
+	preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5,6,7}
 }
 
 pkg_postinst() {
-	preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
+	preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5,6,7}
 }