---
testing/mednafen/01-fix_help.patch | 25 +++++++++++++
testing/mednafen/02-sdl_by_default.patch | 11 ++++++
testing/mednafen/APKBUILD | 64 ++++++++++++++++++++++++++++++++
3 files changed, 100 insertions(+)
create mode 100644 testing/mednafen/01-fix_help.patch
create mode 100644 testing/mednafen/02-sdl_by_default.patch
create mode 100644 testing/mednafen/APKBUILD
diff --git a/testing/mednafen/01-fix_help.patch b/testing/mednafen/01-fix_help.patch
new file mode 100644
index 0000000..f05798e
--- /dev/null
+++ b/testing/mednafen/01-fix_help.patch
@@ -0,0 +1,25 @@
+--- origin/src/drivers/main.cpp
++++ mednafen/src/drivers/main.cpp
+@@ -696,7 +696,7 @@
+ if(argc <= 1)
+ {
+ printf(_("No command-line arguments specified.\n\n"));
+- printf(usage_string, argv[0]);
++ printf(usage_string, "/usr/bin/mednafen");
+ printf(_("\tPlease refer to the documentation for option parameters and usage.\n\n"));
+ return(0);
+ }
+@@ -713,11 +713,11 @@
+
+ if(ShowCLHelp)
+ {
+- printf(usage_string, argv[0]);
++ printf(usage_string, "/usr/bin/mednafen");
+ ShowArgumentsHelp(MDFNArgs, false);
+ printf("\n");
+ printf(_("Each setting(listed in the documentation) can also be passed as an argument by prefixing the name with a hyphen,\nand specifying the value to change the setting to as the next argument.\n\n"));
+- printf(_("For example:\n\t%s -pce.stretch aspect -pce.pixshader autoipsharper \"Hyper Bonk Soldier.pce\"\n\n"), argv[0]);
++ printf(_("For example:\n\t/usr/bin/mednafen -pce.stretch aspect -pce.pixshader autoipsharper \"Hyper Bonk Soldier.pce\"\n\n"));
+ printf(_("Settings specified in this manner are automatically saved to the configuration file, hence they\ndo not need to be passed to future invocations of the Mednafen executable.\n"));
+ printf("\n");
+ return(0);
diff --git a/testing/mednafen/02-sdl_by_default.patch b/testing/mednafen/02-sdl_by_default.patch
new file mode 100644
index 0000000..e5c10e5
--- /dev/null
+++ b/testing/mednafen/02-sdl_by_default.patch
@@ -0,0 +1,11 @@
+--- origin/include/mednafen/drivers/main.cpp
++++ mednafen/include/mednafen/drivers/main.cpp
+@@ -183,7 +183,7 @@
+ { "netplay.smallfont", MDFNSF_NOFLAGS, gettext_noop("Use small(tiny!) font for netplay chat console."), NULL, MDFNST_BOOL, "0" },
+
+ { "video.fs", MDFNSF_NOFLAGS, gettext_noop("Enable fullscreen mode."), NULL, MDFNST_BOOL, "0", },
+- { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "opengl", NULL, NULL, NULL,NULL, VDriver_List },
++ { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "sdl", NULL, NULL, NULL,NULL, VDriver_List },
+ { "video.glvsync", MDFNSF_NOFLAGS, gettext_noop("Attempt to synchronize OpenGL page flips to vertical retrace period."),
+ gettext_noop("Note: Additionally, if the environment variable \"__GL_SYNC_TO_VBLANK\" does not exist, then it will be created and set to the value specified for this setting. This has the effect of forcibly enabling or disabling vblank synchronization when running under Linux with NVidia's drivers."),
+ MDFNST_BOOL, "1" },
diff --git a/testing/mednafen/APKBUILD b/testing/mednafen/APKBUILD
new file mode 100644
index 0000000..7bd83b1
--- /dev/null
+++ b/testing/mednafen/APKBUILD
@@ -0,0 +1,64 @@
+# Contributor: August Klein <amatcoder@gmail.com>
+# Maintainer: August Klein <amatcoder@gmail.com>
+pkgname=mednafen
+pkgver=0.9.36.5
+pkgrel=0
+pkgdesc="A command-line multi-system emulator"
+url="http://mednafen.sourceforge.net"
+arch="all"
+license="GPL2"
+depends=""
+depends_dev="alsa-lib-dev libcdio-dev libsndfile-dev sdl-dev zlib-dev"
+makedepends="$depends_dev mesa-dev glu-dev paxctl"
+install=""
+subpackages=""
+source="https://prdownloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
+ 01-fix_help.patch
+ 02-sdl_by_default.patch"
+
+_builddir="$srcdir"/$pkgname
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr || return 1
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+
+ mv -f "$pkgdir"/usr/bin/mednafen "$pkgdir"/usr/bin/mednafen-bin || return 1
+ libgl=$(scanelf -qF '#F%S' /usr/lib/libGL.so)
+ cat > "$pkgdir"/usr/bin/mednafen << __EOF__
+#!/bin/sh
+
+# as a workaround for libGL's initial-exec TLS we preload libgl
+# https://bugs.freedesktop.org/show_bug.cgi?id=35268
+
+LD_PRELOAD=$libgl exec /usr/bin/mednafen-bin "\$@"
+__EOF__
+
+ chmod 755 "$pkgdir"/usr/bin/mednafen
+ paxctl -c -m "$pkgdir"/usr/bin/mednafen-bin
+}
+
+md5sums="a0841f0073322414858c22e247344502 mednafen-0.9.36.5.tar.bz2
+0eca9d6e2b75e1687c231130994e9ec6 01-fix_help.patch
+af94272d82816ca74db585c7c5f96bf6 02-sdl_by_default.patch"
+sha256sums="1f3ac7dd705e71a77ccbac0e74e07609bb90b15dfdce04d8f452d8cddd878d0e mednafen-0.9.36.5.tar.bz2
+3428cd835d68dda2476b01facbf46d960d24deffbbaa58a70ce8b84d6081583f 01-fix_help.patch
+22744df0ece6e67d2c61d8f014e3dbe65d3f425819be742e547a07e676efc5ee 02-sdl_by_default.patch"
+sha512sums="76e8534f91f70100d0e0c0c3e490c71929cce24b47880d1271eaf7d581ec488427194c23ba96d6400ad4d0a80134479442b8a5448776d484dbf4d1940deb61da mednafen-0.9.36.5.tar.bz2
+55110e6b3d62d716e6c572a2abbc3914d10461b90ae6a1b2a433c4508fb17bca1ac7010cb3bd25938b937744725c577dae177a598ce4142dfc4da53f3a54f6c2 01-fix_help.patch
+ab52224218c972a2f5f470ad5fe2db7fc37422466c1edd3c6170feefafbf6b55c83b5f92b09fc86648444e835a8b38b0a773b9aae462fa5d3a3c203ef534c574 02-sdl_by_default.patch"
--
2.1.3
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
On Wed, Nov 12, 2014 at 05:28:52PM +0000, AmatCoder wrote:
> --- /dev/null
> +++ b/testing/mednafen/01-fix_help.patch
> @@ -0,0 +1,25 @@
> +--- origin/src/drivers/main.cpp
> ++++ mednafen/src/drivers/main.cpp
> +@@ -696,7 +696,7 @@
> + if(argc <= 1)
> + {
> + printf(_("No command-line arguments specified.\n\n"));
> +- printf(usage_string, argv[0]);
> ++ printf(usage_string, "/usr/bin/mednafen");
>
It looks like this diff is basically 's_argv[0]_"/usr/bin/mednafen"_g'
And I'm wondering what the benefit of that is, because every program
I have seen uses argv[0], a synonym thereof, or even basename(argv[0]).
In fact, *not* having the full path unless it was specified is something
I'd find desireable enough to justify a patch.
Thanks,
Isaac Dunham
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
That patch is because a wrapper is needed to make it work.
Mednafen requires LD_PRELOAD=libGL.so because this library is not
found by dlopen() with musl (same issue than firefox):
https://bugs.freedesktop.org/show_bug.cgi?id=35268
So we need to rename executable to 'mednafen-bin' and to create a script
called 'mednafen' to process:
'LD_PRELOAD=libGL.so exec mednafen-bin $@'
Then, argv[0] points to '/usr/bin/mendnafen-bin'
which is not correct.
argv[0] it is only used when invoking '--help' so I changed to avoid
confusion.
Regards.
2014-11-12 18:36 GMT+00:00 Isaac Dunham <ibid.ag@gmail.com>:
> On Wed, Nov 12, 2014 at 05:28:52PM +0000, AmatCoder wrote:
> > --- /dev/null
> > +++ b/testing/mednafen/01-fix_help.patch
> > @@ -0,0 +1,25 @@
> > +--- origin/src/drivers/main.cpp
> > ++++ mednafen/src/drivers/main.cpp
> > +@@ -696,7 +696,7 @@
> > + if(argc <= 1)
> > + {
> > + printf(_("No command-line arguments specified.\n\n"));
> > +- printf(usage_string, argv[0]);
> > ++ printf(usage_string, "/usr/bin/mednafen");
> >
> It looks like this diff is basically 's_argv[0]_"/usr/bin/mednafen"_g'
>
> And I'm wondering what the benefit of that is, because every program
> I have seen uses argv[0], a synonym thereof, or even basename(argv[0]).
> In fact, *not* having the full path unless it was specified is something
> I'd find desireable enough to justify a patch.
>
> Thanks,
> Isaac Dunham
>
>
>
Ah, yes, you are right. It should not to be the full path, only the name of
executable.
I will change tomorrow.
Thanks
2014-11-12 19:57 GMT+00:00 Isaac Dunham <ibid.ag@gmail.com>:
>
> Thanks for the explanation.
> What I'd meant to comment on was that argv[0] does not include the path
> unless you specify it in the command line: most people would run it as
> "mednafen ...", so 's/argv[0]/mednafen/g' would be nicer.
>
> Thank you,
> Isaac Dunham
>