From 03ca560b2d9375f30747d57d5d00ab0405743f62 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Fri, 5 May 2023 21:53:23 +0200 Subject: [PATCH] Ports: Update dosbox-staging to 0.77.1 This version of 'dosbox-staging' uses the meson build system. Previous versions of dosbox-staging started in windowed mode with a resolution of 320x200. This version starts in windowed mode with a resolution of 640x480. Audio was stuttering a bit in previous versions, but it sounds like it might have become a bit worse. This is probably because of higher CPU usage and the audio server/client not able to keep up. Added a post_install() section to package script which outputs a link to dosbox-staging's release notes. --- Ports/AvailablePorts.md | 2 +- Ports/dosbox-staging/package.sh | 43 +++++++++---- .../0001-Skip-use-of-glob-in-serenity.patch | 2 +- ...Disable-SDL-s-accelerated-rendering.patch} | 4 +- .../0002-Replace-some-size_t-Bitu.patch | 33 ---------- ...-Manually-hardcode-SDL2-library-name.patch | 26 -------- .../0003-bios.cpp-Serenity-has-time.h.patch | 31 ++++++++++ ...-Add-serenity-to-list-of-os-families.patch | 21 +++++++ ...tch-out-ioctl-flags-we-currently-do-.patch | 62 +++++++++++++++++++ Ports/dosbox-staging/patches/ReadMe.md | 29 +++++---- 10 files changed, 166 insertions(+), 87 deletions(-) rename Ports/dosbox-staging/patches/{0004-Disable-SDL-s-accelerated-rendering.patch => 0002-Disable-SDL-s-accelerated-rendering.patch} (85%) delete mode 100644 Ports/dosbox-staging/patches/0002-Replace-some-size_t-Bitu.patch delete mode 100644 Ports/dosbox-staging/patches/0003-Manually-hardcode-SDL2-library-name.patch create mode 100644 Ports/dosbox-staging/patches/0003-bios.cpp-Serenity-has-time.h.patch create mode 100644 Ports/dosbox-staging/patches/0004-meson.build-Add-serenity-to-list-of-os-families.patch create mode 100644 Ports/dosbox-staging/patches/0005-libserial.cpp-Patch-out-ioctl-flags-we-currently-do-.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 08e0759f25..432fd9a78c 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -47,7 +47,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`dmidecode`](dmidecode/) | dmidecode | 3.5 | https://github.com/mirror/dmidecode | | [`doom`](doom/) | DOOM | | https://github.com/SerenityOS/SerenityDOOM | | [`dos2unix`](dos2unix/) | dos2unix | 7.4.4 | https://waterlan.home.xs4all.nl/dos2unix.html | -| [`dosbox-staging`](dosbox-staging/) | DOSBox Staging | 0.76.0 | https://dosbox-staging.github.io/ | +| [`dosbox-staging`](dosbox-staging/) | DOSBox Staging | 0.77.1 | https://dosbox-staging.github.io/ | | [`dosfstools`](dosfstools/) | dosfstools utility suite | 4.2 | https://github.com/dosfstools/dosfstools/ | | [`double-conversion`](double-conversion/) | double-conversion | 3.2.1 | https://github.com/google/double-conversion | | [`drascula`](drascula/) | DrĂ¡scula: The Vampire Strikes Back | 1.0 | https://www.scummvm.org/games/#games-drascula | diff --git a/Ports/dosbox-staging/package.sh b/Ports/dosbox-staging/package.sh index a73c5aa0f8..49837aea08 100755 --- a/Ports/dosbox-staging/package.sh +++ b/Ports/dosbox-staging/package.sh @@ -1,27 +1,48 @@ #!/usr/bin/env -S bash ../.port_include.sh port='dosbox-staging' -version='0.76.0' +version='0.77.1' useconfigure='true' configopts=( - '--disable-fluidsynth' - '--disable-dynamic-core' - '--disable-opus-cdda' + "--cross-file" "${SERENITY_BUILD_DIR}/meson-cross-file.txt" + '-Ddynamic_core=none' + '-Dtry_static_libs=opusfile' + '-Dunit_tests=disabled' + '-Duse_fluidsynth=false' + '-Duse_mt32emu=false' + '-Duse_opengl=false' + '-Duse_png=false' ) -files="https://github.com/dosbox-staging/dosbox-staging/archive/refs/tags/v${version}.tar.gz v${version}.tar.gz 7df53c22f7ce78c70afb60b26b06742b90193b56c510219979bf12e0bb2dc6c7" +files="https://github.com/dosbox-staging/dosbox-staging/archive/refs/tags/v${version}.tar.gz v${version}.tar.gz 85359efb7cd5c5c0336d88bdf023b7b462a8233490e00274fef0b85cca2f5f3c" auth_type='sha256' depends=( + 'libslirp' 'libpng' + 'opusfile' 'SDL2' + 'SDL2_net' ) launcher_name='DOSBox' launcher_category='Games' launcher_command='/usr/local/bin/dosbox' icon_file='contrib/icons/dosbox-staging.ico' -use_fresh_config_sub='true' -export CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2" -export CPPFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2" - -pre_patch() { - run ./autogen.sh +configure() { + run meson setup build/release "${configopts[@]}" +} + +build() { + run ninja -C build/release +} + +install() { + export DESTDIR="${SERENITY_INSTALL_ROOT}" + run meson install -C build/release +} + +post_install() { + echo + echo "DOSBox Staging ${version} is installed!" + echo + echo "Release notes: https://dosbox-staging.github.io/downloads/release-notes/${version}/" + echo } diff --git a/Ports/dosbox-staging/patches/0001-Skip-use-of-glob-in-serenity.patch b/Ports/dosbox-staging/patches/0001-Skip-use-of-glob-in-serenity.patch index b141b32f32..b1eddef131 100644 --- a/Ports/dosbox-staging/patches/0001-Skip-use-of-glob-in-serenity.patch +++ b/Ports/dosbox-staging/patches/0001-Skip-use-of-glob-in-serenity.patch @@ -9,7 +9,7 @@ We don't have that yet. 1 file changed, 6 insertions(+) diff --git a/src/misc/fs_utils_posix.cpp b/src/misc/fs_utils_posix.cpp -index fa09872..96002ac 100644 +index bd90201ba2913f72c26beb88f9bc1f06f491754c..c9a7fc59c8b87e8e4cbd14679e89f5d79a49459f 100644 --- a/src/misc/fs_utils_posix.cpp +++ b/src/misc/fs_utils_posix.cpp @@ -24,7 +24,9 @@ diff --git a/Ports/dosbox-staging/patches/0004-Disable-SDL-s-accelerated-rendering.patch b/Ports/dosbox-staging/patches/0002-Disable-SDL-s-accelerated-rendering.patch similarity index 85% rename from Ports/dosbox-staging/patches/0004-Disable-SDL-s-accelerated-rendering.patch rename to Ports/dosbox-staging/patches/0002-Disable-SDL-s-accelerated-rendering.patch index ef9b6b320b..77bf8dc7ce 100644 --- a/Ports/dosbox-staging/patches/0004-Disable-SDL-s-accelerated-rendering.patch +++ b/Ports/dosbox-staging/patches/0002-Disable-SDL-s-accelerated-rendering.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Disable SDL's accelerated rendering 1 file changed, 1 deletion(-) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp -index 7039f27..d445ebd 100644 +index c85a9f53cefe09821bb73a154ef7c663b90c3bc9..d0e32221716761d459f537cef5c0e8afe4b75e72 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp -@@ -1048,7 +1048,6 @@ dosurface: +@@ -1078,7 +1078,6 @@ dosurface: if (sdl.render_driver != "auto") SDL_SetHint(SDL_HINT_RENDER_DRIVER, sdl.render_driver.c_str()); sdl.renderer = SDL_CreateRenderer(sdl.window, -1, diff --git a/Ports/dosbox-staging/patches/0002-Replace-some-size_t-Bitu.patch b/Ports/dosbox-staging/patches/0002-Replace-some-size_t-Bitu.patch deleted file mode 100644 index 19d1248472..0000000000 --- a/Ports/dosbox-staging/patches/0002-Replace-some-size_t-Bitu.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Gunnar Beutner -Date: Fri, 18 Jun 2021 15:06:37 +0200 -Subject: [PATCH] Replace some size_t => Bitu - -FIXME: No information as to why this is a thing exists as of yet, fill - them in when that stuff is known. ---- - src/hardware/gus.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/hardware/gus.cpp b/src/hardware/gus.cpp -index 355a082..6c20b5c 100644 ---- a/src/hardware/gus.cpp -+++ b/src/hardware/gus.cpp -@@ -245,7 +245,7 @@ private: - 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 @@ private: - 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/0003-Manually-hardcode-SDL2-library-name.patch b/Ports/dosbox-staging/patches/0003-Manually-hardcode-SDL2-library-name.patch deleted file mode 100644 index 4cbdd5f191..0000000000 --- a/Ports/dosbox-staging/patches/0003-Manually-hardcode-SDL2-library-name.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Gunnar Beutner -Date: Fri, 18 Jun 2021 15:06:37 +0200 -Subject: [PATCH] Manually hardcode SDL2 library name - ---- - configure.ac | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 28e9281..1cc3691 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -45,10 +45,8 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - 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/0003-bios.cpp-Serenity-has-time.h.patch b/Ports/dosbox-staging/patches/0003-bios.cpp-Serenity-has-time.h.patch new file mode 100644 index 0000000000..3df95c2a24 --- /dev/null +++ b/Ports/dosbox-staging/patches/0003-bios.cpp-Serenity-has-time.h.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kenneth Myhra +Date: Thu, 4 May 2023 22:35:56 +0200 +Subject: [PATCH] [bios.cpp] Serenity has time.h + +--- + src/ints/bios.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp +index 4ccbe1609ba11d5d69f59ed15735e5a88cbb162a..257f8ce10bf5d5b8c9f145647764d8542e55fc51 100644 +--- a/src/ints/bios.cpp ++++ b/src/ints/bios.cpp +@@ -33,7 +33,7 @@ + #include "serialport.h" + #include + +-#if defined(HAVE_CLOCK_GETTIME) && !defined(WIN32) ++#if defined(HAVE_CLOCK_GETTIME) || defined(__serenity__) && !defined(WIN32) + //time.h is already included + #else + #include +@@ -496,7 +496,7 @@ static void BIOS_HostTimeSync() { + Bit32u milli = 0; + // TODO investigate if clock_gettime and ftime can be replaced + // by using C++11 chrono +-#if defined(HAVE_CLOCK_GETTIME) && !defined(WIN32) ++#if defined(HAVE_CLOCK_GETTIME) || defined(__serenity__) && !defined(WIN32) + struct timespec tp; + clock_gettime(CLOCK_REALTIME,&tp); + diff --git a/Ports/dosbox-staging/patches/0004-meson.build-Add-serenity-to-list-of-os-families.patch b/Ports/dosbox-staging/patches/0004-meson.build-Add-serenity-to-list-of-os-families.patch new file mode 100644 index 0000000000..b8a0ccfb4b --- /dev/null +++ b/Ports/dosbox-staging/patches/0004-meson.build-Add-serenity-to-list-of-os-families.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kenneth Myhra +Date: Fri, 5 May 2023 07:36:53 +0200 +Subject: [PATCH] [meson.build] Add 'serenity' to list of os families + +--- + meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meson.build b/meson.build +index d0794072239b7b48597cf299d9297fbc1a59d983..75b3c752c34e892e4215065d8bf32cafad9952c2 100644 +--- a/meson.build ++++ b/meson.build +@@ -50,6 +50,7 @@ os_family_name = { + 'netbsd' : 'BSD', + 'openbsd' : 'BSD', + 'dragonfly' : 'BSD', ++ 'serenity' : 'LINUX', + }.get(host_machine.system(), 'UNKNOWN_OS') + conf_data.set(os_family_name, 1) + diff --git a/Ports/dosbox-staging/patches/0005-libserial.cpp-Patch-out-ioctl-flags-we-currently-do-.patch b/Ports/dosbox-staging/patches/0005-libserial.cpp-Patch-out-ioctl-flags-we-currently-do-.patch new file mode 100644 index 0000000000..1df9350c5a --- /dev/null +++ b/Ports/dosbox-staging/patches/0005-libserial.cpp-Patch-out-ioctl-flags-we-currently-do-.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kenneth Myhra +Date: Fri, 5 May 2023 07:45:29 +0200 +Subject: [PATCH] [libserial.cpp] Patch out ioctl flags we currently do not + support + +--- + src/hardware/serialport/libserial.cpp | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/hardware/serialport/libserial.cpp b/src/hardware/serialport/libserial.cpp +index a3dad0980308089a0869001cac31b5c7661dd5df..7899e9cf9bfed065831a23d45aaeac907eee7b97 100644 +--- a/src/hardware/serialport/libserial.cpp ++++ b/src/hardware/serialport/libserial.cpp +@@ -360,6 +360,7 @@ void SERIAL_getErrorString(char* buffer, size_t length) { + } + + int SERIAL_getmodemstatus(COMPORT port) { ++#ifndef __serenity__ + long flags = 0; + ioctl (port->porthandle, TIOCMGET, &flags); + int retval = 0; +@@ -368,6 +369,9 @@ int SERIAL_getmodemstatus(COMPORT port) { + if (flags & TIOCM_RI) retval |= SERIAL_RI; + if (flags & TIOCM_CD) retval |= SERIAL_CD; + return retval; ++#else ++ return 0; ++#endif + } + + bool SERIAL_sendchar(COMPORT port, char data) { +@@ -463,17 +467,29 @@ bool SERIAL_setCommParameters(COMPORT port, + } + + void SERIAL_setBREAK(COMPORT port, bool value) { ++#ifdef __serenity__ ++ // Do nothing. ++#else + ioctl(port->porthandle, value?TIOCSBRK:TIOCCBRK); ++#endif + } + + void SERIAL_setDTR(COMPORT port, bool value) { ++#ifdef __serenity__ ++ // Do nothing. ++#else + long flag = TIOCM_DTR; + ioctl(port->porthandle, value?TIOCMBIS:TIOCMBIC, &flag); ++#endif + } + + void SERIAL_setRTS(COMPORT port, bool value) { ++#ifdef __serenity__ ++ // Do nothing. ++#else + long flag = TIOCM_RTS; + ioctl(port->porthandle, value?TIOCMBIS:TIOCMBIC, &flag); ++#endif + } + + #endif diff --git a/Ports/dosbox-staging/patches/ReadMe.md b/Ports/dosbox-staging/patches/ReadMe.md index b277fa7c41..722486ab9c 100644 --- a/Ports/dosbox-staging/patches/ReadMe.md +++ b/Ports/dosbox-staging/patches/ReadMe.md @@ -6,20 +6,23 @@ Skip use of glob() in serenity We don't have that yet. -## `0002-Replace-some-size_t-Bitu.patch` - -Replace some size_t => Bitu - -FIXME: No information as to why this is a thing exists as of yet, fill - them in when that stuff is known. - -## `0003-Manually-hardcode-SDL2-library-name.patch` - -Manually hardcode SDL2 library name - - -## `0004-Disable-SDL-s-accelerated-rendering.patch` +## `0002-Disable-SDL-s-accelerated-rendering.patch` Disable SDL's accelerated rendering +## `0003-bios.cpp-Serenity-has-time.h.patch` + +Serenity has time.h + + +## `0004-meson.build-Add-serenity-to-list-of-os-families.patch` + +Add 'serenity' to list of os families + + +## `0005-libserial.cpp-Patch-out-ioctl-flags-we-currently-do-.patch` + +Patch out ioctl flags we currently do not support + +