games-puzzle/twindistress: Port to EAPI 7
authorDavid Seifert <soap@gentoo.org>
Sun, 23 Feb 2020 11:21:01 +0000 (12:21 +0100)
committerDavid Seifert <soap@gentoo.org>
Sun, 23 Feb 2020 11:21:01 +0000 (12:21 +0100)
Closes: https://bugs.gentoo.org/710556
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: David Seifert <soap@gentoo.org>
games-puzzle/twindistress/files/twindistress-1.1.0-ldflags.patch
games-puzzle/twindistress/twindistress-1.1.0.ebuild

index 0ac589d88368b4cad764f41f2b77e45b0fc136d0..1a77572836d22682c180d3edecc3bb2dadf17b17 100644 (file)
@@ -1,6 +1,32 @@
---- Makefile.old       2010-10-19 09:06:48.000000000 +0200
-+++ Makefile   2010-10-19 09:06:59.000000000 +0200
-@@ -50,7 +50,7 @@
+--- a/Makefile
++++ b/Makefile
+@@ -2,20 +2,20 @@
+ BIN_PREFIX = /usr/local/bin/
+ # if you don't have privileges to install systemwide, comment out both 
+ # lines below and the game will then play from the current directory
+-DATA_PREFIX = /usr/local/share/games/twind/
+-HIGH_SCORE_PREFIX = /var/lib/games/twind/
++DATA_PREFIX = $(EPREFIX)/usr/share/twindistress/
++HIGH_SCORE_PREFIX = $(EPREFIX)/var/lib/twindistress/
+ # uncomment out the EXTENSION if you don't have the png libs on your system
+ #EXTENSION = ".bmp"
+ AUDIOFLAG = AUDIO
+-CC = gcc
+ ifdef EXTENSION
+-CFLAGS = -Wall -g -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
++CPPFLAGS += -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
+       -DEXTENSION=\"$(EXTENSION)\" -D$(AUDIOFLAG) -DLINUX \
+       -DHIGH_SCORE_PREFIX=\"$(HIGH_SCORE_PREFIX)\"
+ else
+-CFLAGS = -Wall -g -DDATA_PREFIX=\"$(DATA_PREFIX)\" -D$(AUDIOFLAG) -DLINUX \
++CPPFLAGS += -DDATA_PREFIX=\"$(DATA_PREFIX)\" -D$(AUDIOFLAG) -DLINUX \
+       -DHIGH_SCORE_PREFIX=\"$(HIGH_SCORE_PREFIX)\"
+ endif
++CFLAGS += -Wall
+ LIBS = -lm
+ SDL_CFLAGS = `sdl-config --cflags`
+ SDL_LIBS = `sdl-config --libs` -lSDL_image
+@@ -50,10 +50,10 @@
        make twind MIXER_LIB= AUDIOFLAG=NOAUDIO
        
  twind: twind.o
@@ -8,4 +34,8 @@
 +      $(CC) $(LDFLAGS) twind.o $(LIBS) $(SDL_LIBS) $(MIXER_LIB) -o twind
  
  twind.o: twind.c
-       $(CC) $(CFLAGS) $(SDL_CFLAGS) -c twind.c
+-      $(CC) $(CFLAGS) $(SDL_CFLAGS) -c twind.c
++      $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c twind.c
+ clean:
+       rm -f twind *.o
index cdc2969857507ca6b0041b29e18d7509da26c24b..cc4e08909d2010f7a226d5b7339916050003a010 100644 (file)
@@ -1,10 +1,12 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
-inherit eutils games
+EAPI=7
+
+inherit desktop toolchain-funcs
 
 MY_P="twind-${PV}"
+
 DESCRIPTION="Match and remove all of the blocks before time runs out"
 HOMEPAGE="http://twind.sourceforge.net/"
 SRC_URI="mirror://sourceforge/twind/${MY_P}.tar.gz"
@@ -12,48 +14,37 @@ SRC_URI="mirror://sourceforge/twind/${MY_P}.tar.gz"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE=""
-
-DEPEND="media-libs/libsdl[video]
-       media-libs/sdl-mixer
-       media-libs/sdl-image[png]"
-RDEPEND="${DEPEND}"
-
-S=${WORKDIR}/${MY_P}
-
-src_prepare() {
-       sed -i \
-               -e '/^CC/d' \
-               -e "/^CFLAGS/s:-g:${CFLAGS}:" \
-               -e "/^DATA_PREFIX/s:/.*$:${GAMES_DATADIR}/${PN}/:" \
-               -e "/^HIGH_SCORE_PREFIX/s:/.*$:${GAMES_STATEDIR}/${PN}/:" \
-               Makefile || die "sed failed"
-       epatch \
-               "${FILESDIR}"/${P}-ldflags.patch \
-               "${FILESDIR}"/${P}-warnings.patch
+
+RDEPEND="
+       media-libs/libsdl[video]
+       media-libs/sdl-image[png]
+       media-libs/sdl-mixer[vorbis]"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-ldflags.patch
+       "${FILESDIR}"/${P}-warnings.patch
+)
+
+src_configure() {
+       tc-export CC
 }
 
 src_install() {
-       dogamesbin twind
+       dobin twind
 
-       insinto "${GAMES_DATADIR}/${PN}"
+       insinto /usr/share/twindistress
        doins -r graphics music sound
 
        doicon graphics/twind.png
        make_desktop_entry twind "Twin Distress"
 
-       dodoc AUTHORS ChangeLog CREDITS NEWS README TODO
-
-       dodir "${GAMES_STATEDIR}/${PN}"
-       touch "${D}/${GAMES_STATEDIR}/${PN}/twind.hscr"
-       fperms 660 "${GAMES_STATEDIR}/${PN}/twind.hscr"
-       prepgamesdirs
-}
+       einstalldocs
 
-pkg_postinst() {
-       games_pkg_postinst
-       if ! has_version "media-libs/sdl-mixer[vorbis]" ; then
-               ewarn "Music support will be disabled since sdl-mixer"
-               ewarn "wasn't built with USE=vorbis"
-       fi
+       dodir /var/lib/twindistress/
+       touch "${ED}"/var/lib/twindistress/twind.hscr || die
+       fowners root:users /var/lib/twindistress/twind.hscr
+       fperms 660 /var/lib/twindistress/twind.hscr
 }