summaryrefslogtreecommitdiff
path: root/Ports
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-18 15:06:37 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-18 16:35:15 +0200
commit94f56b5f6dcb194723cb532c6613526b6b321312 (patch)
tree84853fad7847938f71e47930c9bf407fc3dc0c14 /Ports
parentcf79b499f62099d88118cebfe780a80502ee38f0 (diff)
downloadserenity-94f56b5f6dcb194723cb532c6613526b6b321312.zip
Ports: Add port for DOSBox Staging
Diffstat (limited to 'Ports')
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/dosbox-staging/package.sh20
-rw-r--r--Ports/dosbox-staging/patches/glob.patch34
-rw-r--r--Ports/dosbox-staging/patches/gus.patch21
-rw-r--r--Ports/dosbox-staging/patches/sdl.patch16
-rw-r--r--Ports/dosbox-staging/patches/swrender.patch11
-rw-r--r--Ports/dosbox-staging/patches/wchar.patch35
7 files changed, 138 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 297b8a6877..c7e00c58d6 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -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/ |
diff --git a/Ports/dosbox-staging/package.sh b/Ports/dosbox-staging/package.sh
new file mode 100755
index 0000000000..719d9e3320
--- /dev/null
+++ b/Ports/dosbox-staging/package.sh
@@ -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
+}
diff --git a/Ports/dosbox-staging/patches/glob.patch b/Ports/dosbox-staging/patches/glob.patch
new file mode 100644
index 0000000000..e57495d32d
--- /dev/null
+++ b/Ports/dosbox-staging/patches/glob.patch
@@ -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
diff --git a/Ports/dosbox-staging/patches/gus.patch b/Ports/dosbox-staging/patches/gus.patch
new file mode 100644
index 0000000000..fa2fd59ded
--- /dev/null
+++ b/Ports/dosbox-staging/patches/gus.patch
@@ -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
diff --git a/Ports/dosbox-staging/patches/sdl.patch b/Ports/dosbox-staging/patches/sdl.patch
new file mode 100644
index 0000000000..557de97f5c
--- /dev/null
+++ b/Ports/dosbox-staging/patches/sdl.patch
@@ -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"
diff --git a/Ports/dosbox-staging/patches/swrender.patch b/Ports/dosbox-staging/patches/swrender.patch
new file mode 100644
index 0000000000..ff10af5c0f
--- /dev/null
+++ b/Ports/dosbox-staging/patches/swrender.patch
@@ -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());
diff --git a/Ports/dosbox-staging/patches/wchar.patch b/Ports/dosbox-staging/patches/wchar.patch
new file mode 100644
index 0000000000..d2674cf0dc
--- /dev/null
+++ b/Ports/dosbox-staging/patches/wchar.patch
@@ -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)
+ {