From 81a2f09a800cfe69c45ba5da03df34f2a0b9ad40 Mon Sep 17 00:00:00 2001 From: EWouters <6179932+EWouters@users.noreply.github.com> Date: Sat, 7 May 2022 03:19:44 +0200 Subject: [PATCH] Ports: Return `nesalizer` to upstream This makes https://github.com/SerenityPorts/nesalizer obsolete. The patch that hardcoded the SDL2 location is removed. The the patches to the `Makefile` are quashed. A new install function is added. --- Ports/AvailablePorts.md | 2 +- Ports/nesalizer/package.sh | 13 ++++-- .../0001-Add-Serenity-to-Makefile.patch | 42 +++++++++++++++++++ .../patches/0002-Disable-backtracing.patch | 42 +++++++++++++++++++ Ports/nesalizer/patches/ReadMe.md | 14 +++++++ 5 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 Ports/nesalizer/patches/0001-Add-Serenity-to-Makefile.patch create mode 100644 Ports/nesalizer/patches/0002-Disable-backtracing.patch create mode 100644 Ports/nesalizer/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 984e6a51b8..202faf615f 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -149,7 +149,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`ncdu`](ncdu/) | Ncdu | 1.16 | https://dev.yorhel.nl/ncdu | | [`ncurses`](ncurses/) | ncurses | 6.3 | https://invisible-island.net/ncurses/announce.html | | [`neofetch`](neofetch/) | neofetch | 7.1.0 | https://github.com/dylanaraps/neofetch | -| [`nesalizer`](nesalizer/) | Nesalizer | | https://github.com/SerenityOS/nesalizer | +| [`nesalizer`](nesalizer/) | Nesalizer | 5bb0458 | https://github.com/ulfalizer/nesalizer | | [`nethack`](nethack/) | nethack | 3.6.6 | https://www.nethack.org/ | | [`ninja`](ninja/) | Ninja | 1.10.2 | https://ninja-build.org/ | | [`nippon`](nippon/) | Nippon Safes Inc. | 1.0 | https://www.scummvm.org/games/#games-nippon | diff --git a/Ports/nesalizer/package.sh b/Ports/nesalizer/package.sh index 4a2075e69f..fa63863ca9 100755 --- a/Ports/nesalizer/package.sh +++ b/Ports/nesalizer/package.sh @@ -1,7 +1,12 @@ #!/usr/bin/env -S bash ../.port_include.sh port=nesalizer -version=git -workdir=${port}-master -makeopts=("CONF=release" "EXTRA=-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2") -files="https://github.com/SerenityPorts/nesalizer/archive/master.zip nesalizer-master.zip" +version=5bb045845a5cc829a78b7384f848fdd886cd98c8 +files="https://github.com/ulfalizer/nesalizer/archive/${version}.tar.gz ${port}-${version}.tar.gz 4282cb0e4af0585af4a594dfa30b2e350dd0efc39e5bc2d8312f637f50397107" +auth_type=sha256 depends=("SDL2") +makeopts+=("CONF=release") + +install() { + run mkdir -p "${SERENITY_INSTALL_ROOT}/usr/local/bin/" + run cp build/nesalizer "${SERENITY_INSTALL_ROOT}/usr/local/bin/" +} diff --git a/Ports/nesalizer/patches/0001-Add-Serenity-to-Makefile.patch b/Ports/nesalizer/patches/0001-Add-Serenity-to-Makefile.patch new file mode 100644 index 0000000000..5e85714473 --- /dev/null +++ b/Ports/nesalizer/patches/0001-Add-Serenity-to-Makefile.patch @@ -0,0 +1,42 @@ +From 9a0103cf47963ff94d97885787993048cc5c4680 Mon Sep 17 00:00:00 2001 +From: Dan MacDonald +Date: Sun, 8 Dec 2019 17:30:52 +0000 +Subject: [PATCH 1/2] Add Serenity to Makefile + +- Add `-lSDL2 -lgui -lipc -lgfx -lcore -lpthread -lregex` +- Disable RTTI +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 527a3d0..fa1b849 100644 +--- a/Makefile ++++ b/Makefile +@@ -58,7 +58,7 @@ c_objects = $(addprefix $(BUILD_DIR)/,$(c_sources:=.o)) + objects = $(c_objects) $(cpp_objects) + deps = $(addprefix $(BUILD_DIR)/,$(c_sources:=.d) $(cpp_sources:=.d)) + +-LDLIBS := $(shell sdl2-config --libs) -lrt ++LDLIBS := -lSDL2 -lgui -lipc -lgfx -lcore -lpthread -lregex + + ifeq ($(INCLUDE_DEBUGGER),1) + LDLIBS += -lreadline +@@ -105,12 +105,12 @@ else ifneq ($(MAKECMDGOALS),clean) + endif + + ifneq ($(findstring debug,$(CONF)),) +- compile_flags += -ggdb ++ compile_flags += -ggdb -fno-rtti + endif + ifneq ($(findstring release,$(CONF)),) + # Including -Ofast when linking (by including $(optimizations)) gives a + # different binary size. Might be worth investigating why. +- compile_flags += $(optimizations) -DOPTIMIZING ++ compile_flags += $(optimizations) -DOPTIMIZING -fno-rtti + link_flags += $(optimizations) -fuse-linker-plugin + endif + +-- +2.36.1 + diff --git a/Ports/nesalizer/patches/0002-Disable-backtracing.patch b/Ports/nesalizer/patches/0002-Disable-backtracing.patch new file mode 100644 index 0000000000..a13736fd47 --- /dev/null +++ b/Ports/nesalizer/patches/0002-Disable-backtracing.patch @@ -0,0 +1,42 @@ +From 34b8a26412d6e0880516e881c20ec336e6a450b7 Mon Sep 17 00:00:00 2001 +From: Dan MacDonald +Date: Sun, 8 Dec 2019 17:25:35 +0000 +Subject: [PATCH 2/2] Disable backtracing + +--- + src/common.cpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/common.cpp b/src/common.cpp +index 33df846..4dd9e9c 100644 +--- a/src/common.cpp ++++ b/src/common.cpp +@@ -1,6 +1,6 @@ + #include "common.h" + +-#include ++// #include + #include + + // +@@ -96,7 +96,7 @@ void errno_fail(int errno_val, char const *format, ...) { + static void fatal_signal_handler(int sig) { + // Use non-async-signal-safe functions. Likely to work in practice. + +- static void *backtrace_buffer[100]; ++ /*static void *backtrace_buffer[100]; + static char addr2line_cmd_buf[100]; + + fprintf(stderr, "caught fatal signal '%s'. Backtrace:\n\n", strsignal(sig)); +@@ -123,7 +123,7 @@ static void fatal_signal_handler(int sig) { + fputs("failed to write address to addr2line\n", stderr); + abort(); + } +- ++ */ + abort(); + } + +-- +2.36.1 + diff --git a/Ports/nesalizer/patches/ReadMe.md b/Ports/nesalizer/patches/ReadMe.md new file mode 100644 index 0000000000..1547078cf1 --- /dev/null +++ b/Ports/nesalizer/patches/ReadMe.md @@ -0,0 +1,14 @@ +# Patches for nesalizer on SerenityOS + +## `0001-Add-Serenity-to-Makefile.patch` + +Add Serenity to Makefile + +- Add `-lSDL2 -lgui -lipc -lgfx -lcore -lpthread -lregex` +- Disable RTTI + +## `0002-Disable-backtracing.patch` + +Disable backtracing + +