commit:     98277540421d891ff0276504a79b1241fcc2fbd7
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 12:53:39 2022 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 12:55:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98277540

games-arcade/amphetamine: Fixes from Debian and OpenBSD

Also use latest data files from Debian and a homemade icon with higher
resolution.

Closes: https://bugs.gentoo.org/730826
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 games-arcade/amphetamine/Manifest                  |  2 +
 .../amphetamine/amphetamine-0.8.10-r2.ebuild       | 59 ++++++++++++++++++++++
 .../files/amphetamine-0.8.10-SDL-conversions.patch | 22 ++++++++
 .../files/amphetamine-0.8.10-clang.patch           | 18 +++++++
 .../files/amphetamine-0.8.10-format-string.patch   | 11 ++++
 5 files changed, 112 insertions(+)

diff --git a/games-arcade/amphetamine/Manifest 
b/games-arcade/amphetamine/Manifest
index a4a47b6f7268..f4aaae2abe2b 100644
--- a/games-arcade/amphetamine/Manifest
+++ b/games-arcade/amphetamine/Manifest
@@ -1,2 +1,4 @@
 DIST amphetamine-0.8.10.tar.bz2 72324 BLAKE2B 
39d8f56066e7fbad853198be28375dfe7ee766d7c493a6faf0e2fa321ee2d2d757f5f294418208ac97a440d58bae03d40de2615e421bb8e9fad7a8ba5220d354
 SHA512 
eb3106df6070e207ffb3293ac4701bba8222603c0e399667505bad29b6f6433dc9ec008499b5180f713a724d3b686fead15536a20927195bc57780be16a860ef
 DIST amphetamine-data-0.8.6.tar.bz2 928775 BLAKE2B 
078de623c719ebaedae3137fe3876ecd7ba02ad7ec44a64b7775fd173a42b399d137a3862d3fe426780a234638b0876a1f0fc5a06d6ab8f4b3c4ca66df367a49
 SHA512 
0feb86f420b4816064594756bb30bb6e02ae5062f03ef175b3262a8f30043340933f6f1b1894e2b2cfad70befc76d3ed1e0d2777c2dc2f7461459e8a93efeaf1
+DIST amphetamine-data_0.8.7.orig.tar.gz 955993 BLAKE2B 
ad14f36ac1d41b9c4ce7dccb9676a562b07400e2d3bf4303e6fbc18fa385453891da35bdcbbf73331989a65379a68329752b0d550951430c2777a3174db8df8f
 SHA512 
623f5c4d02157f55188f4f7f0ea743b613ac846f56fa80c7b875488384341cb6737beecd2ea2322219ff2ff306e1588350e80bf3bcbd0891a3ce0fd514f142e7
+DIST amphetamine.png 95279 BLAKE2B 
6403bb35883ce62f672ee3a3859eb580784c8fd5b068a116c6e3606be27893288205011cba5e9b83f2989d7471a65c13789e44acf5905fdf23402bf065f92c31
 SHA512 
c7698973e0d656187bebb070a1a76669d71d0025b5dc1e53adf221d934db5aac926897b52db257435168d74b622ed83d6fa6938984ec06682fbd9bd08f64521c

diff --git a/games-arcade/amphetamine/amphetamine-0.8.10-r2.ebuild 
b/games-arcade/amphetamine/amphetamine-0.8.10-r2.ebuild
new file mode 100644
index 000000000000..ac1c0dde9fb1
--- /dev/null
+++ b/games-arcade/amphetamine/amphetamine-0.8.10-r2.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit desktop
+
+DESCRIPTION="A cool Jump'n Run game offering some unique visual effects"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage";
+SRC_URI="
+       mirror://gentoo/${P}.tar.bz2
+       
mirror://debian/pool/main/a/amphetamine-data/amphetamine-data_0.8.7.orig.tar.gz
+       https://dev.gentoo.org/~pacho/${PN}/${PN}.png
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+       media-libs/libsdl[sound,video]
+       x11-libs/libXpm
+"
+DEPEND="${RDEPEND}"
+BDEPEND=""
+
+PATCHES=(
+       "${FILESDIR}"/${P}-build.patch
+       "${FILESDIR}"/${P}-64bit.patch
+
+       # From Debian:
+       "${FILESDIR}"/${P}-no-lxt.patch
+       "${FILESDIR}"/${P}-bugs.patch
+       "${FILESDIR}"/${P}-missing-headers.patch
+       "${FILESDIR}"/${P}-newline.patch
+       "${FILESDIR}"/${P}-format-string.patch
+
+       # From OpenBSD:
+       "${FILESDIR}"/${P}-SDL-conversions.patch
+       "${FILESDIR}"/${P}-clang.patch
+)
+
+src_prepare() {
+       default
+       sed -i -e '55d' src/ObjInfo.cpp || die
+}
+
+src_compile() {
+       emake INSTALL_DIR=/usr/share/${PN}
+}
+
+src_install() {
+       newbin amph ${PN}
+       insinto /usr/share/${PN}
+       doins -r ../amph/*
+       doicon "${DISTDIR}/${PN}.png"
+       make_desktop_entry ${PN} Amphetamine ${PN}
+       einstalldocs
+}

diff --git 
a/games-arcade/amphetamine/files/amphetamine-0.8.10-SDL-conversions.patch 
b/games-arcade/amphetamine/files/amphetamine-0.8.10-SDL-conversions.patch
new file mode 100644
index 000000000000..7182eb7acfd0
--- /dev/null
+++ b/games-arcade/amphetamine/files/amphetamine-0.8.10-SDL-conversions.patch
@@ -0,0 +1,22 @@
+--- a/src/SndSys.cpp.orig      Sun Mar 24 00:49:09 2002
++++ b/src/SndSys.cpp   Sat Jan 24 04:52:38 2009
+@@ -16,7 +16,7 @@ void Mix_Audio(void *udata, Uint8 *stream, int len)
+ 
+ int InitializeSoundSystem()
+ {     
+-              SDL_AudioSpec wanted, obtained;
++              SDL_AudioSpec wanted;
+         
+         /* Set the audio format */
+         // Not all sounds are of the same sampling rate which is why
+@@ -28,8 +28,8 @@ int InitializeSoundSystem()
+         wanted.callback = Mix_Audio;
+         wanted.userdata = NULL;
+ 
+-        /* Open the audio device, forcing the desired format */
+-        if ( SDL_OpenAudio(&wanted, &obtained) < 0 ) {
++        /* Open the audio device, allowing SDL to apply conversions */
++        if ( SDL_OpenAudio(&wanted, NULL) < 0 ) {
+                 fprintf(stderr, "InitSoundSystem: Couldn't open audio: %s\n", 
SDL_GetError());
+                 fprintf(stderr, "Sound was disabled. \n");
+                 return(-1);

diff --git a/games-arcade/amphetamine/files/amphetamine-0.8.10-clang.patch 
b/games-arcade/amphetamine/files/amphetamine-0.8.10-clang.patch
new file mode 100644
index 000000000000..d3fcbfdcabff
--- /dev/null
+++ b/games-arcade/amphetamine/files/amphetamine-0.8.10-clang.patch
@@ -0,0 +1,18 @@
+Index: src/Element.cpp
+--- a/src/Element.cpp.orig
++++ b/src/Element.cpp
+@@ -279,7 +279,13 @@ CBackgroundElement::CBackgroundElement(short initx, sh
+ 
+ void  CBackgroundElement::OnAllocate()
+ {
+-      short   params[5] = {-1, xs, ys, xe - xs, ye - ys};
++      short   params[5] = {
++              -1,
++              static_cast<short>(xs),
++              static_cast<short>(ys),
++              static_cast<short>(xe - xs),
++              static_cast<short>(ye - ys)
++      };
+       unsigned char *tmpBmp;
+ 
+       tmpBmp = gShapeManager->GetBackground(params[1], params[2]);

diff --git 
a/games-arcade/amphetamine/files/amphetamine-0.8.10-format-string.patch 
b/games-arcade/amphetamine/files/amphetamine-0.8.10-format-string.patch
new file mode 100644
index 000000000000..50e235a66a85
--- /dev/null
+++ b/games-arcade/amphetamine/files/amphetamine-0.8.10-format-string.patch
@@ -0,0 +1,11 @@
+description: fix a format string issue
+--- a/src/AmpHead.hpp
++++ b/src/AmpHead.hpp
+@@ -183,6 +183,6 @@ typedef struct {
+ #define SWAP(a, b, _t) (a) = (_t)((long)a ^ (long)(b)); (b) = (_t)((long)(a) 
^ (long)(b)); (a) = (_t)((long)(a) ^ (long)(b));
+ #define NZ(a, b) ((a) == 0 ? (b) : (a))
+ 
+-#define MSG(message) if (logFile) fprintf(logFile, message); fflush(logFile)
++#define MSG(message) if (logFile) fprintf(logFile, "%s", message); 
fflush(logFile)
+ 
+ #endif

Reply via email to