aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mame/APKBUILD
blob: bc67e47575ae1f44d04b7ac6cffe6fbd92f2945c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Contributor: Taner Tas <taner76@gmail.com>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=mame
pkgver=0.214
_pkgver=${pkgver/.}
pkgrel=0
pkgdesc="Multi Arcade Machine Emulator with GroovyMAME/Switchres/No-nag patchset."
url="https://mamedev.org"
arch="all !aarch64"
license="GPL-2.0-or-later"
depends="$pkgname-common"
makedepends="
	alsa-lib-dev
	clang-dev
	coreutils
	dos2unix
	expat-dev
	flac-dev
	fontconfig-dev
	glm-dev
	libjpeg-turbo-dev
	libxi-dev
	libxinerama-dev
	libxrandr-dev
	lua5.3-dev
	mesa-dev
	nasm
	portaudio-dev
	portmidi-dev
	python2-dev
	py3-sphinx
	rapidjson-dev
	sdl2-dev
	sdl2_ttf-dev
	sqlite-dev
	zlib-dev
	"
subpackages="
	$pkgname-common::noarch
	$pkgname-arcade
	$pkgname-mess
	$pkgname-data::noarch
	$pkgname-doc
	$pkgname-lang
	$pkgname-tools
	$pkgname-plugins::noarch
	"
_groovymame_patch=groovymame-$pkgver.diff
source="
	https://github.com/mamedev/mame/archive/$pkgname$_pkgver.tar.gz
	$_groovymame_patch::https://drive.google.com/uc?export=download&id=11cjRkLc4hfLdCVsNCXOua2YQeM_ZD2p-
	mame.ini
	midi.conf
	fix-musl.patch
	nonag.patch
	fix-ppc64le-float.patch
	"
options="!check" # No test suite
builddir="$srcdir"/$pkgname-$pkgname${pkgver/.}

prepare() {
	cd "$builddir"
	default_prepare
	cp "$srcdir"/$_groovymame_patch . && dos2unix $_groovymame_patch
	patch -p0 < $_groovymame_patch
}

build() {
	cd "$builddir"

	case "$CARCH" in
		x86|armhf|armv7) _PTR64=0;;
		*) _PTR64=1;;
	esac

	case "$CARCH" in
		x86_64|x86) _NOASM=0 ;;
		*) _NOASM=1 ;;
	esac

	case "$CARCH" in
		s390x) _BIGENDIAN=1 ;;
		*) _BIGENDIAN=0 ;;
	esac

	case "$CARCH" in
		armhf)
			# clang segfaults on armhf
			true
		;;
		*)
			# clang builds have better benchmark score and smaller size
			export OVERRIDE_CC=clang
			export OVERRIDE_CXX=clang++
			# clang workaraound
			sed -i -e 's/-flifetime-dse=1//g' scripts/genie.lua
		;;
	esac

	export CFLAGS="-I/usr/include/lua5.3 -DBX_CRT_MUSL -Wno-everything"
	export CXXFLAGS="$CFLAGS"
	export LDFLAGS="$LDFLAGS -L/usr/lib/lua5.3"

_build="make
	TARGETOS=linux
	NOWERROR=1
	DEBUG=0
	USE_QTDEBUG=0
	VERBOSE=1
	REGENIE=1
	OSD=sdl
	SYMBOLS=0
	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=0"

	[ -f mame ] || [ -f mame64 ] || $_build TOOLS=1 SUBTARGET=mame
	[ -f mamearcade ] || [ -f mamearcade64 ] || $_build SUBTARGET=arcade
	[ -f mess ] || [ -f mess64 ] || $_build SUBTARGET=mess
}

package() {
	cd "$builddir"
	install -D -m755 mame "$pkgdir"/usr/bin/mame || \
	install -D -m755 mame64 "$pkgdir"/usr/bin/mame
	install -D -m644  docs/man/mame.6  "$pkgdir"/usr/share/man/man6/mame.6
	for i in castool.1 \
		chdman.1 \
		floptool.1 \
		imgtool.1 \
		jedutil.1 \
		ldresample.1 \
		ldverify.1 \
		romcmp.1
	do
		install -D -m644 docs/man/"$i"  "$pkgdir"/usr/share/man/man1/"$i"
	done
}

common() {
	cd "$builddir"
	pkgdesc="MAME - Common configuration files"
	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."
	cd "$builddir"
	install -D -m755 mamearcade "$subpkgdir"/usr/bin/mamearcade || \
	install -D -m755 mamearcade64 "$subpkgdir"/usr/bin/mamearcade
	ln -s mamearcade "$subpkgdir"/usr/bin/arcade
}

mess() {
	pkgdesc="Multi Arcade Machine Emulator - Mess specific build."
	cd "$builddir"
	install -D -m755 mess "$subpkgdir"/usr/bin/mess || \
	install -D -m755 mess64 "$subpkgdir"/usr/bin/mess
}

data() {
	pkgdesc="Distribution data files for MAME"
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/$pkgname
	for i in artwork \
		bgfx \
		hash \
		hlsl \
		ini \
		keymaps \
		samples
	do
		cp -r "$i" "$subpkgdir"/usr/share/$pkgname
	done
	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
}

plugins() {
	pkgdesc="Distribution plugins for MAME"
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/$pkgname
	cp -r plugins "$subpkgdir"/usr/share/$pkgname/
}

tools() {
	pkgdesc="Tools for MAME"
	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 MAME"
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/$pkgname
	cp -r language "$subpkgdir"/usr/share/$pkgname/
}
sha512sums="1c5851c7a95f4f3a312b47ba182f2f8fdfd186e16593d58555c8291174c07d8f18b7c4bec8d26589755e427dc2f29c66404a2dfb4f35dca9b63292b42faaca1c  mame0214.tar.gz
a1bfe6af9ffd0f8ce0c8ee0613d74fb7f1da45b4be62e22c20c4d9a6a6bfeefb9ba41fa90157626cd8ded8aef0380963fd40dd83e6c93aa6444d7107af5be44e  groovymame-0.214.diff
dc008245cbea0b94f58d83e09bf5fd3fff04ac0e2f3a36b910a8b7633c5377419fc67a1fd366ef268e283f744d9a8d29928cfacf456b3edaa2d0b1a11d46a701  mame.ini
8f83ff5a916f4ff8e86c5afbdfe4475f7780bb36c20c78d6d029d0eb0dafd77b3471faa538aca384001d2049dc94c4df3429c67d743adde9fd6329c91e6d19a2  midi.conf
75bba366aebb37de7758368fbf7418194a18d535e61c1768e6c2c5cf4b3b7a2f625ef687cb8278c03daa9e308951df4c0bdcc944dfcc4ce5305f5ac83e5e049b  fix-musl.patch
864816a55f35f9d485ccd143a1e0acd76d47239a6d5344be2a76b50fd4efbdfb4f3e45318d7dfda67faa63c0a52022f2e8313f058965a1eba60e6ca4677a519b  nonag.patch
daa915d08b61e3828b28144f1934fd1fa9fe04da00b3536f86b984035f1a1bc81da498e1bc8632bc5f9c8b86533b70814a91318627fcafc3f05ebda59e303cc4  fix-ppc64le-float.patch"