commit:     bfdfce2c5717f2fc7a13713dedf92e3141292ce3
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 21 02:53:51 2021 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu Oct 21 03:38:19 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfdfce2c

games-strategy/tornado: simplify patch and support prefix

Manual install rather than a 13kB patch that adds DESTDIR
everywhere and ignored EPREFIX.

Also made nls unconditional as it uses libintl.h either way
(but allowing selection through plocale.eclass).

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../tornado/files/tornado-1.4-make.patch           | 19 +++++++++
 games-strategy/tornado/tornado-1.4-r3.ebuild       | 45 +++++++++++++++-------
 2 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/games-strategy/tornado/files/tornado-1.4-make.patch 
b/games-strategy/tornado/files/tornado-1.4-make.patch
new file mode 100644
index 00000000000..1dc2ac70344
--- /dev/null
+++ b/games-strategy/tornado/files/tornado-1.4-make.patch
@@ -0,0 +1,19 @@
+Respect flags and use pkg-config.
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,2 @@
+-CC = gcc
+-MAKE = make
+-LDFLAGS = -lncurses
++LIBS := $(shell $(PKG_CONFIG) --libs ncurses) $(LIBS)
+ OBJFILES = main.o draw.o erwin.o network.o scores.o
+@@ -6,3 +4,3 @@
+ LOCALEPATH = /usr/local/share/locale
+-CFLAGS = -Wall -O2 -DPREFIX="\"$(PREFIX)\"" 
++CFLAGS := $(CFLAGS) -Wall -DPREFIX="\"$(PREFIX)\"" 
-DLOCALEPATH="\"$(LOCALEPATH)\"" $(shell $(PKG_CONFIG) --cflags ncurses) 
$(CPPFLAGS)
+ VERSION = `grep " VERSION" version.h | sed s/\"//g | sed s/\#define\ VERSION\ 
//`
+@@ -27,3 +25,3 @@
+ tornado: $(OBJFILES)
+-      $(CC) $(LDFLAGS) $(OBJFILES) -o tornado
++      $(CC) $(LDFLAGS) $(OBJFILES) -o tornado $(LIBS)
+ 

diff --git a/games-strategy/tornado/tornado-1.4-r3.ebuild 
b/games-strategy/tornado/tornado-1.4-r3.ebuild
index 082cbe23940..290d8ba7825 100644
--- a/games-strategy/tornado/tornado-1.4-r3.ebuild
+++ b/games-strategy/tornado/tornado-1.4-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit toolchain-funcs
+inherit plocale toolchain-funcs
 
 DESCRIPTION="Clone of a C64 game - destroy the opponent's house"
 HOMEPAGE="https://github.com/kouya/tornado";
@@ -12,34 +12,53 @@ 
SRC_URI="https://github.com/kouya/tornado/archive/v${PV}.tar.gz -> ${P}.tar.gz"
 LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="nls"
 
 RDEPEND="
        acct-group/gamestat
        sys-libs/ncurses:=
-       nls? ( virtual/libintl )"
+       virtual/libintl"
 DEPEND="${RDEPEND}"
 BDEPEND="
        virtual/pkgconfig
-       nls? ( sys-devel/gettext )"
+       sys-devel/gettext"
 
 PATCHES=(
-       "${FILESDIR}"/${P}-r2-gentoo.patch
+       "${FILESDIR}"/${P}-make.patch
 )
 
-src_configure() {
-       if ! use nls; then
-               sed -i \
-                       -e '/^all:/s|locales||g' \
-                       -e '/^install:/s|install-locale-data||g' \
-                       Makefile || die
-       fi
+src_prepare() {
+       default
+
+       sed -i "/SCOREFILE_NAME/s|/|${EPREFIX}/|" scores.h || die
+}
 
+src_compile() {
        tc-export CC PKG_CONFIG
+
+       emake PREFIX="${EPREFIX}/usr" LOCALEPATH="${EPREFIX}/usr/share/locale"
 }
 
 src_install() {
-       default
+       dobin tornado
+       doman doc/man/tornado.6
+
+       einstalldocs
+
+       tornado_man() {
+               doman -i18n=${1} doc/man/${1}/${PN}.6
+       }
+       local PLOCALES="de fr it nl no ru"
+       plocale_for_each_locale tornado_man
+
+       tornado_loc() {
+               insinto /usr/share/locale/${1}/LC_MESSAGES
+               newins po/${1}.mo ${PN}.mo
+       }
+       PLOCALES+=" es pt"
+       plocale_for_each_locale tornado_loc
+
+       insinto /var/games
+       doins ${PN}.scores
 
        fowners :gamestat /usr/bin/${PN} /var/games/${PN}.scores
        fperms g+s /usr/bin/${PN}

Reply via email to