Ports: Add Mednafen

This commit is contained in:
Luke Wilde 2023-02-27 21:26:27 +00:00 committed by Sam Atkins
parent 3112a6b44f
commit 57cc2bab4b
Notes: sideshowbarker 2024-07-17 01:53:23 +09:00
5 changed files with 89 additions and 0 deletions

View file

@ -165,6 +165,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`mbedtls`](mbedtls/) | Mbed TLS | 3.1.0 | https://tls.mbed.org/ |
| [`mc`](mc/) | Midnight Commander | 4.8.29 | https://midnight-commander.org/ |
| [`md4c`](md4c/) | Markdown for C | 0.4.8 | https://github.com/mity/md4c |
| [`mednafen`](mednafen/) | Mednafen (My Emulator Doesn't Need A Frickin' Excellent Name) | 1.31.0-UNSTABLE | https://mednafen.github.io/ |
| [`mgba`](mgba/) | Game Boy, Game Boy Color and Game Boy Advance emulator | 0.9.3 | https://mgba.io/ |
| [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker |
| [`mold`](mold/) | A Modern Linker | 1.5.1 | https://github.com/rui314/mold |

10
Ports/mednafen/package.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env -S bash ../.port_include.sh
port='mednafen'
version='1.31.0-UNSTABLE'
files="https://mednafen.github.io/releases/files/mednafen-${version}.tar.xz mednafen-${version}.tar.xz bfcff72e370e09e12ba3791600782187fbf5e2cc9d6b5fe4f9f3471642046367"
auth_type='sha256'
workdir="mednafen"
useconfigure='true'
use_fresh_config_sub='true'
use_fresh_config_guess='true'
depends=("SDL2" "zlib" "flac")

View file

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luke Wilde <lukew@serenityos.org>
Date: Mon, 27 Feb 2023 20:42:52 +0000
Subject: [PATCH] Make mednafen compile with PIC/PIE
We currently don't support copy relocations and mednafen compiles with
PIC/PIE disabled for performance reasons. This re-enables it and
disables the compiler warning it emits for having it enabled.
---
configure | 2 ++
src/types.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/configure b/configure
index 01b3122038f5223f3c2fbdefc823b2aeb240515d..2d45a1a179374a9441eaef9f08c841983b70a681 100755
--- a/configure
+++ b/configure
@@ -19954,6 +19954,8 @@ cat >>confdefs.h <<_ACEOF
#define MEDNAFEN_VERSION_NUMERIC $MEDNAFEN_VERSION_NUMERIC
_ACEOF
+NOPICPIE_FLAGS=""
+NOPICPIE_LDFLAGS=""
AM_CFLAGS="$ALTIVEC_FLAGS $OPTIMIZER_FLAGS $WARNING_FLAGS $CODEGEN_FLAGS $CODEGEN_CFLAGS $NOPICPIE_FLAGS"
diff --git a/src/types.h b/src/types.h
index 86aedf67812c1270d2b55692fb674fa70f66dbc6..41296bbcd01e82bb93b0a66a00349efd8b4fd603 100644
--- a/src/types.h
+++ b/src/types.h
@@ -14,6 +14,8 @@
#include <config.h>
#endif
+#define MDFN_DISABLE_PICPIE_ERRWARN 1
+
//
//
//

View file

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luke Wilde <lukew@serenityos.org>
Date: Mon, 27 Feb 2023 20:43:34 +0000
Subject: [PATCH] Replace PTHREAD_MUTEX_ERRORCHECK with PTHREAD_MUTEX_NORMAL
We currently don't support the PTHREAD_MUTEX_ERRORCHECK mutex type.
---
src/mthreading/MThreading_POSIX.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mthreading/MThreading_POSIX.cpp b/src/mthreading/MThreading_POSIX.cpp
index ddebafec32385b98b7e2a0a0a98c3a6558cf069a..1acd8ba3780a9dca435f6596c32e7767720316d5 100644
--- a/src/mthreading/MThreading_POSIX.cpp
+++ b/src/mthreading/MThreading_POSIX.cpp
@@ -295,7 +295,7 @@ static void CreateMutex(Mutex* ret)
throw MDFN_Error(ene.Errno(), _("%s failed: %s"), "pthread_mutexattr_init()", ene.StrError());
}
- if((ptec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK/*PTHREAD_MUTEX_NORMAL*/)))
+ if((ptec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL)))
{
ErrnoHolder ene(ptec);

View file

@ -0,0 +1,16 @@
# Patches for mednafen on SerenityOS
## `0001-Make-mednafen-compile-with-PIC-PIE.patch`
Make mednafen compile with PIC/PIE
We currently don't support copy relocations and mednafen compiles with
PIC/PIE disabled for performance reasons. This re-enables it and
disables the compiler warning it emits for having it enabled.
## `0002-Replace-PTHREAD_MUTEX_ERRORCHECK-with-PTHREAD_MUTEX_.patch`
Replace PTHREAD_MUTEX_ERRORCHECK with PTHREAD_MUTEX_NORMAL
We currently don't support the PTHREAD_MUTEX_ERRORCHECK mutex type.