Skip to content

Commit

Permalink
games-arcade/blobwars: Compile fixes
Browse files Browse the repository at this point in the history
Improve desktop file and provide appdata (borrowed from other distros)

Closes: https://bugs.gentoo.org/831671
Signed-off-by: Pacho Ramos <[email protected]>
  • Loading branch information
pacho2 committed May 7, 2024
1 parent 9dd7e26 commit d9a450c
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 0 deletions.
72 changes: 72 additions & 0 deletions games-arcade/blobwars/blobwars-2.00-r2.ebuild
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions games-arcade/blobwars/files/blobwars-2.00-generic-name.patch
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions games-arcade/blobwars/files/blobwars-2.00-time_t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Author: Andreas Beckmann <[email protected]>
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);
29 changes: 29 additions & 0 deletions games-arcade/blobwars/files/blobwars.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Ryan Lerch <[email protected]> -->

<!-- HOUSEKEEPING, REMOVE THIS COMMENT WHEN THIS GOES UPSTREAM
EmailAddress: [email protected]
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>

0 comments on commit d9a450c

Please sign in to comment.