Subject: [alpine-aports] [PATCH] testing/mame: new aport

From: Taner Tas <[email-masked]>
Date: Fri, 2 Mar 2018 17:29:09 +0000

---
 testing/mame/APKBUILD                    | 214 +++++++++++++++++++++++++++++++
 testing/mame/m68000_archopts.patch       |  17 +++
 testing/mame/mame-musl-workaraound.patch |  22 ++++
 testing/mame/mame.ini                    |  61 +++++++++
 testing/mame/midi.conf                   |   1 +
 testing/mame/nonag.diff                  |  37 ++++++
 6 files changed, 352 insertions(+)
 create mode 100644 testing/mame/APKBUILD
 create mode 100644 testing/mame/m68000_archopts.patch
 create mode 100644 testing/mame/mame-musl-workaraound.patch
 create mode 100644 testing/mame/mame.ini
 create mode 100644 testing/mame/midi.conf
 create mode 100644 testing/mame/nonag.diff

diff --git a/testing/mame/APKBUILD b/testing/mame/APKBUILD
new file mode 100644
index 0000000..aa87424
--- /dev/null
+++ b/testing/mame/APKBUILD
@@ -0,0 +1,214 @@
+# Contributor: Taner Tas <[email-masked]>
+# Maintainer: Taner Tas <[email-masked]>
+pkgname=mame
+pkgver=0.195
+pkgrel=0
+pkgdesc="Multi Arcade Machine Emulator."
+url="http://mamedev.org"
+arch="x86 x86_64 ppc64le armhf aarch64"
+license="GPL-2.0-or-later"
+makedepends="coreutils p7zip nasm dos2unix subversion \
+	clang-dev libxrandr-dev libxinerama-dev alsa-lib-dev python2-dev qt5-qtbase-dev \
+	py3-sphinx sdl2-dev sdl2_ttf-dev expat-dev zlib-dev mesa-dev libxinerama-dev \
+	fontconfig-dev libjpeg-turbo-dev flac-dev lua5.3-dev sqlite-dev portaudio-dev \
+	rapidjson-dev glm-dev qt5-qtbase-dev portmidi-dev"
+subpackages="$pkgname-data::noarch $pkgname-doc $pkgname-common::noarch $pkgname-lang::noarch \
+	$pkgname-tools $pkgname-plugins::noarch $pkgname-arcade $pkgname-mess groovymame \
+	groovymame-arcade:groovyarcade groovymame-mess:groovymess"
+_groovymame_patch="groovymame-${pkgver}.diff"
+_asio_git="https://github.com/chriskohlhoff/asio.git"
+source="https://github.com/mamedev/mame/releases/download/${pkgname}${pkgver/.}/${pkgname}${pkgver/.}s.zip
+	$_groovymame_patch::https://drive.google.com/uc?export=download&id=1OdjvKB2B_vTJKONjjW9rqZ-XZC26vP0k
+	mame.ini
+	midi.conf
+	mame-musl-workaraound.patch
+	nonag.diff
+	m68000_archopts.patch"
+builddir="${srcdir}/${pkgname}-${pkgver}"
+options="!check"
+
+prepare() {
+	cd "$srcdir"
+	if [ ! -d ${pkgname}-${pkgver} ]; then
+		7z x -o"${pkgname}-${pkgver}" ${pkgname}.zip
+	fi
+	cd "$builddir"
+	if [ ! -d 3rdparty/asio.git ]; then
+		rm -rf 3rdparty/asio
+		git clone --depth=1 ${_asio_git} 3rdparty/asio.git
+		ln -sf asio.git/asio/ 3rdparty/
+	fi
+	cd "$builddir"
+	cp -n ${srcdir}/$_groovymame_patch .
+	echo "Converting all non-binary files to Unix format.."
+	find  . -type f -exec dos2unix -s -q {} \;
+	#clang workaraound
+	sed -i -e 's/-flifetime-dse=1//g' scripts/genie.lua
+	mkdir -p vanilla
+	default_prepare
+}
+
+build() {
+	export OVERRIDE_CC=clang
+	export OVERRIDE_CXX=clang++
+	export CFLAGS="$CFLAGS -I/usr/include/lua5.3"
+	export CXXFLAGS="$CFLAGS"
+	export LDFLAGS="$LDFLAGS -L/usr/lib/lua5.3"
+
+	case "$CARCH" in
+		x86|armhf|ppc) _PTR64= ;;
+		*) _PTR64=1 ;;
+	esac
+	case "$CARCH" in
+		x86_64|x86) _NOASM= ;;
+		*) _NOASM=1 ;;
+	esac
+
+_build="make
+	TARGETOS=linux
+	NOWERROR=1
+	DEBUG=
+	VERBOSE=1
+	REGENIE=1
+	OSD=sdl
+	FORCE_DRC_C_BACKEND=
+	PTR64=$_PTR64
+	NOASM=$_NOASM
+	TOOLS=
+	SDL_INI_PATH=/etc/mame
+	USE_SYSTEM_LIB_EXPAT=1
+	USE_SYSTEM_LIB_ZLIB=1
+	USE_SYSTEM_LIB_JPEG=1
+	USE_SYSTEM_LIB_FLAC=1
+	USE_SYSTEM_LIB_LUA=1
+	USE_SYSTEM_LIB_SQLITE3=1
+	USE_SYSTEM_LIB_PORTAUDIO=1
+	USE_SYSTEM_LIB_UV=1
+	USE_SYSTEM_LIB_GLM=1
+	USE_SYSTEM_LIB_RAPIDJSON=1
+	USE_SYSTEM_LIB_PORTMIDI=1
+	USE_SYSTEM_LIB_ASIO="
+
+	cd "$builddir"
+
+	if [ -d src/emu/switchres ]; then
+		patch -p0 -R < $_groovymame_patch
+		patch -p0 -R < "$srcdir"/nonag.diff
+	fi
+
+	$_build TOOLS=1 SUBTARGET=mame
+	mv -f mame vanilla/ || mv -f mame64 vanilla/mame
+	$_build SUBTARGET=arcade
+	mv -f mamearcade vanilla/ || mv -f mamearcade64 vanilla/mamearcade
+	$_build SUBTARGET=mess
+	mv -f mess vanilla/ || mv -f mess64 vanilla/mess
+
+	if [ ! -d src/emu/switchres ]; then
+		patch -p0 < $_groovymame_patch
+		patch -p0 < "$srcdir"/nonag.diff
+		$_build USE_QTDEBUG=0 SUBTARGET=mame
+		$_build USE_QTDEBUG=0 SUBTARGET=arcade
+		$_build USE_QTDEBUG=0 SUBTARGET=mess
+	fi
+}
+
+package() {
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 vanilla/mame "$pkgdir"/usr/bin/mame
+}
+
+common() {
+	cd "$builddir"
+	install -D -m644 "$srcdir"/mame.ini "$subpkgdir"/etc/mame/mame.ini
+	install -D -m644 "$srcdir"/midi.conf "$subpkgdir"/etc/modules-load.d/midi.conf
+	install -d -m755 "$subpkgdir"/usr/share/"$pkgname/roms"
+}
+
+arcade() {
+	pkgdesc="Multi Arcade Machine Emulator - Arcade specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 vanilla/mamearcade "$subpkgdir"/usr/bin/mamearcade
+}
+
+mess() {
+	pkgdesc="Multi Arcade Machine Emulator - Mess specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 vanilla/mess "$subpkgdir"/usr/bin/mess
+}
+
+groovymame() {
+	pkgdesc="Multi Arcade Machine Emulator with Groovymame/Switchres & No-Nag patchset."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mame "$subpkgdir"/usr/bin/groovymame || install -D -m755 mame64 "$subpkgdir"/usr/bin/groovymame
+}
+
+groovyarcade() {
+	desc="Groovymame - Arcade specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mamearcade "$subpkgdir"/usr/bin/groovyarcade || install -D -m755 mamearcade64 "$subpkgdir"/usr/bin/groovyarcade
+	cd "$subpkgdir"/usr/bin/
+	ln -sf groovyarcade arcade
+}
+
+groovymess() {
+	desc="Groovymame - Mess specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mess "$subpkgdir"/usr/bin/groovymess || install -D -m755 mess64 "$subpkgdir"/usr/bin/groovymess
+}
+
+data() {
+	pkgdesc="Distribution files for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pakgname"
+	for i in artwork bgfx hash hlsl ini keymaps samples; do
+		cp -r $i "$subpkgdir"/usr/share/"$pkgname"
+	done
+}
+
+plugins() {
+	pkgdesc="Distribution plugins for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pakgname"
+	cp -r plugins "$subpkgdir"/usr/share/"$pkgname"
+}
+
+tools() {
+	pkgdesc="Tools for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/bin
+	for i in castool chdman floptool imgtool jedutil ldresample ldverify romcmp; do
+		install -sm755 $i "$subpkgdir"/usr/bin
+	done
+}
+
+lang() {
+	pkgdesc="Localization files for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pkgname"
+	cp -r language "$subpkgdir"/usr/share/"$pkgname"/
+}
+
+doc() {
+	pkgdesc="Man pages for ${pkgname} and tools"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/man/man6
+	mkdir -p "$subpkgdir"/usr/share/man/man1
+	gzip -c docs/man/mame.6 > docs/man/mame.6.gz
+	cp docs/man/mame.6.gz "$subpkgdir"/usr/share/man/man6/
+	for i in castool.1 chdman.1 floptool.1 imgtool.1 jedutil.1 ldresample.1 ldverify.1 romcmp.1; do
+		gzip -c docs/man/$i > "$subpkgdir"/usr/share/man/man1/${i}.gz
+	done
+}
+sha512sums="cf39b0785aedbab596f232cceaa2cfbae9c4ac45a9c89a0badc1e619d7965d972f02fc9203c40a4c9aa8c0852fdcc91d6b50528b007885afb2e3f83f4da90589  mame0195s.zip
+3916a2a955716135ebf225c8e5433a07593db1b68e0f24162e08a7b2e03b6f7db6fa600bfe19110209506fc5cbdf9dbf3639451fed7551c4fbc7d3c7a84c745a  groovymame-0.195.diff
+b05e953b7c4be26eaa4ab192279fa62dd2b006069cd963e997295afe6e64b3ba04e5a257c69b008d5bc4b509274646d10b9499970b5c3c36cc86fb4ce18f9266  mame.ini
+8f83ff5a916f4ff8e86c5afbdfe4475f7780bb36c20c78d6d029d0eb0dafd77b3471faa538aca384001d2049dc94c4df3429c67d743adde9fd6329c91e6d19a2  midi.conf
+9335bb200f5026e7a368a52a40ee83cc81848905e9483bfbe0611a935ed7bd7c99fa0eaa80746194e76e4b641e6b7e0bc32b41906a60c2f9ea77e4ba8c8c7d43  mame-musl-workaraound.patch
+fdc84311a74c85d184c796aa61a772c24f583de98f0202d9884c276f58bae7f6125dc86f95395dc783b39493ef99bd221c08ae9fab472bf3526228d06143e000  nonag.diff
+a4d628d4648d28b9ae95f27ecba4a70b999ef11ffde31b31ca3ce2ed2fd4cfcab82ec78e2602309952518fac8c549d0b8b4294f6aa34c1acaa77f012ea13de9e  m68000_archopts.patch"
diff --git a/testing/mame/m68000_archopts.patch b/testing/mame/m68000_archopts.patch
new file mode 100644
index 0000000..46fd4a6
--- /dev/null
+++ b/testing/mame/m68000_archopts.patch
@@ -0,0 +1,17 @@
+Author: Jordi Mallach <[email-masked]>
+Description: Pass $(ARCHOPTS) to standalone m68000 makefile.
+Forwarded: no
+
+Index: mame/src/devices/cpu/m68000/makefile
+===================================================================
+--- mame.orig/src/devices/cpu/m68000/makefile
++++ mame/src/devices/cpu/m68000/makefile
+@@ -25,7 +25,7 @@ clean:
+ 	-@rm -f m68kops.*
+ 
+ m68kmake.o: m68kmake.cpp
+-	$(SILENT) $(CC) -x c++ -std=c++11 -o "$@" -c "$<"
++	$(SILENT) $(CC) -x c++ -std=c++11 $(ARCHOPTS) -o "$@" -c "$<"
+ 
+ m68kmake$(EXE) : m68kmake.o
+ 	@echo Linking $@...
diff --git a/testing/mame/mame-musl-workaraound.patch b/testing/mame/mame-musl-workaraound.patch
new file mode 100644
index 0000000..b4573da
--- /dev/null
+++ b/testing/mame/mame-musl-workaraound.patch
@@ -0,0 +1,22 @@
+--- a/src/lib/netlist/plib/pexception.cpp
++++ b/src/lib/netlist/plib/pexception.cpp
+@@ -11,7 +11,7 @@
+ #include <cfenv>
+ 
+ #if (defined(__x86_64__) || defined(__i386__)) && defined(__linux__)
+-#define HAS_FEENABLE_EXCEPT     (1)
++#define HAS_FEENABLE_EXCEPT     (0)
+ #else
+ #define HAS_FEENABLE_EXCEPT     (0)
+ #endif
+--- a/3rdparty/bx/include/bx/platform.h
++++ b/3rdparty/bx/include/bx/platform.h
+@@ -37,7 +37,7 @@
+ #define BX_CRT_NEWLIB 0
+ 
+ #ifndef BX_CRT_MUSL
+-#	define BX_CRT_MUSL 0
++#	define BX_CRT_MUSL 1
+ #endif // BX_CRT_MUSL
+ 
+ #ifndef BX_CRT_NONE
diff --git a/testing/mame/mame.ini b/testing/mame/mame.ini
new file mode 100644
index 0000000..795634a
--- /dev/null
+++ b/testing/mame/mame.ini
@@ -0,0 +1,61 @@
+#Run "mame -cc" to generate a custom mame.ini file.Then put it into ~/.mame folder. 
+#To see all available options, run "mame -showusage"
+homepath                  .
+rompath                   $HOME/.mame/roms;/usr/share/mame/roms
+hashpath                  /usr/share/mame/hash
+samplepath                $HOME/.mame/samples;/usr/share/mame/samples
+artpath                   $HOME/.mame/artwork;/usr/share/mame/artwork
+ctrlrpath                 /usr/share/mame/ctrlr
+inipath                   $HOME/.mame;/etc/mame
+fontpath                  $HOME/.mame/fonts;/usr/share/mame/fonts
+cheatpath                 $HOME/.mame/cheat;/usr/share/mame/cheat
+crosshairpath             $HOME/.mame/crosshair;/usr/share/mame/crosshair
+pluginspath               $HOME/.mame/plugins/;/usr/share/mame/plugins
+languagepath              /usr/share/mame/language
+swpath                    software
+
+cfg_directory             $HOME/.mame/cfg
+nvram_directory           $HOME/.mame/nvram
+input_directory           $HOME/.mame/inp
+state_directory           $HOME/.mame/sta
+snapshot_directory        $HOME/.mame/snap
+diff_directory            $HOME/.mame/diff
+comment_directory         $HOME/.mame/comments
+
+#Video output method: none, soft, bgfx, opengl
+video                     opengl
+
+#GROOVYMAME SPECIFIC
+#Automatic generation of modelines based on the specified monitor type
+modeline_generation       0
+#Predefined monitor type (http://forum.arcadecontrols.com/index.php/topic,116023.0.html)
+monitor                   arcade_31
+orientation               horizontal
+connector                 auto
+interlace                 1
+doublescan                1
+super_width               2560
+changeres                 1
+powerstrip                0
+lock_system_modes         1
+lock_unsupported_modes    1
+refresh_dont_care         0
+dotclock_min              0
+sync_refresh_tolerance    2.0
+frame_delay               0
+vsync_offset              0
+black_frame_insertion     0
+modeline                  auto
+ps_timing                 auto
+lcd_range                 auto
+crt_range0                auto
+crt_range1                auto
+crt_range2                auto
+crt_range3                auto
+crt_range4                auto
+crt_range5                auto
+crt_range6                auto
+crt_range7                auto
+crt_range8                auto
+crt_range9                auto
+#END OF GROOVYMAME SPECIFIC
diff --git a/testing/mame/midi.conf b/testing/mame/midi.conf
new file mode 100644
index 0000000..30a8665
--- /dev/null
+++ b/testing/mame/midi.conf
@@ -0,0 +1 @@
+snd_virmidi
diff --git a/testing/mame/nonag.diff b/testing/mame/nonag.diff
new file mode 100644
index 0000000..2a7518c
--- /dev/null
+++ b/testing/mame/nonag.diff
@@ -0,0 +1,37 @@
+diff -Nru oldsrc/emu/render.cpp src/emu/render.cpp
+--- oldsrc/emu/render.cpp	2017-08-30 11:43:29.000000000 +1000
++++ src/emu/render.cpp	2017-08-31 20:36:59.010177292 +1000
+@@ -1399,7 +1399,8 @@
+ 		}
+ 
+ 	// if we are not in the running stage, draw an outer box
+-	else
++	// DISABLE WHITE BORDER
++	else if ( !m_manager.machine().options().skip_gameinfo() )
+ 	{
+ 		render_primitive *prim = list.alloc(render_primitive::QUAD);
+ 		set_render_bounds_xy(prim->bounds, 0.0f, 0.0f, (float)m_width, (float)m_height);
+diff -Nru oldsrc/frontend/mame/ui/ui.cpp src/frontend/mame/ui/ui.cpp
+--- oldsrc/frontend/mame/ui/ui.cpp	2017-08-30 11:43:30.000000000 +1000
++++ src/frontend/mame/ui/ui.cpp	2017-08-31 20:48:49.676532160 +1000
+@@ -313,7 +313,8 @@
+ 		switch (state)
+ 		{
+ 		case 0:
+-			if (show_warnings)
++			// DISABLE INTERACTIVE WARNING MESSAGES
++			if (show_gameinfo)
+ 				messagebox_text = machine_info().warnings_string();
+ 			if (!messagebox_text.empty())
+ 			{
+@@ -770,6 +771,10 @@
+ 
+ uint32_t mame_ui_manager::handler_messagebox(render_container &container)
+ {
++	// DISABLE INITIALIZING, LOADING & DECRYPTING MESSAGES
++	if (machine().options().skip_gameinfo())
++		return 0;
++
+ 	draw_text_box(container, messagebox_text.c_str(), ui::text_layout::LEFT, 0.5f, 0.5f, messagebox_backcolor);
+ 	return 0;
+ }
-- 
2.16.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Taner Tas <[email-masked]>
Date: Mon, 16 Apr 2018 21:29:36 +0300

http://mamedev.org
Multi Arcade Machine Emulator.
---
 testing/mame/APKBUILD              | 165 +++++++++++++++++++++++++++++
 testing/mame/fix-musl.patch        |  21 ++++
 testing/mame/m68000_archopts.patch |  17 +++
 testing/mame/mame.ini              |  61 +++++++++++
 testing/mame/midi.conf             |   1 +
 testing/mame/musl-time_t.patch     |  10 ++
 6 files changed, 275 insertions(+)
 create mode 100644 testing/mame/APKBUILD
 create mode 100644 testing/mame/fix-musl.patch
 create mode 100644 testing/mame/m68000_archopts.patch
 create mode 100644 testing/mame/mame.ini
 create mode 100644 testing/mame/midi.conf
 create mode 100644 testing/mame/musl-time_t.patch

diff --git a/testing/mame/APKBUILD b/testing/mame/APKBUILD
new file mode 100644
index 00000000..618f8513
--- /dev/null
+++ b/testing/mame/APKBUILD
@@ -0,0 +1,165 @@
+# Contributor: Taner Tas <[email-masked]>
+# Maintainer: Taner Tas <[email-masked]>
+pkgname=mame
+pkgver=0.196
+pkgrel=0
+pkgdesc="Multi Arcade Machine Emulator."
+url="http://mamedev.org"
+arch="all"
+license="GPL-2.0-or-later"
+makedepends="coreutils p7zip nasm dos2unix clang-dev libxrandr-dev libxinerama-dev
+	alsa-lib-dev python2-dev py3-sphinx sdl2-dev sdl2_ttf-dev expat-dev zlib-dev
+	mesa-dev libxinerama-dev fontconfig-dev libjpeg-turbo-dev flac-dev lua5.3-dev
+	sqlite-dev portaudio-dev rapidjson-dev glm-dev portmidi-dev asio-dev"
+subpackages="$pkgname-data::noarch $pkgname-doc $pkgname-common::noarch $pkgname-lang
+	$pkgname-tools $pkgname-plugins::noarch $pkgname-arcade $pkgname-mess"
+source="https://github.com/mamedev/mame/releases/download/${pkgname}${pkgver/.}/${pkgname}${pkgver/.}s.zip
+	mame.ini
+	midi.conf
+	fix-musl.patch
+	m68000_archopts.patch
+	"
+options="!check"
+
+prepare() {
+	cd "$srcdir"
+	if [ ! -d ${pkgname}-${pkgver} ]; then
+		7z x -o"${pkgname}-${pkgver}" ${pkgname}.zip
+	fi
+	cd "$builddir"
+	echo "Converting all non-binary files to Unix format.."
+	find  . -type f -exec dos2unix -s -q {} \;
+	#clang workaraound
+	sed -i -e 's/-flifetime-dse=1//g' scripts/genie.lua
+	default_prepare
+}
+
+build() {
+	export OVERRIDE_CC=clang
+	export OVERRIDE_CXX=clang++
+	export CFLAGS="$CFLAGS -I/usr/include/lua5.3 -DBX_CRT_MUSL"
+	export CXXFLAGS="$CFLAGS"
+	export LDFLAGS="$LDFLAGS -L/usr/lib/lua5.3"
+
+	case "$CARCH" in
+		x86|armhf) _PTR64=0 SYMBOLS=0;;
+		*) _PTR64=1 ;;
+	esac
+	case "$CARCH" in
+		x86_64|x86) _NOASM=0 ;;
+		*) _NOASM=1 ;;
+	esac
+	case "$CARCH" in
+		s390x) _BIGENDIAN=1 ;;
+		*) _BIGENDIAN=0 ;;
+	esac
+
+_build="make
+	TARGETOS=linux
+	NOWERROR=1
+	DEBUG=0
+	USE_QTDEBUG=0
+	VERBOSE=1
+	REGENIE=1
+	OSD=sdl
+	FORCE_DRC_C_BACKEND=
+	PTR64=$_PTR64
+	NOASM=$_NOASM
+	BIGENDIAN=$_BIGENDIAN
+	TOOLS=
+	SDL_INI_PATH=/etc/mame
+	USE_SYSTEM_LIB_EXPAT=1
+	USE_SYSTEM_LIB_ZLIB=1
+	USE_SYSTEM_LIB_JPEG=1
+	USE_SYSTEM_LIB_FLAC=1
+	USE_SYSTEM_LIB_LUA=1
+	USE_SYSTEM_LIB_SQLITE3=1
+	USE_SYSTEM_LIB_PORTAUDIO=1
+	USE_SYSTEM_LIB_UV=1
+	USE_SYSTEM_LIB_GLM=1
+	USE_SYSTEM_LIB_RAPIDJSON=1
+	USE_SYSTEM_LIB_PORTMIDI=1
+	USE_SYSTEM_LIB_ASIO=1"
+
+	cd "$builddir"
+
+	$_build TOOLS=1 SUBTARGET=mame
+	$_build SUBTARGET=arcade
+	$_build SUBTARGET=mess
+}
+
+package() {
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mame "$pkgdir"/usr/bin/mame || install -D -m755 mame64 "$pkgdir"/usr/bin/mame
+}
+
+common() {
+	cd "$builddir"
+	install -D -m644 "$srcdir"/mame.ini "$subpkgdir"/etc/mame/mame.ini
+	install -D -m644 "$srcdir"/midi.conf "$subpkgdir"/etc/modules-load.d/midi.conf
+	install -d -m755 "$subpkgdir"/usr/share/"$pkgname/roms"
+}
+
+arcade() {
+	pkgdesc="Multi Arcade Machine Emulator - Arcade specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mamearcade "$subpkgdir"/usr/bin/mamearcade || install -D -m755 mamearcade64 "$subpkgdir"/usr/bin/mamearcade
+}
+
+mess() {
+	pkgdesc="Multi Arcade Machine Emulator - Mess specific build."
+	depends="$pkgname-common"
+	cd "$builddir"
+	install -D -m755 mess "$subpkgdir"/usr/bin/mess || install -D -m755 mess64 "$subpkgdir"/usr/bin/mess
+}
+
+data() {
+	pkgdesc="Distribution files for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pakgname"
+	for i in artwork bgfx hash hlsl ini keymaps samples; do
+		cp -r $i "$subpkgdir"/usr/share/"$pkgname"
+	done
+}
+
+plugins() {
+	pkgdesc="Distribution plugins for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pakgname"
+	cp -r plugins "$subpkgdir"/usr/share/"$pkgname"
+}
+
+tools() {
+	pkgdesc="Tools for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/bin
+	for i in castool chdman floptool imgtool jedutil ldresample ldverify romcmp; do
+		install -sm755 $i "$subpkgdir"/usr/bin
+	done
+}
+
+lang() {
+	pkgdesc="Localization files for ${pkgname}"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/"$pkgname"
+	cp -r language "$subpkgdir"/usr/share/"$pkgname"/
+}
+
+doc() {
+	pkgdesc="Man pages for ${pkgname} and tools"
+	cd "$builddir"
+	mkdir -p "$subpkgdir"/usr/share/man/man6
+	mkdir -p "$subpkgdir"/usr/share/man/man1
+	gzip -c docs/man/mame.6 > docs/man/mame.6.gz
+	cp docs/man/mame.6.gz "$subpkgdir"/usr/share/man/man6/
+	for i in castool.1 chdman.1 floptool.1 imgtool.1 jedutil.1 ldresample.1 ldverify.1 romcmp.1; do
+		gzip -c docs/man/$i > "$subpkgdir"/usr/share/man/man1/${i}.gz
+	done
+}
+sha512sums="dfff1f1d0c8fd11e49a0d4d554a229e13c3e10fcb90da54c8b4945bc05ebe936ad31ed96cd5c320a831500db58a48f7ea25b97312f29c94c970c808e64af595d  mame0196s.zip
+b05e953b7c4be26eaa4ab192279fa62dd2b006069cd963e997295afe6e64b3ba04e5a257c69b008d5bc4b509274646d10b9499970b5c3c36cc86fb4ce18f9266  mame.ini
+8f83ff5a916f4ff8e86c5afbdfe4475f7780bb36c20c78d6d029d0eb0dafd77b3471faa538aca384001d2049dc94c4df3429c67d743adde9fd6329c91e6d19a2  midi.conf
+75bba366aebb37de7758368fbf7418194a18d535e61c1768e6c2c5cf4b3b7a2f625ef687cb8278c03daa9e308951df4c0bdcc944dfcc4ce5305f5ac83e5e049b  fix-musl.patch
+a4d628d4648d28b9ae95f27ecba4a70b999ef11ffde31b31ca3ce2ed2fd4cfcab82ec78e2602309952518fac8c549d0b8b4294f6aa34c1acaa77f012ea13de9e  m68000_archopts.patch"
diff --git a/testing/mame/fix-musl.patch b/testing/mame/fix-musl.patch
new file mode 100644
index 00000000..cda91419
--- /dev/null
+++ b/testing/mame/fix-musl.patch
@@ -0,0 +1,21 @@
+--- a/src/lib/netlist/plib/pexception.cpp
++++ b/src/lib/netlist/plib/pexception.cpp
+@@ -10,7 +10,7 @@
+ 
+ #include <cfenv>
+ 
+-#if (defined(__x86_64__) || defined(__i386__)) && defined(__linux__)
++#if (defined(__x86_64__) || defined(__i386__)) && defined(__linux__) && defined(__GLIBC__)
+ #define HAS_FEENABLE_EXCEPT     (1)
+ #else
+ #define HAS_FEENABLE_EXCEPT     (0)
+--- a/3rdparty/bx/include/bx/bx.h
++++ b/3rdparty/bx/include/bx/bx.h
+@@ -11,6 +11,7 @@
+ #include <stdint.h> // uint32_t
+ #include <stdlib.h> // size_t
+ #include <stddef.h> // ptrdiff_t
++#include <time.h>   // time_t
+ 
+ #include "platform.h"
+ #include "config.h"
diff --git a/testing/mame/m68000_archopts.patch b/testing/mame/m68000_archopts.patch
new file mode 100644
index 00000000..46fd4a66
--- /dev/null
+++ b/testing/mame/m68000_archopts.patch
@@ -0,0 +1,17 @@
+Author: Jordi Mallach <[email-masked]>
+Description: Pass $(ARCHOPTS) to standalone m68000 makefile.
+Forwarded: no
+
+Index: mame/src/devices/cpu/m68000/makefile
+===================================================================
+--- mame.orig/src/devices/cpu/m68000/makefile
++++ mame/src/devices/cpu/m68000/makefile
+@@ -25,7 +25,7 @@ clean:
+ 	-@rm -f m68kops.*
+ 
+ m68kmake.o: m68kmake.cpp
+-	$(SILENT) $(CC) -x c++ -std=c++11 -o "$@" -c "$<"
++	$(SILENT) $(CC) -x c++ -std=c++11 $(ARCHOPTS) -o "$@" -c "$<"
+ 
+ m68kmake$(EXE) : m68kmake.o
+ 	@echo Linking $@...
diff --git a/testing/mame/mame.ini b/testing/mame/mame.ini
new file mode 100644
index 00000000..795634a8
--- /dev/null
+++ b/testing/mame/mame.ini
@@ -0,0 +1,61 @@
+#Run "mame -cc" to generate a custom mame.ini file.Then put it into ~/.mame folder. 
+#To see all available options, run "mame -showusage"
+homepath                  .
+rompath                   $HOME/.mame/roms;/usr/share/mame/roms
+hashpath                  /usr/share/mame/hash
+samplepath                $HOME/.mame/samples;/usr/share/mame/samples
+artpath                   $HOME/.mame/artwork;/usr/share/mame/artwork
+ctrlrpath                 /usr/share/mame/ctrlr
+inipath                   $HOME/.mame;/etc/mame
+fontpath                  $HOME/.mame/fonts;/usr/share/mame/fonts
+cheatpath                 $HOME/.mame/cheat;/usr/share/mame/cheat
+crosshairpath             $HOME/.mame/crosshair;/usr/share/mame/crosshair
+pluginspath               $HOME/.mame/plugins/;/usr/share/mame/plugins
+languagepath              /usr/share/mame/language
+swpath                    software
+
+cfg_directory             $HOME/.mame/cfg
+nvram_directory           $HOME/.mame/nvram
+input_directory           $HOME/.mame/inp
+state_directory           $HOME/.mame/sta
+snapshot_directory        $HOME/.mame/snap
+diff_directory            $HOME/.mame/diff
+comment_directory         $HOME/.mame/comments
+
+#Video output method: none, soft, bgfx, opengl
+video                     opengl
+
+#GROOVYMAME SPECIFIC
+#Automatic generation of modelines based on the specified monitor type
+modeline_generation       0
+#Predefined monitor type (http://forum.arcadecontrols.com/index.php/topic,116023.0.html)
+monitor                   arcade_31
+orientation               horizontal
+connector                 auto
+interlace                 1
+doublescan                1
+super_width               2560
+changeres                 1
+powerstrip                0
+lock_system_modes         1
+lock_unsupported_modes    1
+refresh_dont_care         0
+dotclock_min              0
+sync_refresh_tolerance    2.0
+frame_delay               0
+vsync_offset              0
+black_frame_insertion     0
+modeline                  auto
+ps_timing                 auto
+lcd_range                 auto
+crt_range0                auto
+crt_range1                auto
+crt_range2                auto
+crt_range3                auto
+crt_range4                auto
+crt_range5                auto
+crt_range6                auto
+crt_range7                auto
+crt_range8                auto
+crt_range9                auto
+#END OF GROOVYMAME SPECIFIC
diff --git a/testing/mame/midi.conf b/testing/mame/midi.conf
new file mode 100644
index 00000000..30a86650
--- /dev/null
+++ b/testing/mame/midi.conf
@@ -0,0 +1 @@
+snd_virmidi
diff --git a/testing/mame/musl-time_t.patch b/testing/mame/musl-time_t.patch
new file mode 100644
index 00000000..02c11cf0
--- /dev/null
+++ b/testing/mame/musl-time_t.patch
@@ -0,0 +1,10 @@
+--- 3rdparty/bx/include/bx/bx.h	2017-12-27 02:45:37.000000000 +0100
++++ 3rdparty/bx/include/bx/bx.h	2017-12-28 10:58:30.254932880 +0100
+@@ -11,6 +11,7 @@
+ #include <stdint.h> // uint32_t
+ #include <stdlib.h> // size_t
+ #include <stddef.h> // ptrdiff_t
++#include <time.h>   // time_t
+ 
+ #include "platform.h"
+ #include "config.h"
-- 
2.17.0

---

---

From: Natanael Copa <[email-masked]>
Date: Thu, 19 Apr 2018 15:47:18 +0200

On Mon, 16 Apr 2018 21:29:36 +0300

> +++ b/testing/mame/APKBUILD

Is it necessary to extract it with 7z? I though abuild will extract .zip for us.

> +	export OVERRIDE_CXX=clang++

Does it require clang? Can it not be built with gcc?

> +	depends="$pkgname-common"

I think the depends need to be in global scope.

> +	mkdir -p "$subpkgdir"/usr/share/"$pakgname"

pakgname looks like a typo.

> +	mkdir -p "$subpkgdir"/usr/share/"$pakgname"

pakgname looks like a typo

> +	cp -r language "$subpkgdir"/usr/share/"$pkgname"/

Normally we install the files in $pkgdir from package() and let the
default doc function move and compress the manpages to the -doc
subpackage.

---

---

From: Taner Tas <[email-masked]>
Date: Thu, 19 Apr 2018 19:40:36 +0300

On Thu, 19 Apr 2018 15:47:18 +0200

> Is it necessary to extract it with 7z? I though abuild will extract .zip for us.

Distribution file contains another zip file inside. Don't know why.
Actual zip file requires manual intervention and can't be extracted via "unzip". 

> Does it require clang? Can it not be built with gcc?

Package actually builds with gcc. Clang compiles faster.
Also benchmarked both clang and gcc binaries.
Clang binary was smaller and performance is 10% better.

> I think the depends need to be in global scope.
fixed.

> pakgname looks like a typo.
yes. fixed.

> pakgname looks like a typo
yes.fixed.

> default doc function move and compress the manpages to the -doc
I was having some issues with -doc package and decided to use this approach.
Now reverted to normal method.

I'm rebuilding package now. After successfull build I'll send v4.
Thanks for review.

-- 
Taner Tas <[email-masked]>

---

---

From: Taner Tas <[email-masked]>
Date: Fri, 20 Apr 2018 08:40:38 +0300

http://mamedev.org
 testing/mame/APKBUILD              | 160 +++++++++++++++++++++++++++++
 5 files changed, 260 insertions(+)

index 0000000000..2691c547a7
@@ -0,0 +1,160 @@
+depends="$pkgname-common"
+		x86|armhf) _PTR64=0 _SYMBOLS=0;;
+		*) _PTR64=1 _SYMBOLS=1;;
+	SYMBOLS=$_SYMBOLS
+	install -D -m644  docs/man/mame.6  "$pkgdir"/usr/share/man/man6/mame.6
+		install -D -m644 "docs/man/$i"  "$pkgdir"/usr/share/man/man1/"$i"
+	pkgdesc="MAME - Common configuration files"
+	rm -rf "$subpkgdir"/usr/share/"$pkgname"/bgfx/shaders/dx11
+	rm -rf "$subpkgdir"/usr/share/"$pkgname"/bgfx/shaders/dx9
+	rm -rf "$subpkgdir"/usr/share/"$pkgname"/bgfx/shaders/metal
+8b7915eb8bd030d4840942ee2a89b01ba52558d47dc44d51c887c5fe6b704a1e9174f767364b7b1e01889fc0e62066804d23ca742a2a6c572ca792e4f1214a9a  mame.ini
index 0000000000..cda914196c
index 0000000000..46fd4a6630
index 0000000000..1fdd79d901
+modeline_generation       1
+monitor                   lcd
index 0000000000..30a866501c

---

---

From: Taner Tas <[email-masked]>
Date: Mon, 23 Apr 2018 13:54:55 +0300

Hi,

I prepared a new v5 patch and submitted as github PR.
Pleae refer to: https://github.com/alpinelinux/aports/pull/4088

Thanks
-- 
Taner

---

---

From: Taner Tas <[email-masked]>
Date: Sat, 3 Mar 2018 22:12:09 +0000

http://mamedev.org

Please discard previous patch.
---
 testing/mame/APKBUILD                    | 219 +++++++++++++++++++++++++++++++
 testing/mame/m68000_archopts.patch       |  17 +++
 testing/mame/mame-musl-workaraound.patch |  22 ++++
 testing/mame/mame.ini                    |  61 +++++++++
 testing/mame/midi.conf                   |   1 +
 testing/mame/nonag.diff                  |  37 ++++++
 6 files changed, 357 insertions(+)
 create mode 100644 testing/mame/APKBUILD
 create mode 100644 testing/mame/m68000_archopts.patch
 create mode 100644 testing/mame/mame-musl-workaraound.patch
 create mode 100644 testing/mame/mame.ini
 create mode 100644 testing/mame/midi.conf
 create mode 100644 testing/mame/nonag.diff

index 0000000..b6a5896
@@ -0,0 +1,219 @@
+makedepends="coreutils p7zip nasm dos2unix \
+subpackages="$pkgname-data::noarch $pkgname-doc $pkgname-common::noarch $pkgname-lang \
+		x86|armhf) _PTR64= ;;
+		*) _BIGENDIAN= ;;

---