From 07be334a4680b5ba27fbe0c269c62911815f70a2 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Sat, 26 Jul 2025 23:47:22 +0300
Subject: app-text/ispell: EAPI bump 7->8 + several changes

* fix SRC_URI & HOMEPAGE
* add USE="tinfo"
* simplify ebuild logic

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 .../ispell/files/ispell-3.4.00-fix-DESTDIR.patch   | 12 +++++
 app-text/ispell/ispell-3.4.00-r1.ebuild            | 62 ++++++++++++++++++++++
 app-text/ispell/ispell-3.4.00.ebuild               | 58 --------------------
 app-text/ispell/metadata.xml                       |  4 +-
 4 files changed, 77 insertions(+), 59 deletions(-)
 create mode 100644 app-text/ispell/files/ispell-3.4.00-fix-DESTDIR.patch
 create mode 100644 app-text/ispell/ispell-3.4.00-r1.ebuild
 delete mode 100644 app-text/ispell/ispell-3.4.00.ebuild

diff --git a/app-text/ispell/files/ispell-3.4.00-fix-DESTDIR.patch b/app-text/ispell/files/ispell-3.4.00-fix-DESTDIR.patch
new file mode 100644
index 00000000..57b74da7
--- /dev/null
+++ b/app-text/ispell/files/ispell-3.4.00-fix-DESTDIR.patch
@@ -0,0 +1,12 @@
+Remove an undesirable $DESTDIR
+--- ispell-3.4.00.orig/Makefile	2025-07-27 01:43:40.008412599 +0300
++++ ispell-3.4.00/Makefile	2025-07-27 01:43:58.615432149 +0300
+@@ -419,7 +419,7 @@
+ 	  cd $(DESTDIR)$$LIBDIR; \
+ 	  if [ $$MASTERHASH != $$DEFHASH ]; then \
+ 	    rm -f $$DEFHASH; \
++	    $$LINK -s $$MASTERHASH $$DEFHASH; \
+-	    $$LINK -s $(DESTDIR)$$MASTERHASH $$DEFHASH; \
+ 	  fi
+ 
+ munchable:	findaffix tryaffix munchlist buildhash ispell icombine
diff --git a/app-text/ispell/ispell-3.4.00-r1.ebuild b/app-text/ispell/ispell-3.4.00-r1.ebuild
new file mode 100644
index 00000000..e8ad62dd
--- /dev/null
+++ b/app-text/ispell/ispell-3.4.00-r1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2022 Gentoo Authors and Martin V\"ath
+# Copyright 2020-2025 The Trinity Desktop Project
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+inherit toolchain-funcs
+
+DESCRIPTION="fast screen-oriented spelling checker"
+HOMEPAGE="https://www.cs.hmc.edu/~geoff/ispell.html"
+SRC_URI="https://www.cs.hmc.edu/~geoff/tars/${P}.tar.gz"
+
+LICENSE="HPND"
+SLOT="0/${PV}"
+KEYWORDS="~alpha amd64 ~arm hppa ~mips ppc sparc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="+tinfo"
+
+# Don't use Gentoo mirrors
+RESTRICT="mirror"
+
+RDEPEND="
+	sys-apps/miscfiles
+	sys-libs/ncurses:0=[tinfo=]
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/${P}-fix-DESTDIR.patch"
+)
+
+src_prepare() {
+	default
+
+	# Avoid stripping binaries
+	sed -i -e '/^\s*strip/d' Makefile deformatters/Makefile nextispell/Makefile
+
+	sed -i \
+		-e 's:/usr/local/man:'"${EPREFIX}"'/usr/share/man:' \
+		-e 's:/usr/local/lib:'"${EPREFIX}"'/usr/'"$(get_libdir)/${PN}:" \
+		-e 's:/usr/local:'"${EPREFIX}"'/usr:' \
+		-- local.h.* || die
+}
+
+src_configure() {
+	local sed_opts=(
+		-e 's:\(^#define CC\).*:\1 "'"$(tc-getCC)"'":'
+		-e 's:\(^#define CFLAGS\).*:\1 "'"${CFLAGS}"'":'
+	)
+	use tinfo && sed_opts+=( -e 's:\(^#define TERMLIB\).*:\1 "-ltinfo":' )
+	sed -i "${sed_opts[@]}" -- config.X || die
+
+	emake -j1 config.sh
+}
+
+src_compile() {
+	emake -j1
+}
+
+src_install() {
+	emake -j1 install DESTDIR="$D"
+	einstalldocs
+}
diff --git a/app-text/ispell/ispell-3.4.00.ebuild b/app-text/ispell/ispell-3.4.00.ebuild
deleted file mode 100644
index aed37528..00000000
--- a/app-text/ispell/ispell-3.4.00.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors and Martin V\"ath
-# Copyright 2020 The Trinity Desktop Project
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-inherit toolchain-funcs
-
-# Don't use Gentoo mirrors
-RESTRICT="mirror"
-
-DESCRIPTION="fast screen-oriented spelling checker"
-HOMEPAGE="http://fmg-www.cs.ucla.edu/geoff/ispell.html"
-SRC_URI="http://fmg-www.cs.ucla.edu/geoff/tars/${P}.tar.gz"
-
-LICENSE="HPND"
-SLOT="0/3.4.00"
-KEYWORDS="~alpha amd64 ~arm hppa ~mips ppc sparc x86 ~amd64-linux ~x86-linux ~ppc-macos"
-
-RDEPEND="
-	sys-apps/miscfiles
-	sys-libs/ncurses:0=
-"
-DEPEND="${RDEPEND}"
-
-src_prepare() {
-	sed -i \
-		-e 's:/usr/local/man:'"${EPREFIX}"'/usr/share/man:' \
-		-e 's:/usr/local/lib:'"${EPREFIX}"'/usr/'"$(get_libdir)/${PN}:" \
-		-e 's:/usr/local:'"${EPREFIX}"'/usr:' \
-		-- "${S}"/local.h.* || die
-	sed -i \
-		-e 's:\(^#define CC\).*:\1 "'"$(tc-getCC)"'":' \
-		-e 's:\(^#define CFLAGS\).*:\1 "'"-ltinfo ${CFLAGS}"'":' \
-		-- "${S}"/config.X || die
-	default
-}
-
-src_configure() {
-	# Prepare config.sh for installation phase to avoid twice rebuild
-	emake -j1 config.sh
-	sed \
-		-e "s:^\(BINDIR='\)${EPREFIX}\(/usr.*\):\1${ED}\2:" \
-		-e "s:^\(LIBDIR='\)${EPREFIX}\(/usr.*\):\1${ED}\2:" \
-		-e "s:^\(MAN1DIR='\)${EPREFIX}\(/usr.*\):\1${ED}\2:" \
-		-e "s:^\(MAN45DIR='\)${EPREFIX}\(/usr.*\):\1${ED}\2:" \
-			< config.sh > config.sh.install
-}
-
-src_compile() {
-	emake -j1
-}
-
-src_install() {
-	mv config.sh.install config.sh
-	emake -j1 install
-	dodoc CHANGES Contributors README WISHES
-}
diff --git a/app-text/ispell/metadata.xml b/app-text/ispell/metadata.xml
index 7a38bb90..c389fb06 100644
--- a/app-text/ispell/metadata.xml
+++ b/app-text/ispell/metadata.xml
@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-	<!-- maintainer-needed -->
+  <use>
+    <flag name="tinfo">Whether to support (and require) sys-libs/ncurses[tinfo].</flag>
+  </use>
 </pkgmetadata>
-- 
cgit v1.2.3

