From 0be4a3b635fd66e07c85cce700b4e89e14e754ff Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Sat, 5 Aug 2023 10:26:24 +0100 Subject: [PATCH] Ports/doom: Use upstream doomgeneric SDL port Doing this means we no longer need to maintain our own Doom fork and we get the newest features of the upstream repository, such as sound effects and music. --- Ports/AvailablePorts.md | 2 +- Ports/doom/package.sh | 29 +++++++++---- ...001-Update-the-makefile-for-serenity.patch | 43 +++++++++++++++++++ .../0002-Use-SDL-software-renderer.patch | 22 ++++++++++ Ports/doom/patches/ReadMe.md | 12 ++++++ 5 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 Ports/doom/patches/0001-Update-the-makefile-for-serenity.patch create mode 100644 Ports/doom/patches/0002-Use-SDL-software-renderer.patch create mode 100644 Ports/doom/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 9839c1a1041..6d862bb2376 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -51,7 +51,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`dialog`](dialog/) | Dialog | 1.3-20220526 | https://invisible-island.net/dialog/ | | [`diffutils`](diffutils/) | GNU Diffutils | 3.8 | https://www.gnu.org/software/diffutils/ | | [`dmidecode`](dmidecode/) | dmidecode | 3.5 | https://github.com/mirror/dmidecode | -| [`doom`](doom/) | DOOM | | https://github.com/SerenityOS/SerenityDOOM | +| [`doom`](doom/) | DOOM | | https://github.com/ozkl/doomgeneric | | [`dos2unix`](dos2unix/) | dos2unix | 7.5.0 | https://waterlan.home.xs4all.nl/dos2unix.html | | [`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/ | diff --git a/Ports/doom/package.sh b/Ports/doom/package.sh index 3144c515902..0d38aa31486 100755 --- a/Ports/doom/package.sh +++ b/Ports/doom/package.sh @@ -1,10 +1,21 @@ #!/usr/bin/env -S bash ../.port_include.sh -port=doom -workdir=SerenityDOOM-master -version=git -files="https://github.com/SerenityPorts/SerenityDOOM/archive/master.tar.gz doom-git.tar.gz" -makeopts=("-C" "doomgeneric/") -installopts=("-C" "doomgeneric/") -launcher_name=Doom -launcher_category=Games -launcher_command=doom +port='doom' +commit_hash='613f870b6fa83ede448a247de5a2571092fa729d' +workdir="doomgeneric-${commit_hash}" +version='git' +files="https://github.com/ozkl/doomgeneric/archive/${commit_hash}.tar.gz doom-git.tar.gz fabc3e41aca92f58dfdd284754891c17875ec8c995948b49396ead6bc05b8676" +depends=( + 'SDL2' + 'SDL2_mixer' +) +makeopts=( + '--directory=doomgeneric/' + '--file=Makefile.sdl' +) +installopts=( + '--directory=doomgeneric/' + '--file=Makefile.sdl' +) +launcher_name='Doom' +launcher_category='Games' +launcher_command='/usr/local/bin/doom' diff --git a/Ports/doom/patches/0001-Update-the-makefile-for-serenity.patch b/Ports/doom/patches/0001-Update-the-makefile-for-serenity.patch new file mode 100644 index 00000000000..1e9f876780e --- /dev/null +++ b/Ports/doom/patches/0001-Update-the-makefile-for-serenity.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tim Ledbetter +Date: Sat, 5 Aug 2023 09:57:15 +0100 +Subject: [PATCH] Update the makefile for serenity + +--- + doomgeneric/Makefile.sdl | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/doomgeneric/Makefile.sdl b/doomgeneric/Makefile.sdl +index 38402da57ac889901b7080341a842a2acbdfe90b..742354b198afdfb9be22d1c4569ce57c86a11c46 100644 +--- a/doomgeneric/Makefile.sdl ++++ b/doomgeneric/Makefile.sdl +@@ -12,18 +12,18 @@ else + endif + + +-SDL_CFLAGS = `sdl2-config --cflags` +-SDL_LIBS = `sdl2-config --cflags --libs` -lSDL2_mixer ++SDL_CFLAGS = -I$(SERENITY_INSTALL_ROOT)/usr/local/include/SDL2 -D_REENTRANT ++SDL_LIBS = -L$(SERENITY_INSTALL_ROOT)/usr/local/lib -lSDL2 -lSDL2_mixer + + +-CC=clang # gcc or g++ ++CC?=x86_64-pc-serenity-gcc + CFLAGS+=-DFEATURE_SOUND $(SDL_CFLAGS) + LDFLAGS+= + LIBS+=-lm -lc $(SDL_LIBS) + + # subdirectory for objects + OBJDIR=build +-OUTPUT=doomgeneric ++OUTPUT=doom + + SRC_DOOM = dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_sdl.o mus2mid.o i_sdlmusic.o i_sdlsound.o + OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM)) +@@ -53,3 +53,6 @@ $(OBJDIR)/%.o: %.c + print: + @echo OBJS: $(OBJS) + ++install: ++ mkdir -p $(DESTDIR)/usr/local/bin ++ cp $(OUTPUT) $(DESTDIR)/usr/local/bin diff --git a/Ports/doom/patches/0002-Use-SDL-software-renderer.patch b/Ports/doom/patches/0002-Use-SDL-software-renderer.patch new file mode 100644 index 00000000000..2847e15c803 --- /dev/null +++ b/Ports/doom/patches/0002-Use-SDL-software-renderer.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tim Ledbetter +Date: Sat, 5 Aug 2023 09:55:31 +0100 +Subject: [PATCH] Use SDL software renderer + +--- + doomgeneric/doomgeneric_sdl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doomgeneric/doomgeneric_sdl.c b/doomgeneric/doomgeneric_sdl.c +index fd4236a83be0f99fce777c494f3b92faa341567f..725339d818fd6c969f431c181eb5c69fd7c765c6 100644 +--- a/doomgeneric/doomgeneric_sdl.c ++++ b/doomgeneric/doomgeneric_sdl.c +@@ -141,7 +141,7 @@ void DG_Init(){ + ); + + // Setup renderer +- renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED); ++ renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_SOFTWARE); + // Clear winow + SDL_RenderClear( renderer ); + // Render the rect to the screen diff --git a/Ports/doom/patches/ReadMe.md b/Ports/doom/patches/ReadMe.md new file mode 100644 index 00000000000..c6168773e15 --- /dev/null +++ b/Ports/doom/patches/ReadMe.md @@ -0,0 +1,12 @@ +# Patches for doom on SerenityOS + +## `0001-Update-the-makefile-for-serenity.patch` + +Update the makefile for serenity + + +## `0002-Use-SDL-software-renderer.patch` + +Use SDL software renderer + +