x16_emulator: new recipe (#9757)

This commit is contained in:
davidkaroly
2023-11-15 22:14:23 +01:00
committed by GitHub
parent 946dd83eed
commit c6450487fb
3 changed files with 144 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "X16Emu",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";

View File

@@ -0,0 +1,57 @@
From 53cebc5a13d4b2f4149e258947038ab821df4976 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Wed, 18 Oct 2023 22:05:56 +0200
Subject: Haiku: search for rom.bin in system data directory
diff --git a/src/main.c b/src/main.c
index 6943e0c..f0ce96b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,6 +48,11 @@
#include <pthread.h>
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
void *emulator_loop(void *param);
void emscripten_main_loop(void);
@@ -489,6 +494,17 @@ usage_keymap()
exit(1);
}
+#ifdef __HAIKU__
+char *
+Haiku_GetBasePath()
+{
+ char buffer[B_PATH_NAME_LENGTH+10];
+ find_directory(B_SYSTEM_DATA_DIRECTORY, dev_for_path("/boot"), false, buffer, B_PATH_NAME_LENGTH);
+ strcat(buffer, "/x16emu/");
+ return strdup(buffer);
+}
+#endif
+
int
main(int argc, char **argv)
{
@@ -508,7 +524,12 @@ main(int argc, char **argv)
run_after_load = false;
- char *base_path = SDL_GetBasePath();
+ char *base_path;
+#ifdef __HAIKU__
+ base_path = Haiku_GetBasePath();
+#else
+ base_path = SDL_GetBasePath();
+#endif
// This causes the emulator to load ROM data from the executable's directory when
// no ROM file is specified on the command line.
--
2.42.0

View File

@@ -0,0 +1,71 @@
SUMMARY="Emulator for the Commander X16 8-bit computer"
DESCRIPTION="This is an emulator for the Commander X16 computer system.
It only depends on SDL2 and should compile on all modern operating systems."
HOMEPAGE="https://commanderx16.com/"
COPYRIGHT="2019-2023 Michael Steil"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/x16community/x16-emulator/archive/refs/tags/r$portVersion.tar.gz"
CHECKSUM_SHA256="b3a092586b02faaca77679eb086847a01a747e8a0ca2cd00d3f0230ed22d8c73"
SOURCE_DIR="x16-emulator-r$portVersion"
SOURCE_URI_2="https://github.com/x16community/x16-rom/releases/download/r$portVersion/Release.ROM.Image.zip"
CHECKSUM_SHA256_2="341997c3edead8533b3df4889acf16bd09a65318497cd4f15c6c397a44fccb97"
ADDITIONAL_FILES="x16emu.rdef.in"
PATCHES="x16_emulator-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
x16_emulator$secondaryArchSuffix = $portVersion
app:x16emu$secondaryArchSuffix = $portVersion
cmd:x16emu
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libSDL2$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:make
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
"
BUILD()
{
make $jobArgs
}
INSTALL()
{
install -d "$appsDir"
install -m 0755 -t "$appsDir" x16emu
install -d "$dataDir/x16emu"
install -m 0644 -t "$dataDir/x16emu" $sourceDir2/rom.bin
local APP_SIGNATURE="application/x-vnd.x16emulator"
local MAJOR="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f1`"
#local MIDDLE="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f2`"
local MIDDLE=0
#local MINOR="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f3`"
local MINOR=0
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|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/x16emu.rdef.in > $sourceDir/x16emu.rdef
addResourcesToBinaries $sourceDir/x16emu.rdef $appsDir/x16emu
addAppDeskbarSymlink $appsDir/x16emu
}