Ports: Add port for DOSBox Staging

This commit is contained in:
Gunnar Beutner 2021-06-18 15:06:37 +02:00 committed by Andreas Kling
parent cf79b499f6
commit 94f56b5f6d
Notes: sideshowbarker 2024-07-18 12:05:18 +09:00
7 changed files with 138 additions and 0 deletions

View file

@ -25,6 +25,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`diffutils`](diffutils/) | GNU Diffutils | 3.7 | https://www.gnu.org/software/diffutils/ |
| [`dmidecode`](dmidecode/) | dmidecode | 3.3 | https://github.com/mirror/dmidecode |
| [`doom`](doom/) | DOOM | | https://github.com/SerenityOS/SerenityDOOM |
| [`dosbox-staging`](dosbox-staging/) | DOSBox Staging | 0.76.0 | https://dosbox-staging.github.io/ |
| [`dropbear`](dropbear/) | Dropbear SSH | 2019.78 | https://dropbear.nl/mirror/dropbear.html |
| [`dungeonrush`](dungeonrush/) | DungeonRush | 1.1-beta | https://github.com/Rapiz1/DungeonRush |
| [`ed`](ed/) | GNU ed | 1.15 | https://www.gnu.org/software/ed/ |

20
Ports/dosbox-staging/package.sh Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=dosbox-staging
version=0.76.0
useconfigure=true
configopts='--disable-opus-cdda --disable-fluidsynth --disable-dynamic-core'
files="https://github.com/dosbox-staging/dosbox-staging/archive/refs/tags/v${version}.tar.gz v${version}.tar.gz 7df53c22f7ce78c70afb60b26b06742b90193b56c510219979bf12e0bb2dc6c7"
auth_type=sha256
depends=SDL2
launcher_name=DOSBox
launcher_category=Games
launcher_command=/usr/local/bin/dosbox
icon_file=contrib/icons/dosbox-staging.ico
export CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
export CPPFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
pre_configure() {
run ./autogen.sh
run sed -i 's@irix\* \\@irix* | serenity* \\@' config.sub
}

View file

@ -0,0 +1,34 @@
diff -Naur dosbox-staging-0.76.0/src/misc/fs_utils_posix.cpp dosbox-staging-0.76.0.serenity/src/misc/fs_utils_posix.cpp
--- dosbox-staging-0.76.0/src/misc/fs_utils_posix.cpp 2021-06-18 15:09:39.038730252 +0200
+++ dosbox-staging-0.76.0.serenity/src/misc/fs_utils_posix.cpp 2021-06-18 15:08:17.603767140 +0200
@@ -24,7 +24,9 @@
#include <cerrno>
#include <cctype>
+#ifndef __serenity__
#include <glob.h>
+#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff -Naur dosbox-staging-0.76.0/src/misc/fs_utils_posix.cpp dosbox-staging-0.76.0.serenity/src/misc/fs_utils_posix.cpp
--- dosbox-staging-0.76.0/src/misc/fs_utils_posix.cpp 2020-12-03 19:36:19.000000000 +0100
+++ dosbox-staging-0.76.0.serenity/src/misc/fs_utils_posix.cpp 2021-06-18 14:41:19.022036547 +0200
@@ -75,6 +75,7 @@
// glob(3) sorts by default, so if more than one path will match
// the pattern, return the first one (in alphabetic order) that matches.
const std::string pattern = translate_to_glob_pattern(path);
+#ifndef __serenity__
glob_t pglob;
const int err = glob(pattern.c_str(), GLOB_TILDE, nullptr, &pglob);
if (err == GLOB_NOMATCH) {
@@ -96,6 +97,9 @@
const std::string ret = pglob.gl_pathv[0];
globfree(&pglob);
return ret;
+#else
+ return path;
+#endif
}
int create_dir(const char *path, uint32_t mode, uint32_t flags) noexcept

View file

@ -0,0 +1,21 @@
diff -Naur dosbox-staging-0.76.0/src/hardware/gus.cpp dosbox-staging-0.76.0.serenity/src/hardware/gus.cpp
--- dosbox-staging-0.76.0/src/hardware/gus.cpp 2020-12-03 19:36:19.000000000 +0100
+++ dosbox-staging-0.76.0.serenity/src/hardware/gus.cpp 2021-06-18 14:10:46.735285326 +0200
@@ -245,7 +245,7 @@
void PopulatePanScalars() noexcept;
void PopulateVolScalars() noexcept;
void PrepareForPlayback() noexcept;
- size_t ReadFromPort(const size_t port, const size_t iolen);
+ Bitu ReadFromPort(const Bitu port, const Bitu iolen);
void RegisterIoHandlers();
void Reset(uint8_t state);
void SetLevelCallback(const AudioFrame &level);
@@ -253,7 +253,7 @@
void UpdateDmaAddress(uint8_t new_address);
void UpdateWaveMsw(int32_t &addr) const noexcept;
void UpdateWaveLsw(int32_t &addr) const noexcept;
- void WriteToPort(size_t port, size_t val, size_t iolen);
+ void WriteToPort(Bitu port, Bitu val, Bitu iolen);
void WriteToRegister();
// Collections

View file

@ -0,0 +1,16 @@
diff -Naur dosbox-staging-0.76.0/configure.ac dosbox-staging-0.76.0.serenity/configure.ac
--- dosbox-staging-0.76.0/configure.ac 2020-12-03 19:36:19.000000000 +0100
+++ dosbox-staging-0.76.0.serenity/configure.ac 2021-06-18 14:26:25.057372241 +0200
@@ -45,10 +45,8 @@
dnl Check for SDL
SDL_VERSION=2.0.2
-AM_PATH_SDL($SDL_VERSION,
- :,
- AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
-)
+SDL_LIBS="-lSDL2"
+SDL_CFLAGS=""
PRESDL_LIBS="$LIBS"
LIBS="$LIBS $SDL_LIBS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"

View file

@ -0,0 +1,11 @@
diff -Naur dosbox-staging-0.76.0/src/gui/sdlmain.cpp dosbox-staging-0.76.0.serenity/src/gui/sdlmain.cpp
--- dosbox-staging-0.76.0/src/gui/sdlmain.cpp 2020-12-03 19:36:19.000000000 +0100
+++ dosbox-staging-0.76.0.serenity/src/gui/sdlmain.cpp 2021-06-18 14:44:11.245266708 +0200
@@ -1048,7 +1048,6 @@
if (sdl.render_driver != "auto")
SDL_SetHint(SDL_HINT_RENDER_DRIVER, sdl.render_driver.c_str());
sdl.renderer = SDL_CreateRenderer(sdl.window, -1,
- SDL_RENDERER_ACCELERATED |
(sdl.desktop.vsync ? SDL_RENDERER_PRESENTVSYNC : 0));
if (!sdl.renderer) {
LOG_MSG("%s\n", SDL_GetError());

View file

@ -0,0 +1,35 @@
diff -Naur dosbox-staging-0.76.0/src/libs/decoders/dr_mp3.h dosbox-staging-0.76.0.serenity/src/libs/decoders/dr_mp3.h
--- dosbox-staging-0.76.0/src/libs/decoders/dr_mp3.h 2020-12-03 19:36:19.000000000 +0100
+++ dosbox-staging-0.76.0.serenity/src/libs/decoders/dr_mp3.h 2021-06-18 14:15:49.491277178 +0200
@@ -3378,6 +3378,7 @@
#endif
#endif
+#ifndef __serenity__
static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_t* pOpenMode, const drmp3_allocation_callbacks* pAllocationCallbacks)
{
if (ppFile != NULL) {
@@ -3459,6 +3460,7 @@
return DRMP3_SUCCESS;
}
+#endif
@@ -3482,6 +3484,7 @@
return drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
}
+#ifndef __serenity__
DRMP3_API drmp3_bool32 drmp3_init_file_w(drmp3* pMP3, const wchar_t* pFilePath, const drmp3_allocation_callbacks* pAllocationCallbacks)
{
FILE* pFile;
@@ -3492,6 +3495,7 @@
return drmp3_init(pMP3, drmp3__on_read_stdio, drmp3__on_seek_stdio, (void*)pFile, pAllocationCallbacks);
}
#endif
+#endif
DRMP3_API void drmp3_uninit(drmp3* pMP3)
{