pathological: fixes and recipe cleanups. (#11814)

- Use original .xm music files.
  We don't package .ogg files, so until we do (we need to convert them at build
  time), just drop that Debian patch.
- Fix startup from Tracker/Deskbar.
- This is now an "any" package (it is just a Python script after all).
  Drop usage and references to write_highscores{.c}. We're not Debian.
- Added a very simple icon (best I can do... I'm not fond of IOM's workflow/UI/UX).

Now Pathological is easy to find among Deskbar's Applications, and starts just fine
from Deskbar/Tracker (and from Terminal too).
This commit is contained in:
OscarL
2025-02-21 03:49:46 -03:00
committed by GitHub
parent 2a1dade5a2
commit 053368db2f
4 changed files with 142 additions and 78 deletions

View File

@@ -0,0 +1,22 @@
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "@SHORT_INFO@",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource vector_icon {
$"6E636966020501020106023E80000000000000003E800048400048400000FFFF"
$"FFCE05C9050102043E22B8B422C533225A3E5AB8B45AC5333E5AC5335AB8B45A"
$"223E22C53322B8B4020A00010012402222000000000000402222205CB9205CB9"
$"01178400040A01010002402492000000000000402492BA4923BA4924"
};

View File

@@ -1,4 +1,4 @@
From 5629cb95a6f67bef7c6519608b2ad59855e5ceb0 Mon Sep 17 00:00:00 2001
From 3556268449361cf4f15a3352cdbfcf97595c6940 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch 10_makefile.patch
@@ -97,10 +97,10 @@ index dc42b93..432353b 100644
rm -f html/*.png
+ rm -f pathological.6
--
2.37.3
2.45.2
From 2a6245eb636c9e6514bcaac061710ebd8d0fa0c4 Mon Sep 17 00:00:00 2001
From 94ac69fbaf7fadfeac8907cc9385fb337128b940 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch 20_highscores.patch
@@ -121,7 +121,7 @@ index ca356b3..8a77cb7 100755
-exec ./pathological.py $options $scoresfile
+exec ./pathological.py $options
diff --git a/pathological.py b/pathological.py
index 5c15009..d86c6ca 100755
index 5c15009..bf5dde4 100755
--- a/pathological.py
+++ b/pathological.py
@@ -1,6 +1,8 @@
@@ -277,17 +277,17 @@ index 5c15009..d86c6ca 100755
show_highscores = 1
--
2.37.3
2.45.2
From 496228014c90ed284b6e26747f3f972f1ec8b2d6 Mon Sep 17 00:00:00 2001
From de5bb482ca334752134013bf1ac2603c3624660d Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch 30_no_soundcard.patch
diff --git a/pathological.py b/pathological.py
index d86c6ca..e8b1f84 100755
index bf5dde4..5fab5ea 100755
--- a/pathological.py
+++ b/pathological.py
@@ -2185,7 +2185,12 @@ def setup_everything():
@@ -305,17 +305,17 @@ index d86c6ca..e8b1f84 100755
pygame.key.set_repeat(500, 30)
--
2.37.3
2.45.2
From 4f6cb2a4cf704ee555b8f82118928afebd7fc2ef Mon Sep 17 00:00:00 2001
From e381bb545dd314d348e42d494061d9e1deb87933 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch 40_pygame_181.patch
diff --git a/pathological.py b/pathological.py
index e8b1f84..1bf5b3d 100755
index 5fab5ea..2b6cfe0 100755
--- a/pathological.py
+++ b/pathological.py
@@ -169,6 +169,7 @@ def start_music(name, volume=-1):
@@ -327,49 +327,17 @@ index e8b1f84..1bf5b3d 100755
try:
pygame.mixer.music.load(fullname)
--
2.37.3
2.45.2
From 7ae220e626f0402c0d9af00f7d2fa4952e5eb20f Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch 60_use_ogg_music.patch
diff --git a/pathological.py b/pathological.py
index 1bf5b3d..e53ff18 100755
--- a/pathological.py
+++ b/pathological.py
@@ -1613,7 +1613,7 @@ class Game:
popup("Please wait...\n", (150, 50))
- start_music("background.xm", ingame_music_volume)
+ start_music("background.ogg", ingame_music_volume)
self.highscores.current_score = -1
@@ -1997,7 +1997,7 @@ class IntroScreen:
self.draw()
- start_music("intro.xm", intro_music_volume)
+ start_music("intro.ogg", intro_music_volume)
while 1:
# Wait for the next frame
--
2.37.3
From ac08471c956c03cb0ade22c74ab260154970316a Mon Sep 17 00:00:00 2001
From 7e6bc003c2fb028448471a85a673e141704d188b Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch define-music_pending_song.patch
diff --git a/pathological.py b/pathological.py
index e53ff18..6ccb487 100755
index 2b6cfe0..87d2e6c 100755
--- a/pathological.py
+++ b/pathological.py
@@ -30,6 +30,7 @@ fullscreen = 0
@@ -390,17 +358,17 @@ index e53ff18..6ccb487 100755
if music_on:
if music_pending_song:
--
2.37.3
2.45.2
From 3cf27e81ceef80b94f20eaaf99cace7c9ed82e0a Mon Sep 17 00:00:00 2001
From b04847e2c610dc26153726bda32e3f97456f81b4 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:52:35 +0200
Subject: applying patch python3.patch
diff --git a/pathological.py b/pathological.py
index 6ccb487..9747616 100755
index 87d2e6c..6ac07ff 100755
--- a/pathological.py
+++ b/pathological.py
@@ -1,4 +1,4 @@
@@ -1137,10 +1105,10 @@ index 6ccb487..9747616 100755
set_video_mode()
load_sounds()
--
2.37.3
2.45.2
From 95b873ff07d3fce1e42de02fb2a79327f6f18563 Mon Sep 17 00:00:00 2001
From abc9874de98bd26dc211597730c40724f9a70ba6 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 29 Apr 2023 12:53:17 +0200
Subject: Fix installation paths
@@ -1193,5 +1161,45 @@ index 432353b..1ab6afd 100644
# Install the scores file, if it doesn't already exist.
install-scores:
--
2.37.3
2.45.2
From 2eec49ff43325ebfd487e19167d321b960e906c1 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Wed, 19 Feb 2025 20:54:20 -0300
Subject: Fix app startup from Tracker/Deskbar.
Pathological expects to start on its data directory.
This patch should allow for that to work OK on both system-wide
and "home" .hpkg installs.
diff --git a/pathological.py b/pathological.py
index 6ac07ff..f3803c9 100755
--- a/pathological.py
+++ b/pathological.py
@@ -2206,6 +2206,22 @@ def setup_everything():
introscreen = IntroScreen( screen, highscores)
+# Pathological needs to start on its data directory.
+# Find out where we're installed, and chdir() to it:
+dataDirs = [
+ '/boot/home/config/data/pathological',
+ '/system/data/pathological',
+]
+couldChDir=False
+for dir in dataDirs:
+ if os.path.exists(dir):
+ os.chdir(dir)
+ couldChDir=True
+ break
+
+if not couldChDir:
+ exit("Could not chdir() into Pathological's data directory.")
+
# Load the highscores file
highscores = HighScores( highscores_file)
--
2.45.2

View File

@@ -11,75 +11,109 @@ COPYRIGHT="2003 John-Paul Gignac
Barry deFreese
Reiner Herrmann"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://salsa.debian.org/games-team/pathological/-/archive/debian/1.1.3-17/pathological-debian-1.1.3-17.tar.bz2"
REVISION="3"
SOURCE_URI="https://salsa.debian.org/games-team/pathological/-/archive/debian/${portVersion/_/-}/pathological-debian-${portVersion/_/-}.tar.bz2"
CHECKSUM_SHA256="3a4ed34d9f1d70a918e0aff6ef48e598c80bf3f3cdea9430b96a2dd51cd3e20a"
SOURCE_DIR="pathological-debian-1.1.3-17"
PATCHES="pathological-1.1.3_17.patchset"
SOURCE_DIR="pathological-debian-${portVersion/_/-}"
PATCHES="pathological-$portVersion.patchset"
ADDITIONAL_FILES="pathological.rdef.in"
# pygame is secondary architecture, so we can't use primary for 32bit
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
ARCHITECTURES="any"
GLOBAL_WRITABLE_FILES="var/games/pathological_scores keep-old"
pythonVersion=3.10
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
PROVIDES="
pathological$secondaryArchSuffix = $portVersion
pathological = $portVersion
app:Pathological = $portVersion
"
# Previously, this package was built for archs "all !x86_gcc2" / "x86".
REPLACES="
pathological_x86
"
REQUIRES="
haiku$secondaryArchSuffix
pygame_python310
cmd:python3.10
haiku
pygame_$pythonPackage
cmd:python$pythonVersion
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
haiku_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pngtopnm
cmd:ppmcolormask
cmd:pnmcomp
"
PATCH()
{
sed -i 's,\.pathological_scores,\config/settings/pathological_scores,g' pathological.py
}
BUILD()
{
# We only want to "make docs" (we have no use for "write-highscores.c")
make DESTDIR=$prefix \
BINDIR=$appsDir \
DATADIR=$dataDir/pathological \
DOCDIR=$docDir \
LIBDIR=$prefix/lib \
MANDIR=$manDir $jobArgs
MANDIR=$manDir \
$jobArgs docs
}
# It might be simpler to either patch the Makefile for Haiku-only, or install fully manually here.
# For now, this works.
INSTALL()
{
sed -i 's,\/usr/share/games,\/system/data,g' pathological
sed -i 's,\.pathological_scores,\config/settings/pathological_scores,g' pathological.py
mkdir -p $appsDir $dataDir/pathological
make install DESTDIR=$prefix \
# We only want make to install the "platform-independent data", that actually includes the
# main (pathological.py) program, and nothing related to "write-highscores".
make DESTDIR=$prefix \
BINDIR=$appsDir \
DATADIR=$dataDir/pathological \
DOCDIR=$docDir \
LIBDIR=$prefix/lib \
MANDIR=$manDir
MANDIR=$manDir \
install-indep install-scores
rm -rf $prefix/usr # pixmaps
entryPoint=$appsDir/Pathological
mv $appsDir/pathological $entryPoint
# We'll be calling the Python script directly, not via a .sh file:
rm $appsDir/pathological
mv $dataDir/pathological/pathological.py $entryPoint
# Leaving the following lines disabled, because Pathological hangs if started from
# Deskbar/Tracker anyway.
# Resources and attributes:
local APP_SIGNATURE="application/x-vnd.pygame-pathological"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
MINOR=${MINOR%_*} # remove final "_xx"
local SHORT_INFO="Pathological"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@SHORT_INFO@|$SHORT_INFO|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/pathological.rdef.in > pathological.rdef
# addattr -t mime "BEOS:TYPE" application/x-vnd.be-elfexecutable $entryPoint
# addattr -t mime "BEOS:APP_SIG" application/x-vnd.pygame-pathological $entryPoint
# ToDo: vector icon
# addattr -t icon "BEOS:ICON" -f $portDir/additional-files/pathological.hvif $entryPoint
# addAppDeskbarSymlink $entryPoint "Pathological"
rc pathological.rdef
settype -t application/x-vnd.Be-elfexecutable $entryPoint
resattr -o $entryPoint pathological.rsrc
addAppDeskbarSymlink $entryPoint "Pathological"
}