From ceb9f43ed56b3b71dac11595a260fcfd51b1df6b Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Tue, 22 Feb 2022 18:43:09 +1100 Subject: [PATCH] Ports: Add Bochs x86 PC emulator --- Ports/AvailablePorts.md | 1 + Ports/bochs/package.sh | 9 ++++++ Ports/bochs/patches/ReadMe.md | 9 ++++++ Ports/bochs/patches/use-pkg_config-sdl2.patch | 31 +++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100755 Ports/bochs/package.sh create mode 100644 Ports/bochs/patches/ReadMe.md create mode 100644 Ports/bochs/patches/use-pkg_config-sdl2.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index f365bbc6f2..c1f31c486b 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -11,6 +11,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`bc`](bc/) | bc | 5.1.1 | https://github.com/gavinhoward/bc | | [`binutils`](binutils/) | GNU Binutils | 2.38 | https://www.gnu.org/software/binutils/ | | [`bison`](bison/) | GNU Bison | 1.25 | https://www.gnu.org/software/bison/ | +| [`bochs`](bochs/) | Bochs x86 PC emulator | 2.7 | https://sourceforge.net/projects/bochs/ | | [`brogue`](brogue/) | BrogueCE | 1.9.3 | https://github.com/tmewett/BrogueCE | | [`byacc`](byacc/) | Berkeley Yacc | 20210808 | https://invisible-island.net/byacc/byacc.html | | [`bzip2`](bzip2/) | bzip2 | 1.0.8 | https://sourceware.org/bzip2/ | diff --git a/Ports/bochs/package.sh b/Ports/bochs/package.sh new file mode 100755 index 0000000000..a7d55bf445 --- /dev/null +++ b/Ports/bochs/package.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=bochs +version=2.7 +depends=("SDL2") +files="https://download.sourceforge.net/project/bochs/bochs/$version/bochs-$version.tar.gz bochs-${version}.tar.gz a010ab1bfdc72ac5a08d2e2412cd471c0febd66af1d9349bc0d796879de5b17a" +auth_type=sha256 +useconfigure=true +use_fresh_config_sub=true +configopts=("--with-sdl2") diff --git a/Ports/bochs/patches/ReadMe.md b/Ports/bochs/patches/ReadMe.md new file mode 100644 index 0000000000..f736218004 --- /dev/null +++ b/Ports/bochs/patches/ReadMe.md @@ -0,0 +1,9 @@ +# Patches for bochs on SerenityOS + +## `use-pkg_config-sdl2.patch` + +Modifies configure to use `pkg_config` to detect SDL2 installed on +SerenityOS. + +Without this patch, configure uses `sdl2_config` and will detect SDL2 +installed on the host system. diff --git a/Ports/bochs/patches/use-pkg_config-sdl2.patch b/Ports/bochs/patches/use-pkg_config-sdl2.patch new file mode 100644 index 0000000000..174efeb6ac --- /dev/null +++ b/Ports/bochs/patches/use-pkg_config-sdl2.patch @@ -0,0 +1,31 @@ +diff --git a/configure b/configure +index 5cc4088..d2bff12 100755 +--- a/configure ++++ b/configure +@@ -24060,7 +24060,7 @@ fi + fi + $as_echo "#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 + +@@ -24703,14 +24703,14 @@ if test "$with_sdl2" = yes; then + 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