games/mame: Updated for version 0.189.

Signed-off-by: B. Watson <yalhcru@gmail.com>
This commit is contained in:
B. Watson 2017-09-02 17:18:29 -04:00 committed by Willy Sudiarto Raharjo
parent 87bf285cf9
commit f2cdd2f934
3 changed files with 28 additions and 187 deletions

View file

@ -1,152 +0,0 @@
#!/usr/bin/python
##
## license:BSD-3-Clause
## copyright-holders:Vas Crabb
import os
import sys
import xml.sax
import xml.sax.saxutils
import zlib
class ErrorHandler(object):
def __init__(self, **kwargs):
super(ErrorHandler, self).__init__(**kwargs)
self.errors = 0
self.warnings = 0
def error(self, exception):
self.errors += 1
sys.stderr.write('error: %s' % (exception))
def fatalError(self, exception):
raise exception
def warning(self, exception):
self.warnings += 1
sys.stderr.write('warning: %s' % (exception))
class Minifyer(object):
def __init__(self, output, **kwargs):
super(Minifyer, self).__init__(**kwargs)
self.output = output
self.incomplete_tag = False
self.element_content = ''
def setDocumentLocator(self, locator):
pass
def startDocument(self):
self.output('<?xml version="1.0"?>')
def endDocument(self):
self.output('\n')
def startElement(self, name, attrs):
self.flushElementContent()
if self.incomplete_tag:
self.output('>')
self.output('<%s' % (name))
for name in attrs.getNames():
self.output(' %s=%s' % (name, xml.sax.saxutils.quoteattr(attrs[name])))
self.incomplete_tag = True
def endElement(self, name):
self.flushElementContent()
if self.incomplete_tag:
self.output('/>')
else:
self.output('</%s>' % (name))
self.incomplete_tag = False
def characters(self, content):
self.element_content += content
def ignorableWhitespace(self, whitespace):
pass
def processingInstruction(self, target, data):
pass
def flushElementContent(self):
self.element_content = self.element_content.strip()
if self.element_content:
if self.incomplete_tag:
self.output('>')
self.incomplete_tag = False
self.output(xml.sax.saxutils.escape(self.element_content))
self.element_content = ''
class XmlError(Exception):
pass
def compressLayout(src, dst, comp):
state = [0, 0]
def write(block):
for ch in bytearray(block):
if 0 == state[0]:
dst('\t')
elif 0 == (state[0] % 32):
dst(',\n\t')
else:
dst(', ')
state[0] += 1
dst('%3u' % (ch))
def output(text):
block = text.encode('UTF-8')
state[1] += len(block)
write(comp.compress(block))
error_handler = ErrorHandler()
content_handler = Minifyer(output)
parser = xml.sax.make_parser()
parser.setErrorHandler(error_handler)
parser.setContentHandler(content_handler)
try:
parser.parse(src)
write(comp.flush())
dst('\n')
except xml.sax.SAXException as exception:
print('fatal error: %s' % (exception))
raise XmlError('Fatal error parsing XML')
if (error_handler.errors > 0) or (error_handler.warnings > 0):
raise XmlError('Error(s) and/or warning(s) parsing XML')
return state[1], state[0]
if __name__ == '__main__':
if len(sys.argv) != 4:
print('Usage:')
print(' complay <source.lay> <output.h> <varname>')
sys.exit(0 if len(sys.argv) <= 1 else 1)
srcfile = sys.argv[1]
dstfile = sys.argv[2]
varname = sys.argv[3]
comp_type = 1
try:
dst = open(dstfile,'w')
dst.write('static const unsigned char %s_data[] = {\n' % (varname))
byte_count, comp_size = compressLayout(srcfile, lambda x: dst.write(x), zlib.compressobj())
dst.write('};\n\n')
dst.write('const internal_layout %s = {\n' % (varname))
dst.write('\t%d, sizeof(%s_data), %d, %s_data\n' % (byte_count, varname, comp_type, varname))
dst.write('};\n')
dst.close()
except XmlError:
dst.close()
os.remove(dstfile)
sys.exit(2)
except IOError:
sys.stderr.write("Unable to open output file '%s'\n" % dstfile)
os.remove(dstfile)
dst.close()
sys.exit(3)

View file

@ -9,45 +9,40 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20170726 bkw:
# - Updated for v0.188.
# 20170902 bkw: Updated for v0.189.
# - Fix complay.py build error. Turns out that the build would fail
# only on systems where PyXML is installed, so add -S to python
# command line so 'import xml.sax' imports the xml stuff that ships
# with core python, instead of the (outdated, deprecated) 3rd-party
# stuff from PyXML.
# - Stop installing useless junk in /usr/doc.
# - Install swlist docs.
# - Compacted log entries.
# 20170702 bkw:
# - Updated for v0.187.
# 20170726 bkw: Updated for v0.188.
# 20170702 bkw: Updated for v0.187.
# 20170607 bkw:
# - Updated for v0.186.
# 20170607 bkw: Updated for v0.186.
# - Link with ld.gold instead of the default ld, which saves *2 hours* of
# build time on my test box (build is 3x as fast as it was).
# 20170428 bkw:
# - Updated for v0.185.
# 20170428 bkw: Updated for v0.185.
# 20170404 bkw:
# - mame.ini: get rid of $HOME in bgfx_path. Thanks to Doogster for
# reporting this.
# 20170330 bkw:
# - Updated for v0.184.
# 20170330 bkw: Updated for v0.184.
# 20170301 bkw:
# - Use long-form github URL.
# - Fix changelog so newer entries are at the top.
# 20170223 bkw:
# - Updated for v0.183.
# 20170214 bkw:
# - Add support for GroovyMAME patch.
# 20170128 bkw:
# - Updated for v0.182.
# 20170111 bkw:
# - Updated for v0.181. Missed a month again.
# 20161101 bkw:
# - Updated for v0.179.
# 20170223 bkw: Updated for v0.183.
# 20170214 bkw: Add support for GroovyMAME patch.
# 20170128 bkw: Updated for v0.182.
# 20170111 bkw: Updated for v0.181. Missed a month again.
# 20161101 bkw: Updated for v0.179.
# 20160928 bkw:
# - Updated for v0.178. Sorry, missed a month.
@ -85,7 +80,7 @@
# - Update .ini file slightly (sound=sdl, not sound=1)
PRGNAM=mame
VERSION=${VERSION:-0.188}
VERSION=${VERSION:-0.189}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -149,13 +144,6 @@ find -L . \
# genie with arguments based on the options in the main makefile. Also,
# it uses python to convert XML layout files to C++ code.
# complay.py is the layout compressor. Layouts are XML, complay
# compresses them and also seems to generate C code. The script got
# updated between mame 0.187 and 0.188, and the new version doesn't
# work. I don't know enough about Python to fix this in a timely
# manner, so for now I'll just use the old version of the script.
cp $CWD/complay.py scripts/build/complay.py
# Where possible, use system libraries instead of building the ones
# bundled with the mame source. However, SBo's lua is (still!) too old
# for mame.
@ -229,6 +217,7 @@ make USE_QTDEBUG=$QTOPT \
USE_SYSTEM_LIB_ZLIB=1 \
USE_SYSTEM_LIB_JPEG=1 \
USE_SYSTEM_LIB_FLAC=1 \
PYTHON_EXECUTABLE="/usr/bin/python -S" \
OPT_FLAGS="$SLKCFLAGS" \
LDOPTS="-fuse-ld=gold" \
OVERRIDE_CC="$( which gcc )" \
@ -277,9 +266,13 @@ done
# Install the artwork and bgfx stuff (needed for 'video bgfx' in mame.ini).
cp -a artwork bgfx $PKG/usr/share/games/$PRGNAM
# CONTRIBUTING.md is a 1-byte placeholder, and we don't need a shell script.
rm -f docs/CONTRIBUTING.md docs/update.sh
mkdir -p $PKG/usr/doc/${PRGNAM}-$VERSION
# can't just "cp docs/* ..." because man/ is a dir, set -e kills the script
cp docs/L* docs/*.* $PKG/usr/doc/${PRGNAM}-$VERSION
cp -a docs/swlist $PKG/usr/doc/${PRGNAM}-$VERSION
cat $CWD/${PRGNAM}.SlackBuild > $PKG/usr/doc/${PRGNAM}-$VERSION/${PRGNAM}.SlackBuild
mkdir -p $PKG/install

View file

@ -1,8 +1,8 @@
PRGNAM="mame"
VERSION="0.188"
VERSION="0.189"
HOMEPAGE="http://mamedev.org/"
DOWNLOAD="https://github.com/mamedev/mame/archive/mame0188/mame-mame0188.tar.gz"
MD5SUM="d0811c2cfe39bf8b622c35b4012c8392"
DOWNLOAD="https://github.com/mamedev/mame/archive/mame0189/mame-mame0189.tar.gz"
MD5SUM="71900d03a8ee97b5573e7e704d0ffde3"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="SDL2_ttf"