void-packages/srcpkgs/mame/template

134 lines
3.7 KiB
Bash

# Template file for 'mame'
pkgname=mame
version=0228
revision=1
wrksrc="mame-mame${version}"
hostmakedepends="pkg-config python3 qt5-host-tools tar xz which"
makedepends="SDL2_ttf-devel fontconfig-devel glm libgomp-devel libjpeg-turbo-devel
lua-devel libutf8proc-devel libuv-devel portaudio-devel portmidi-devel
pugixml-devel rapidjson $(vopt_if qt 'qt5-devel')"
depends="liberation-fonts-ttf"
short_desc="Multiple Arcade Machine Emulator"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="GPL-2.0-or-later"
homepage="http://mamedev.org"
distfiles="https://github.com/mamedev/mame/archive/mame${version}.tar.gz"
checksum=1d8e6f20491492f8b15892ff958f9b067c48eb90cc2fc974b08bde297e657244
nodebug=yes
replaces="sdlmame>=0 sdlmess>=0"
CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/lua5.3 -I${XBPS_CROSS_BASE}/usr/include/libutf8proc"
CXXFLAGS="$CFLAGS"
[ "$XBPS_TARGET_LIBC" = musl ] && CXXFLAGS+=" -DBX_CRT_MUSL=1"
case "$XBPS_TARGET_MACHINE" in
ppc*)
CFLAGS+=" -mlong-double-64"
CXXFLAGS+=" -mlong-double-64"
;;
esac
build_options="qt"
build_options_default="qt"
_options="REGENIE=1 TARGETOS=linux NOWERROR=1 OPENMP=1 OPTIMIZE=3
TOOLS=1 LTO=0 USE_SYSTEM_LIB_ASIO=0 USE_SYSTEM_LIB_EXPAT=1
USE_SYSTEM_LIB_ZLIB=1 USE_SYSTEM_LIB_JPEG=1 USE_SYSTEM_LIB_FLAC=1
USE_SYSTEM_LIB_LUA=0 USE_SYSTEM_LIB_SQLITE3=1
USE_SYSTEM_LIB_PORTMIDI=1 USE_SYSTEM_LIB_PORTAUDIO=1
USE_SYSTEM_LIB_UTF8PROC=1 USE_SYSTEM_LIB_GLM=1
USE_SYSTEM_LIB_RAPIDJSON=1 USE_SYSTEM_LIB_PUGIXML=1"
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
_options+=" BIGENDIAN=1"
else
_options+=" BIGENDIAN=0"
fi
if [ "${CROSS_BUILD}" ]; then
_options+=" NOASM=1"
fi
if [ "$XBPS_TARGET_WORDSIZE" = 32 ]; then
# Overcome linker memory exhaustion
_options+=" SYMBOLS=0"
LDFLAGS+=" -Wl,--no-keep-memory"
else
_options+=" PTR64=1"
fi
if [ "$build_option_qt" ]; then
_options+=" USE_QTDEBUG=1"
fi
# To test flags with a tiny build remove hash (#) on the following line
#_options+=" TARGET=mame SUBTARGET=tiny VERBOSE=1"
do_configure() {
# When linking mame expects liblua.so but we have liblua5.3.so
ln -sf liblua5.3.so ${XBPS_CROSS_BASE}/usr/lib/liblua.so
if [ "${CROSS_BUILD}" ]; then
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*) ;;
*) # Cross compilers don't need/use -m32 or -m64
grep -rlw -- -m32 | xargs sed -i "s;-m32;;"
grep -rlw -- -m64 | xargs sed -i "s;-m64;;"
;;
esac
make ${makejobs} ${_options} \
CC="$CC_host" \
CXX="$CXX_host" \
LD="$CXX_host" \
CFLAGS="$CFLAGS_host" \
CXXFLAGS="$CXXFLAGS_host" \
LDFLAGS="$LDFLAGS_host" \
genie
else
make ${makejobs} ${_options} genie
fi
}
do_build() {
# The build sometimes fails due to parallelism but the 2nd try then passes.
make OVERRIDE_CC="$CC" OVERRIDE_CXX="$CXX" OVERRIDE_LD="$CXX" ${makejobs} ${_options} || \
make OVERRIDE_CC="$CC" OVERRIDE_CXX="$CXX" OVERRIDE_LD="$CXX" ${makejobs} ${_options}
}
do_install() {
local f
# Install the mame script
vbin ${FILESDIR}/mame.sh mame
# Install the main application(s)
for f in mame mame64 mamearcade mamearcade64; do
if [ -r ${f} ]; then
vinstall ${f} 755 usr/libexec/${pkgname} mame
break
fi
done
for f in mess mess64; do
if [ -r ${f} ]; then
vinstall ${f} 755 usr/libexec/${pkgname} mess
break
fi
done
# Install the tools
for f in chdman jedutil regrep pngcmp romcmp srcclean \
ldverify ldresample unidasm castool floptool imgtool; do
vbin ${f}
if [ -f docs/man/${f}.1 ]; then
vman docs/man/${f}.1
fi
done
for f in mame mess; do
if [ -r docs/man/${f}.6 ]; then
vman docs/man/${f}.6
fi
done
# Install the extra bits
for f in artwork bgfx docs hash hlsl keymaps plugins samples; do
vcopy ${f} usr/share/${pkgname}
done
# Remove temporary liblua.so symlink
rm -f ${XBPS_CROSS_BASE}/usr/lib/liblua.so
}