From fe9a8b542ad8990721f378776dac58bfd6486a04 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 28 Jun 2025 20:52:52 +0300 Subject: [PATCH] ports: Add bochs port THIS IS SUPER SLOW --- ports/bochs/build.sh | 10 +++++ .../patches/0001-Add-banan_os-target.patch | 12 ++++++ ports/bochs/patches/0002-Fix-includes.patch | 38 ++++++++++++++++++ .../0003-use-pkg-condif-for-SDL2.patch | 39 +++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100755 ports/bochs/build.sh create mode 100644 ports/bochs/patches/0001-Add-banan_os-target.patch create mode 100644 ports/bochs/patches/0002-Fix-includes.patch create mode 100644 ports/bochs/patches/0003-use-pkg-condif-for-SDL2.patch diff --git a/ports/bochs/build.sh b/ports/bochs/build.sh new file mode 100755 index 00000000..6ac52c5c --- /dev/null +++ b/ports/bochs/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash ../install.sh + +NAME='bochs' +VERSION='3.0' +DOWNLOAD_URL="https://sourceforge.net/projects/bochs/files/bochs/$VERSION/bochs-$VERSION.tar.gz#cb6f542b51f35a2cc9206b2a980db5602b7cd1b7cf2e4ed4f116acd5507781aa" +DEPENDENCIES=('SDL2') +CONFIGURE_OPTIONS=( + '--with-sdl2' + '--enable-x86-64' +) diff --git a/ports/bochs/patches/0001-Add-banan_os-target.patch b/ports/bochs/patches/0001-Add-banan_os-target.patch new file mode 100644 index 00000000..45ca57be --- /dev/null +++ b/ports/bochs/patches/0001-Add-banan_os-target.patch @@ -0,0 +1,12 @@ +diff -ruN bochs-2.8/config.sub bochs-2.8-banan_os/config.sub +--- bochs-2.8/config.sub 2024-03-10 08:59:37.000000000 +0200 ++++ bochs-2.8-banan_os/config.sub 2024-12-07 05:15:32.948901314 +0200 +@@ -1368,7 +1368,7 @@ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ +- | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*) ++ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* | banan_os*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + qnx*) diff --git a/ports/bochs/patches/0002-Fix-includes.patch b/ports/bochs/patches/0002-Fix-includes.patch new file mode 100644 index 00000000..f9d1f653 --- /dev/null +++ b/ports/bochs/patches/0002-Fix-includes.patch @@ -0,0 +1,38 @@ +diff -ruN bochs-3.0/bochs.h bochs-3.0-banan_os/bochs.h +--- bochs-3.0/bochs.h 2024-03-10 08:59:37.000000000 +0200 ++++ bochs-3.0-banan_os/bochs.h 2025-04-15 20:46:58.442339461 +0300 +@@ -91,6 +91,9 @@ + #endif + #include + #include ++#if defined(__banan_os__) ++# include ++#endif + #include + #include + #ifdef macintosh +diff -ruN bochs-3.0/iodev/serial.cc bochs-3.0-banan_os/iodev/serial.cc +--- bochs-3.0/iodev/serial.cc 2024-03-10 08:59:37.000000000 +0200 ++++ bochs-3.0-banan_os/iodev/serial.cc 2025-04-15 20:49:42.493314963 +0300 +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #define closesocket(s) close(s) + typedef int SOCKET; + #else +diff -ruN bochs-3.0/gui/keymap.cc bochs-3.0-banan_os/gui/keymap.cc +--- bochs-3.0/gui/keymap.cc 2025-02-16 11:15:29.000000000 +0200 ++++ bochs-3.0-banan_os/gui/keymap.cc 2025-06-25 19:17:34.077048625 +0300 +@@ -30,6 +30,10 @@ + #include "gui.h" + #include "keymap.h" + ++#ifdef __banan_os__ ++# include ++#endif ++ + // Table of bochs "BX_KEY_*" symbols + // the table must be in BX_KEY_* order + const char *bx_key_symbol[BX_KEY_NBKEYS] = { diff --git a/ports/bochs/patches/0003-use-pkg-condif-for-SDL2.patch b/ports/bochs/patches/0003-use-pkg-condif-for-SDL2.patch new file mode 100644 index 00000000..0359be61 --- /dev/null +++ b/ports/bochs/patches/0003-use-pkg-condif-for-SDL2.patch @@ -0,0 +1,39 @@ +diff -ruN bochs-2.8/configure bochs-2.8-banan_os/configure +--- bochs-2.8/configure 2024-03-10 08:59:37.000000000 +0200 ++++ bochs-2.8-banan_os/configure 2025-06-25 16:18:01.081403116 +0300 +@@ -25286,7 +25286,7 @@ + elif test "$with_sdl2" = yes; then + SOUNDLOW_OBJS="$SOUNDLOW_OBJS soundsdl.o" + if test "$bx_plugins" = 1; then +- SDL_SOUND_LINK_OPTS="$SDL_SOUND_LINK_OPTS `sdl2-config --libs`" ++ SDL_SOUND_LINK_OPTS="$SDL_SOUND_LINK_OPTS `pkg-config sdl2 --libs`" + fi + soundlow_drivers="$soundlow_drivers sdl" + if test "$soundlow_default" = "dummy"; then +@@ -25294,7 +25294,7 @@ + fi + printf "%s\n" "#define BX_HAVE_SOUND_SDL 1" >>confdefs.h + +- SDL2_VERSION=`sdl2-config --version` ++ SDL2_VERSION=`pkg-config sdl2 --version` + # SDL version >= 2.0.5 supports audio capture + sdl2_audio_capture=0 + +@@ -25967,14 +25967,14 @@ + SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_SDL2)" + # GUI_*FLAGS are added to the compilation of every bochs file, not just + # the files in gui/*.cc. +- SDL2_CFLAGS=`sdl2-config --cflags` ++ SDL2_CFLAGS=`pkg-config sdl2 --cflags` + GUI_CFLAGS="$GUI_CFLAGS $SDL2_CFLAGS" + GUI_CXXFLAGS="$GUI_CXXFLAGS $SDL2_CFLAGS" +- GUI_LINK_OPTS_SDL2="`sdl2-config --libs`" ++ GUI_LINK_OPTS_SDL2="`pkg-config sdl2 --libs`" + GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_SDL2)" + # The plugin version uses multi-threading support in Bochs core + if test "$bx_plugins" = 1; then +- NONPLUGIN_GUI_LINK_OPTS="`sdl2-config --libs`" ++ NONPLUGIN_GUI_LINK_OPTS="`pkg-config sdl2 --libs`" + fi + # The enhanced X debugger depends on GTK2 + if test "$gui_debugger" = 1 -a "$DEFAULT_GUI" != win32; then