commit:     d9a450c212c520ab7f884725fff3f679f3c9652a
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Tue May  7 19:00:29 2024 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Tue May  7 19:00:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9a450c2

games-arcade/blobwars: Compile fixes

Improve desktop file and provide appdata (borrowed from other distros)

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

 games-arcade/blobwars/blobwars-2.00-r2.ebuild      | 72 ++++++++++++++++++++++
 .../blobwars-2.00-dont-override-strlcat.patch      | 22 +++++++
 .../files/blobwars-2.00-generic-name.patch         | 12 ++++
 .../blobwars/files/blobwars-2.00-time_t.patch      | 15 +++++
 games-arcade/blobwars/files/blobwars.appdata.xml   | 29 +++++++++
 5 files changed, 150 insertions(+)

diff --git a/games-arcade/blobwars/blobwars-2.00-r2.ebuild 
b/games-arcade/blobwars/blobwars-2.00-r2.ebuild
new file mode 100644
index 000000000000..1f7514c19663
--- /dev/null
+++ b/games-arcade/blobwars/blobwars-2.00-r2.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit xdg
+
+DESCRIPTION="Platform game about a blob and his quest to rescue MIAs from an 
alien invader"
+HOMEPAGE="https://sourceforge.net/projects/blobwars/ 
https://www.parallelrealities.co.uk/games/metalBlobSolid/ 
https://github.com/perpendicular-dimensions/blobwars";
+SRC_URI="https://downloads.sourceforge.net/blobwars/${P}.tar.gz";
+
+LICENSE="BSD CC-BY-SA-3.0 CC-BY-3.0 GPL-2 LGPL-2.1 fairuse public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+       media-libs/libsdl2
+       media-libs/sdl2-mixer
+       media-libs/sdl2-ttf
+       media-libs/sdl2-image
+       media-libs/sdl2-net
+       sys-libs/zlib
+       virtual/libintl
+"
+DEPEND="${RDEPEND}"
+BDEPEND="sys-devel/gettext"
+
+PATCHES=(
+       # Stop providing/overriding strlcat and strlcpy to fix bug #831671
+       "${FILESDIR}"/${P}-dont-override-strlcat.patch
+
+       "${FILESDIR}"/${P}-generic-name.patch
+       "${FILESDIR}"/${P}-time_t.patch
+)
+
+src_prepare() {
+       default
+
+       # Fixes from Fedora and OpenSuSE
+       sed -i -e 's|$(PREFIX)/games|$(PREFIX)/bin|;
+               s|$(PREFIX)/share/games|$(PREFIX)/share|;
+               s| -Werror||;
+               s|$(CXX) $(LIBS) $(GAMEOBJS) -o $(PROG)|$(CXX) $(GAMEOBJS) 
$(LIBS) -o $(PROG)|;
+               s|$(CXX) $(LIBS) $(PAKOBJS) -o pak|$(CXX) $(PAKOBJS) $(LIBS) -o 
pak|;
+               s|$(CXX) $(LIBS) $(MAPOBJS) -o mapeditor|$(CXX) $(MAPOBJS) 
$(LIBS) -o mapeditor|' \
+               Makefile || die
+       sed -i -e 's|gzclose(pak)|gzclose((gzFile)pak)|;
+               s|gzclose(fp)|gzclose((gzFile)fp)|' src/pak.cpp || die
+}
+
+src_compile() {
+       # USEPAK=1 breaks music
+       emake \
+               RELEASE="1" \
+               USEPAK="0"
+}
+
+src_install() {
+       emake \
+               BINDIR="/usr/bin/" \
+               USEPAK="0" \
+               DESTDIR="${D}" \
+               DOCDIR="/usr/share/doc/${PF}/html/" \
+               install
+
+       mv -vf \
+               
"${D}"/usr/share/doc/${PF}/html/{changes,hacking,porting,readme} \
+               "${D}"/usr/share/doc/${PF}/
+
+       insinto /usr/share/metainfo
+       doins "${FILESDIR}"/${PN}.appdata.xml
+}

diff --git 
a/games-arcade/blobwars/files/blobwars-2.00-dont-override-strlcat.patch 
b/games-arcade/blobwars/files/blobwars-2.00-dont-override-strlcat.patch
new file mode 100644
index 000000000000..bcdec96f8e86
--- /dev/null
+++ b/games-arcade/blobwars/files/blobwars-2.00-dont-override-strlcat.patch
@@ -0,0 +1,22 @@
+Stop providing / overriding strlcat and strlcpy to fix the following compile 
errors:
+
+src/headers.h:60:20: error: ambiguating new declaration of 'void 
strlcat(char*, const char*, size_t)'
+   60 | static inline void strlcat(char *dest, const char *src, size_t n) { 
strncat(dest, src, n - 1); }
+      |                    ^~~~~~~
+
+src/headers.h:61:20: error: ambiguating new declaration of 'void 
strlcpy(char*, const char*, size_t)'
+   61 | static inline void strlcpy(char *dest, const char *src, size_t n) { 
strncpy(dest, src, n); dest[n - 1] = 0; }
+      |                    ^~~~~~~
+
+diff -up blobwars-2.00/src/headers.h~ blobwars-2.00/src/headers.h
+--- blobwars-2.00/src/headers.h        2015-11-21 23:18:19.000000000 +0100
++++ blobwars-2.00/src/headers.h        2023-07-28 22:25:36.655085088 +0200
+@@ -56,7 +56,7 @@ extern DECLSPEC int SDLCALL SDL_GetGamma
+ #define textdomain(x) while(false)
+ #endif
+ 
+-#if !defined(OpenBSD) && !defined(FreeBSD) && !defined(__APPLE__)
++#if 0 && !defined(OpenBSD) && !defined(FreeBSD) && !defined(__APPLE__)
+ static inline void strlcat(char *dest, const char *src, size_t n) { 
strncat(dest, src, n - 1); }
+ static inline void strlcpy(char *dest, const char *src, size_t n) { 
strncpy(dest, src, n); dest[n - 1] = 0; }
+ #endif

diff --git a/games-arcade/blobwars/files/blobwars-2.00-generic-name.patch 
b/games-arcade/blobwars/files/blobwars-2.00-generic-name.patch
new file mode 100644
index 000000000000..1e8ea6275e0b
--- /dev/null
+++ b/games-arcade/blobwars/files/blobwars-2.00-generic-name.patch
@@ -0,0 +1,12 @@
+--- a/icons/blobwars.desktop.orig      2011-04-17 16:56:56.000000000 +0200
++++ b/icons/blobwars.desktop   2015-06-26 13:15:44.459524513 +0200
+@@ -1,7 +1,8 @@
+ [Desktop Entry]
+ Encoding=UTF-8
+-Categories=Game;ActionGame;
++Categories=Game;ArcadeGame;
+ Name=Blob Wars : Metal Blob Solid
++GenericName=Blob Wars
+ Comment=Mission and Objective based 2D Platform Game
+ Icon=blobwars
+ Exec=blobwars

diff --git a/games-arcade/blobwars/files/blobwars-2.00-time_t.patch 
b/games-arcade/blobwars/files/blobwars-2.00-time_t.patch
new file mode 100644
index 000000000000..0b40eeaafcab
--- /dev/null
+++ b/games-arcade/blobwars/files/blobwars-2.00-time_t.patch
@@ -0,0 +1,15 @@
+Author: Andreas Beckmann <a...@debian.org>
+Description: fix FTBFS with 64-bit time_t on 32-bit architectures
+
+--- a/src/CReplayData.cpp
++++ b/src/CReplayData.cpp
+@@ -38,7 +38,8 @@ ReplayData::~ReplayData()
+ 
+ void ReplayData::printReplayInformation()
+ {
+-      tm *timeinfo = localtime(&header.randomSeed);
++      time_t t = header.randomSeed;
++      tm *timeinfo = localtime(&t);
+       printf("Recorded on : %s", asctime(timeinfo));
+       printf("Map         : %s\n", header.map);
+       printf("Score       : %d\n", header.score);

diff --git a/games-arcade/blobwars/files/blobwars.appdata.xml 
b/games-arcade/blobwars/files/blobwars.appdata.xml
new file mode 100644
index 000000000000..4be64ae13457
--- /dev/null
+++ b/games-arcade/blobwars/files/blobwars.appdata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2014 Ryan Lerch <rle...@redhat.com> -->
+
+<!-- HOUSEKEEPING, REMOVE THIS COMMENT WHEN THIS GOES UPSTREAM
+EmailAddress: hdego...@redhat.com
+SentUpstream: 2014-09-18
+-->
+
+<application>
+  <id type="desktop">blobwars.desktop</id>
+  <metadata_license>CC0-1.0</metadata_license>
+  <summary>Mission and Objective based 2D Platform Game</summary>
+  <description>
+    <p>
+      Blob Wars: Metal Blob Solid is a 2D side scrolling platformer where you 
control
+      Bob, (a blob secret agent) through 25 missions to rescue other blobs and 
stop
+      the evil alien leader: Galdov.
+    </p>
+  </description>
+  <url 
type="homepage">http://www.parallelrealities.co.uk/p/blob-wars-metal-blob-solid.html</url>
+  <screenshots>
+    <screenshot 
type="default">http://3.bp.blogspot.com/-VGOFb5wKQkE/T4RuJznkWkI/AAAAAAAAA10/u1pyXxBa1yw/s1600/03.jpg</screenshot>
+    
<screenshot>http://3.bp.blogspot.com/-oBB_IbOXWEI/T4RuI6G3Y5I/AAAAAAAAA1s/_Tb2v1YrINk/s1600/02.jpg</screenshot>
+    
<screenshot>http://3.bp.blogspot.com/-s0v-Lr5WBa0/T4RuH7DbgKI/AAAAAAAAA1k/58HXOP40NIk/s1600/01.jpg</screenshot>
+  </screenshots>
+  <!-- FIXME: change this to an upstream email address for spec updates
+  <updatecontact>someone_who_cares@upstream_project.org</updatecontact>
+   -->
+</application>

Reply via email to