frozen_bubble, new recipe for classic game (#9417)

This commit is contained in:
Schrijvers Luc
2023-09-14 07:14:47 +00:00
committed by GitHub
parent e78d41a19f
commit 1540edef51
3 changed files with 162 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
SUMMARY="Puzzle with Bubbles"
DESCRIPTION="A game in which you throw colorful bubbles and build groups to destroy the bubbles."
HOMEPAGE="https://metacpan.org/release/File-Next"
COPYRIGHT="2000-2010 The Frozen-Bubble Team"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://cpan.metacpan.org/authors/id/K/KT/KTHAKORE/Games-FrozenBubble-$portVersion.tar.gz"
CHECKSUM_SHA256="721e04ff69c5233060656bfbf4002aa1aeadd96c95351f0c57bb85b6da35a305"
SOURCE_DIR="Games-FrozenBubble-$portVersion"
PATCHES="frozen-bubble-$portVersion.patch
frozen_bubble-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
frozen_bubble$secondaryArchSuffix = $portVersion
cmd:fb_server
cmd:frozen_bubble
cmd:frozen_bubble_editor
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
lib:libSDL_mixer_1.2$secondaryArchSuffix
lib:libSDL_Pango$secondaryArchSuffix
compress_bzip2$secondaryArchSuffix
file_which$secondaryArchSuffix
sdl_perl$secondaryArchSuffix
vendor_perl$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libiconv$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libSDL_1.2$secondaryArchSuffix
devel:libSDL_mixer_1.2$secondaryArchSuffix
devel:libSDL_Pango$secondaryArchSuffix
capture_tiny$secondaryArchSuffix
class_inspector$secondaryArchSuffix
compress_bzip2$secondaryArchSuffix
file_sharedir$secondaryArchSuffix
file_slurp$secondaryArchSuffix
file_which$secondaryArchSuffix
ipc_system_simple$secondaryArchSuffix
locale_maketext_extract$secondaryArchSuffix
module_build$secondaryArchSuffix
sdl_perl$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:perl$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
export LDFLAGS="-lnetwork"
perl Build.PL --installdirs vendor --prefix $prefix
./Build
}
INSTALL()
{
./Build install --installdirs vendor
addAppDeskbarSymlink $prefix/bin/frozen-bubble FrozenBubble
}

View File

@@ -0,0 +1,69 @@
From aa2ce32185b4477e659ed7c70d09c440610ef67b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 2 Feb 2018 12:44:15 +0100
Subject: [PATCH] Fix buffer size when formatting current date
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gcc-8 and glibc-2.26.9000 reports this error:
server/log.c:64:54: error: '%03d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 49 [-Werror=format-truncation=]
snprintf(current_date, sizeof(current_date), "%s.%03d", buf, (int)(1000 * (time-seconds)));
^~~~
This patch fixes two mistakes in the get_current_date() function:
First strftime() can fail and then buf content is undefined. The patch
makes sure the buf content is properly null-termited.
Second if strftime() uses up the the whole buf array, no space will be
left for appending miliseconds to current_date value in the subsequent
snprintf() call. The patch increases current_data size so that things
will always fit.
In reality, all this should not matter because sane strftime() will
return fixed-lenght string. But for all the cases and for sake of the
compiler check this patch should be applied.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
server/log.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/server/log.c b/server/log.c
index 2fe7b7c..f696752 100644
--- a/server/log.c
+++ b/server/log.c
@@ -52,15 +52,17 @@ double get_current_time_exact(void)
return (double) now.tv_sec + now.tv_usec / 1e6; // bad bad idea to use float as precision is not down to the seconds then
}
-char current_date[50];
+char current_date[70];
char* get_current_date(void)
{
struct tm * lt;
char buf[50];
double time = get_current_time_exact();
time_t seconds = (time_t)time;
+ size_t length;
lt = localtime(&seconds);
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt);
+ length = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt);
+ buf[length] = '\0';
snprintf(current_date, sizeof(current_date), "%s.%03d", buf, (int)(1000 * (time-seconds)));
return current_date;
}
diff -up frozen-bubble-2.2.1-beta1/server/log.h~ frozen-bubble-2.2.1-beta1/server/log.h
--- frozen-bubble-2.2.1-beta1/server/log.h~ 2010-08-07 15:36:27.000000000 +0200
+++ frozen-bubble-2.2.1-beta1/server/log.h 2018-02-08 14:09:52.472451694 +0100
@@ -23,7 +23,7 @@
time_t get_current_time(void);
double get_current_time_exact(void);
-extern char current_date[50];
+extern char current_date[70];
char* get_current_date(void);
enum output_types { OUTPUT_TYPE_DEBUG, OUTPUT_TYPE_CONNECT, OUTPUT_TYPE_INFO, OUTPUT_TYPE_ERROR };

View File

@@ -0,0 +1,22 @@
From 060b2c3cda3f7a59e0aea5b69067d4916f87ee37 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 9 Sep 2023 13:53:35 +0200
Subject: Fix path for highscores et all ...
diff --git a/lib/Games/FrozenBubble/Stuff.pm b/lib/Games/FrozenBubble/Stuff.pm
index 6b3ee8f..feff10d 100644
--- a/lib/Games/FrozenBubble/Stuff.pm
+++ b/lib/Games/FrozenBubble/Stuff.pm
@@ -134,7 +134,7 @@ $POS_2P{rp1} = $POS_2P{p2}; #- in net/lan 2p mode, use bigger graphics and posi
centerpanel => { x => 149, 'y' => 190 },
);
-$FBHOME = "$ENV{HOME}/.frozen-bubble";
+$FBHOME = "$ENV{HOME}/config/settings/frozen-bubble";
$FBLEVELS = "$FBHOME/levels";
migrate_resource_files();
--
2.42.0