commit:     fb26b7576fa158a1826b0984e2734f3be991740e
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 13 04:31:19 2021 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 13 04:33:00 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb26b757

games-action/chickens: EAPI6->8, fix build and runtime

Closes: https://bugs.gentoo.org/638246
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 games-action/chickens/chickens-0.2.4-r1.ebuild     | 76 +++++++++++++---------
 .../chickens/files/chickens-0.2.4-bitmap.patch     | 33 ++++++++++
 .../chickens/files/chickens-0.2.4-settings.patch   | 33 ++++++++++
 3 files changed, 110 insertions(+), 32 deletions(-)

diff --git a/games-action/chickens/chickens-0.2.4-r1.ebuild 
b/games-action/chickens/chickens-0.2.4-r1.ebuild
index 4aa9dc2a0d8..2c0b8e41b96 100644
--- a/games-action/chickens/chickens-0.2.4-r1.ebuild
+++ b/games-action/chickens/chickens-0.2.4-r1.ebuild
@@ -1,62 +1,74 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
 
-inherit desktop
+inherit desktop flag-o-matic toolchain-funcs
 
 MY_P="ChickensForLinux-Linux-${PV}"
+
 DESCRIPTION="Target chickens with rockets and shotguns. Funny"
 HOMEPAGE="http://www.chickensforlinux.com/";
 SRC_URI="http://www.chickensforlinux.com/${MY_P}.tar.gz";
+S="${WORKDIR}/${PN}"
 
 LICENSE="all-rights-reserved"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE=""
-RESTRICT="mirror bindist"
+RESTRICT="bindist mirror"
 
-DEPEND="acct-group/gamestat
-       <media-libs/allegro-5"
-RDEPEND="${DEPEND}"
+RDEPEND="
+       acct-group/gamestat
+       media-libs/allegro:0[X]"
+DEPEND="${RDEPEND}"
 
-S=${WORKDIR}/${PN}
+PATCHES=(
+       "${FILESDIR}"/${P}-bitmap.patch
+       "${FILESDIR}"/${P}-settings.patch
+)
 
 src_prepare() {
        default
 
-       sed -i \
-               -e "s:HighScores:/var/games//${PN}/HighScores:" \
-               -e "s:....\(.\)\(_\)\(.*.4x0\)\(.\):M\4\2\x42\x6Fn\1s\2:" \
-               highscore.cpp HighScores || die
-       sed -i \
-               -e "s:options.cfg:/etc/${PN}/options.cfg:" \
-               -e "s:\"sound/:\"/usr/share/${PN}/sound/:" \
-               -e "s:\"dat/:\"/usr/share/${PN}/dat/:" \
-               main.cpp README || die
-       sed -i \
-               -e '/^CPPFLAGS/d' \
-               -e 's:g++:\\$(CXX) \\$(CXXFLAGS) \\$(LDFLAGS):' \
-               configure || die
+       # sed kept for historical reasons
+       sed -i 's|....\(.\)\(_\)\(.*.4x0\)\(.\)|M\4\2\x42\x6Fn\1s\2|' 
HighScores || die
+
+       sed -i "s|HighScores|${EPREFIX}/var/games/${PN}.hs|" highscore.cpp || 
die
+
+       sed -e "s|options.cfg|${EPREFIX}/etc/${PN}/&|" \
+               -e "s|sound/|${EPREFIX}/usr/share/${PN}/&|" \
+               -e "s|dat/|${EPREFIX}/usr/share/${PN}/&|" \
+               -i main.cpp README || die
 }
 
 src_configure() {
-       # econf (sometimes) fails, see https://bugs.gentoo.org/588544
-       bash ./configure || die
+       : # this configure file does no good
+}
+
+src_compile() {
+       local obj=([!m]*.cpp)
+       tc-export CXX
+       append-cppflags $($(tc-getPKG_CONFIG) --cflags allegro || die)
+       append-libs $($(tc-getPKG_CONFIG) --libs allegro || die)
+       emake -E "main: ${obj[*]/.cpp/.o}" LDLIBS="${LIBS}"
 }
 
 src_install() {
-       dobin ${PN}
+       newbin main ${PN}
+       dodoc AUTHOR README
+
        insinto /usr/share/${PN}
        doins -r dat sound
-       dodoc AUTHOR README
-       insinto /var/games/${PN}
-       doins HighScores
+
        insinto /etc/${PN}
        doins options.cfg
-       make_desktop_entry ${PN} Chickens
 
-       fowners root:gamestat /usr/bin/${PN} /var/games/${PN}/HighScores
-       fperms 2755 /usr/bin/${PN}
-       fperms 660  /var/games/${PN}/HighScores
+       insinto /var/games
+       newins HighScores ${PN}.hs
+
+       fowners :gamestat /usr/bin/${PN} /var/games/${PN}.hs
+       fperms g+s /usr/bin/${PN}
+       fperms 660  /var/games/${PN}.hs
+
+       make_desktop_entry ${PN} ${PN^} applications-games
 }

diff --git a/games-action/chickens/files/chickens-0.2.4-bitmap.patch 
b/games-action/chickens/files/chickens-0.2.4-bitmap.patch
new file mode 100644
index 00000000000..3156ebc7d2e
--- /dev/null
+++ b/games-action/chickens/files/chickens-0.2.4-bitmap.patch
@@ -0,0 +1,33 @@
+https://bugs.gentoo.org/638246
+--- a/gem.h
++++ b/gem.h
+@@ -22,3 +22,2 @@
+       
+-      BITMAP image;
+       void draw();
+@@ -33,2 +32,3 @@
+       bool active;
++      BITMAP image;
+ };
+--- a/smoke.cpp
++++ b/smoke.cpp
+@@ -40,3 +40,3 @@
+ 
+-int SMOKE::release() {
++void SMOKE::release() {
+       
+@@ -62,3 +62,3 @@
+ 
+-int SMOKE::draw() {
++void SMOKE::draw() {
+ 
+--- a/smoke.h
++++ b/smoke.h
+@@ -32,5 +32,5 @@
+       
+-      int draw();
++      void draw();
+       int run();
+-      int release();
++      void release();
+       

diff --git a/games-action/chickens/files/chickens-0.2.4-settings.patch 
b/games-action/chickens/files/chickens-0.2.4-settings.patch
new file mode 100644
index 00000000000..393e6ef5a87
--- /dev/null
+++ b/games-action/chickens/files/chickens-0.2.4-settings.patch
@@ -0,0 +1,33 @@
+Use ifstream so it can read the system's config, and default to windowed
+mode (may crash depending on display, and is harder to exit from).
+--- a/options.cfg
++++ b/options.cfg
+@@ -36,7 +36,7 @@
+ VOLUME                        255     # 255 is full volume
+ 
+ # --- video ---
+-FULLSCREEN            1       # run in fullscreen (1) or windowed mode (0)
++FULLSCREEN            0       # run in fullscreen (1) or windowed mode (0)
+ 
+ # --- smoke ---
+ TRANSLUCENT_SMOKE     1       # set to 0 if speed is an issue 
+--- a/settings.cpp
++++ b/settings.cpp
+@@ -4,7 +4,7 @@
+ 
+ int load_config(char* path) {
+ 
+-      fstream file(path);
++      ifstream file(path);
+       
+       string key;
+       char comment[255];
+@@ -82,7 +82,7 @@
+       CHANCE_OF_GEM = 25;
+       CHICKEN_SPEED = 5;
+       CHUNKS_PER_CHICKEN = 20;
+-      FULLSCREEN = 1;
++      FULLSCREEN = 0;
+       GAME_SPEED_OFFSET = 0;
+       GRAVITY = 0.7;
+       MAX_CHICKENS = 80;

Reply via email to