commit:     85eba6f45253bfbb0e3797e2c4c71f5a4162a088
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  4 04:52:04 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr  4 06:32:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85eba6f4

games-puzzle/xwelltris: port to EAPI 7, games.eclass--

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/xwelltris-1.0.1-scorefile-dir.patch      | 16 +++++++
 games-puzzle/xwelltris/xwelltris-1.0.1.ebuild      | 52 ++++++++++++++++------
 2 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/games-puzzle/xwelltris/files/xwelltris-1.0.1-scorefile-dir.patch 
b/games-puzzle/xwelltris/files/xwelltris-1.0.1-scorefile-dir.patch
new file mode 100644
index 00000000000..67f832ae372
--- /dev/null
+++ b/games-puzzle/xwelltris/files/xwelltris-1.0.1-scorefile-dir.patch
@@ -0,0 +1,16 @@
+--- a/src/commonfuncs.cxx
++++ b/src/commonfuncs.cxx
+@@ -41,7 +41,12 @@ bool find_full_path_for_file(char* name, char* 
ret_full_pathname, FMode mode)
+ 
+   do 
+   {    
+-    sprintf(ret_full_pathname,"%s/%s",GLOBAL_SEARCH,name); //First check in 
GLOBAL_SEARCH dir
++    
sprintf(ret_full_pathname,"%s/%s","@GENTOO_PORTAGE_EPREFIX@/var/lib/xwelltris",name);
 // First check in /var/lib/xwelltris
++    fd=open(ret_full_pathname,fmode);
++    if(fd>0)
++      break;
++
++    sprintf(ret_full_pathname,"%s/%s",GLOBAL_SEARCH,name); // Then in 
GLOBAL_SEARCH dir
+     fd=open(ret_full_pathname,fmode);
+     if(fd>0)
+       break;

diff --git a/games-puzzle/xwelltris/xwelltris-1.0.1.ebuild 
b/games-puzzle/xwelltris/xwelltris-1.0.1.ebuild
index eb2e02cbf21..36c39e67014 100644
--- a/games-puzzle/xwelltris/xwelltris-1.0.1.ebuild
+++ b/games-puzzle/xwelltris/xwelltris-1.0.1.ebuild
@@ -1,8 +1,9 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
-inherit games
+EAPI=7
+
+inherit toolchain-funcs prefix
 
 DESCRIPTION="2.5D tetris like game"
 HOMEPAGE="http://xnc.jinr.ru/xwelltris/";
@@ -11,24 +12,41 @@ SRC_URI="http://xnc.jinr.ru/xwelltris/src/${P}.src.tar.gz";
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE=""
 
-DEPEND="media-libs/libsdl[video]
-       media-libs/sdl-image[gif]"
-RDEPEND=${DEPEND}
+DEPEND="
+       media-libs/libsdl[video]
+       media-libs/sdl-image[gif]
+"
+RDEPEND="
+       ${DEPEND}
+       acct-group/gamestat
+"
+
+PATCHES=(
+       # Look in ${EPREFIX}/var/lib/xwelltris for score file
+       "${FILESDIR}"/${PN}-1.0.1-scorefile-dir.patch
+)
 
 src_prepare() {
+       default
+
        sed -i \
                -e '/INSTALL_PROGRAM/s/-s //' \
                src/Make.common.in || die
+
        sed -i \
-               -e "/GLOBAL_SEARCH/s:\".*\":\"${GAMES_DATADIR}/${PN}\":" \
+               -e "/GLOBAL_SEARCH/s:\".*\":\"/usr/share/${PN}\":" \
                src/include/globals.h.in || die
+
+       # Ensure we look in ${EPREFIX}/var/lib/${PN} for score file
+       eprefixify src/commonfuncs.cxx
 }
 
 src_configure() {
+       tc-export CC CXX
+
        # configure/build process is pretty messed up
-       egamesconf --with-sdl
+       econf --with-sdl
 }
 
 src_compile() {
@@ -36,11 +54,19 @@ src_compile() {
 }
 
 src_install() {
-       dodir "${GAMES_BINDIR}" "${GAMES_DATADIR}/${PN}" /usr/share/man
+       dodir /usr/bin /usr/share/${PN} /var/lib/${PN} /usr/share/man
+
        emake install \
-               INSTDIR="${D}/${GAMES_BINDIR}" \
-               INSTLIB="${D}/${GAMES_DATADIR}/${PN}" \
+               INSTDIR="${D}/usr/bin" \
+               INSTLIB="${D}/usr/share/${PN}" \
                INSTMAN=/usr/share/man
+
        dodoc AUTHORS Changelog README*
-       prepgamesdirs
+
+       # Move score file to our location
+       mv "${ED}"/usr/share/${PN}/welltris.scores 
"${ED}"/var/lib/${PN}/welltris.scores || die
+
+       fowners root:gamestat /var/lib/${PN}/welltris.scores
+       fperms 660 /var/lib/${PN}/welltris.scores
+       fperms g+s /usr/bin/${PN}
 }

Reply via email to