mame-0.210.recipe revision 3d15321a
1SUMMARY="A multi-purpose emulation framework"
2DESCRIPTION="MAME\'s purpose is to preserve decades of software history. As \
3electronic technology continues to rush forward, MAME prevents this important \
4\"vintage\" software from being lost and forgotten. This is achieved by \
5documenting the hardware and how it functions. The source code to MAME \
6serves as this documentation. The fact that the software is usable serves \
7primarily to validate the accuracy of the documentation (how else can you \
8prove that you have recreated the hardware faithfully?). Over time, MAME \
9(originally stood for Multiple Arcade Machine Emulator) absorbed the \
10sister-project MESS (Multi Emulator Super System), so MAME now documents a \
11wide variety of (mostly vintage) computers, video game consoles and \
12calculators, in addition to the arcade video games that were its initial focus."
13HOMEPAGE="https://www.mamedev.org/"
14COPYRIGHT="1997-2019 MAMEDev and contributors"
15LICENSE="GNU GPL v2"
16REVISION="1"
17SOURCE_URI="https://github.com/mamedev/mame/archive/mame${portVersion/./}.tar.gz"
18CHECKSUM_SHA256="4d0b23f3c9f9b2f6283ed78d5afc9a6391d2ee6ce5f0f4bcc2a357ec14aa06c4"
19SOURCE_FILENAME="mame-$portVersion.tar.gz"
20SOURCE_DIR="mame-mame${portVersion/./}"
21PATCHES="mame-$portVersion.patchset"
22ADDITIONAL_FILES="
23	mame.sh
24	mame.rdef.in
25	"
26
27ARCHITECTURES="!x86_gcc2 x86 x86_64"
28SECONDARY_ARCHITECTURES="x86"
29
30bits=64
31optimize=3
32makejobs=$jobArgs
33commandBinDir=$binDir
34commandSuffix=$secondaryArchSuffix
35if [ "$targetArchitecture" = x86_gcc2 ]; then
36	bits=
37	commandBinDir=$prefix/bin
38	commandSuffix=
39	makejobs=1
40	optimize=1
41fi
42
43PROVIDES="
44	mame$secondaryArchSuffix = $portVersion
45	cmd:castool$commandSuffix
46	cmd:chdman$commandSuffix
47	cmd:floptool$commandSuffix
48	cmd:imgtool$commandSuffix
49	cmd:jedutil$commandSuffix
50	cmd:ldresample$commandSuffix
51	cmd:ldverify$commandSuffix
52	cmd:mame.sh
53	cmd:mame$commandSuffix
54	cmd:nltool$commandSuffix
55	cmd:nlwav$commandSuffix
56	cmd:pngcmp$commandSuffix
57	cmd:regrep$commandSuffix
58	cmd:romcmp$commandSuffix
59	cmd:split$commandSuffix
60	cmd:src2html$commandSuffix
61	cmd:srcclean$commandSuffix
62	cmd:testkeys$commandSuffix
63	cmd:unidasm$commandSuffix
64"
65
66REQUIRES="
67	haiku$secondaryArchSuffix
68	lib:libexpat$secondaryArchSuffix
69	lib:libflac$secondaryArchSuffix
70	lib:libfontconfig$secondaryArchSuffix
71	lib:libfreetype$secondaryArchSuffix
72	lib:libGL$secondaryArchSuffix
73	lib:libjpeg$secondaryArchSuffix
74	lib:liblua$secondaryArchSuffix >= 5.3
75	lib:libpugixml$secondaryArchSuffix
76	lib:libSDL2_2.0$secondaryArchSuffix
77	lib:libSDL2_ttf$secondaryArchSuffix
78	lib:libsqlite3$secondaryArchSuffix
79	lib:libutf8proc$secondaryArchSuffix
80	lib:libz$secondaryArchSuffix
81"
82
83BUILD_REQUIRES="
84	haiku${secondaryArchSuffix}_devel
85	glm${secondaryArchSuffix}_devel
86	devel:libexpat$secondaryArchSuffix
87	devel:libflac$secondaryArchSuffix
88	devel:libfontconfig$secondaryArchSuffix
89	devel:libfreetype$secondaryArchSuffix
90	devel:libGL$secondaryArchSuffix
91	devel:libjpeg$secondaryArchSuffix
92	devel:liblua$secondaryArchSuffix >= 5.3
93	devel:libogg$secondaryArchSuffix
94	devel:libpugixml$secondaryArchSuffix
95	devel:librapidjson$secondaryArchSuffix
96	devel:libSDL2_2.0$secondaryArchSuffix
97	devel:libSDL2_ttf$secondaryArchSuffix
98	devel:libsqlite3$secondaryArchSuffix
99	devel:libutf8proc$secondaryArchSuffix
100	devel:libz$secondaryArchSuffix
101"
102BUILD_PREREQUIRES="
103	cmd:gcc$secondaryArchSuffix
104	cmd:ld$secondaryArchSuffix
105	cmd:libtoolize
106	cmd:make
107	cmd:pkg_config$secondaryArchSuffix
108	cmd:python2
109	cmd:sed
110	cmd:strip$secondaryArchSuffix
111"
112
113defineDebugInfoPackage mame$secondaryArchSuffix \
114	$commandBinDir/castool \
115	$commandBinDir/chdman \
116	$commandBinDir/floptool \
117	$commandBinDir/imgtool \
118	$commandBinDir/jedutil \
119	$commandBinDir/ldresample \
120	$commandBinDir/ldverify \
121	$commandBinDir/mame \
122	$commandBinDir/nltool \
123	$commandBinDir/nlwav \
124	$commandBinDir/pngcmp \
125	$commandBinDir/regrep \
126	$commandBinDir/romcmp \
127	$commandBinDir/split \
128	$commandBinDir/src2html \
129	$commandBinDir/srcclean \
130	$commandBinDir/testkeys \
131	$commandBinDir/unidasm
132
133BUILD()
134{
135#	make clean
136
137	# This is wrong on so many levels
138	SYS_LDFLAGS="-lbsd -lnetwork " # trailing space required!
139	for _i in flac libutf8proc lua RapidJSON sqlite3; do
140		SYS_CFLAGS+="`pkg-config $_i --cflags`"
141		SYS_LDFLAGS+="`pkg-config $_i --libs`"
142	done
143
144	ARCHOPTS="$SYS_CFLAGS $SYS_LDFLAGS" \
145	make \
146		REGENIE=1 \
147		TOOLS=1 \
148		PRECOMPILE=0 \
149		NOWERROR=1 \
150		OPTIMIZE=$optimize \
151		USE_SYSTEM_LIB_EXPAT=1 \
152		USE_SYSTEM_LIB_ZLIB=1 \
153		USE_SYSTEM_LIB_JPEG=1 \
154		USE_SYSTEM_LIB_FLAC=1 \
155		USE_SYSTEM_LIB_LUA=1 \
156		USE_SYSTEM_LIB_SQLITE3=1 \
157		USE_SYSTEM_LIB_UTF8PROC=1 \
158		USE_SYSTEM_LIB_GLM=1 \
159		USE_SYSTEM_LIB_RAPIDJSON=1 \
160		USE_SYSTEM_LIB_PUGIXML=1 \
161		-j $makejobs
162}
163
164INSTALL()
165{
166	# Based on https://projects.archlinux.de/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/mame
167
168	# Arch cleanup
169	# 32 bit main binary called as "mame" which would collide with our symlink
170	if [ "$targetArchitecture" = x86_64 ]; then
171		mv mame$bits mame
172	fi
173
174	# Install the binaries
175	mkdir -p "$commandBinDir"
176	for _i in castool chdman floptool imgtool jedutil ldresample ldverify \
177	mame nltool nlwav pngcmp regrep romcmp split src2html srcclean \
178	testkeys unidasm; do
179		install -m755 $_i -t "$commandBinDir"
180		strip "$commandBinDir"/$_i
181	done
182
183	# Create the startscript
184	cp $portDir/additional-files/mame.sh "$commandBinDir"/mame.sh
185	chmod +x "$commandBinDir"/mame.sh
186
187	# Add extra attributes to the binaries...
188	local APP_SIGNATURE="application/x-vnd.mame"
189	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
190	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
191	local MINOR="0"
192	sed \
193		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
194		-e "s|@MAJOR@|$MAJOR|" \
195		-e "s|@MIDDLE@|$MIDDLE|" \
196		-e "s|@MINOR@|$MINOR|" \
197		-e "s|@SUMMARY@|Multiple Arcade Machine Emulator|" \
198		-e "s|@DESCRIPTION@|$SUMMARY|" \
199		$portDir/additional-files/mame.rdef.in > mame.rdef
200
201	addResourcesToBinaries mame.rdef "$commandBinDir/mame"
202
203	# ...and to our startscript, but we can't use addResourcesToBinaries here
204	rc mame.rdef
205	resattr -o "$commandBinDir"/mame.sh mame.rsrc
206
207	# Creating icon in Haiku's leaf-menu
208	addAppDeskbarSymlink "$commandBinDir"/mame.sh "MAME"
209
210	# Install the extra bits
211	install -Dm644 src/osd/modules/opengl/shader/glsl*.*h -t "$libDir/"/mame/shader/
212	cp -ar {artwork,bgfx,plugins,language,ctrlr,keymaps,hash} "$libDir"/mame/
213
214	# FS#28203 fix from AUR
215	sed -i 's|KEYCODE_2_PAD|KEYCODE_2PAD|' "$libDir"/mame/ctrlr/*.cfg
216	sed -i 's|KEYCODE_4_PAD|KEYCODE_4PAD|' "$libDir"/mame/ctrlr/*.cfg
217	sed -i 's|KEYCODE_6_PAD|KEYCODE_6PAD|' "$libDir"/mame/ctrlr/*.cfg
218	sed -i 's|KEYCODE_8_PAD|KEYCODE_8PAD|' "$libDir"/mame/ctrlr/*.cfg
219
220	# Install man-pages
221	install -dm0755 "$manDir"/man{1,6}
222	install -m644 docs/man/*.1* "$manDir"/man1
223	install -m644 docs/man/*.6* "$manDir"/man6
224}
225