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

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2021-04-04 06:32:43 +00:00
parent 1e399a9e5d
commit 85eba6f452
2 changed files with 55 additions and 13 deletions
@@ -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;
+39 -13
View File
@@ -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}
}