Import emulators/mame.

MAME, formerly was an acronym which stood for Multi Arcade Machine Emulator,
documents and reproduces through emulation the inner components of arcade
machines, computers, consoles, chess computers, calculators, and many other
types of electronic amusement machines. As a nice side-effect, MAME allows
to use on a modern PC those programs and games which were originally
developed for the emulated machines.

Some relevant notes:

- MAME and MESS merged in 2015, there is only one codebase now
- Since version 0.172, MAME is GPLv2+ licensed [1], which means binary
  packages can now be built and distributed

This port will replace emulators/sdlmame and emulators/sdlmess.

[1] http://mamedev.org/?p=424

OK bentley@
This commit is contained in:
fcambus 2018-01-24 20:56:12 +00:00
parent e05d7bb937
commit aa1151500c
13 changed files with 460 additions and 0 deletions

97
emulators/mame/Makefile Normal file
View File

@ -0,0 +1,97 @@
# $OpenBSD: Makefile,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
ONLY_FOR_ARCHS = amd64
USE_WXNEEDED = Yes
COMMENT = Multiple Arcade Machine Emulator
V = 193
GH_ACCOUNT = mamedev
GH_PROJECT = mame
GH_TAGNAME = mame0${V}
DISTNAME = mame-0.${V}
CATEGORIES = emulators
HOMEPAGE = http://mamedev.org/
MAINTAINER = Frederic Cambus <fcambus@openbsd.org>
PATCHORIG = .orig.port
# GPLv2+
PERMIT_PACKAGE_CDROM = Yes
WANTLIB += ${COMPILER_LIBCXX} FLAC GL SDL2 SDL2_ttf X11 Xinerama
WANTLIB += c expat fontconfig freetype jpeg lua5.3 m sqlite3 util z
MODULES = lang/lua \
lang/python
MODLUA_VERSION = 5.3
MODPY_RUNDEP = No
LIB_DEPENDS = audio/flac \
databases/sqlite3 \
devel/sdl2 \
devel/sdl2-ttf \
graphics/jpeg
CFLAGS += -I${PREFIX}/include -I${X11BASE}/include -I${MODLUA_INCL_DIR}
CFLAGS += -Wno-ignored-qualifiers
MAKE_ENV = NOWERROR=1 TOOLS=1 verbose=1 \
OVERRIDE_CC="${CC}" OVERRIDE_CXX="${CXX}" OVERRIDE_LD="${CXX}" \
OPT_FLAGS="${CXXFLAGS}" \
PYTHON_EXECUTABLE="${MODPY_BIN}" \
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_QTDEBUG=0 # avoid depending on Qt
.if ${MACHINE_ARCH} == "amd64"
MAKE_ENV += PTR64=1
.endif
CONFIGURE_STYLE = none
USE_GMAKE = Yes
MAKE_FILE = makefile
NO_TEST = Yes
post-extract:
@mv ${WRKSRC}/3rdparty/genie/build/gmake.freebsd \
${WRKSRC}/3rdparty/genie/build/gmake.bsd
@sed -i 's,"lua","lua${MODLUA_VERSION}",g' ${WRKSRC}/scripts/extlib.lua
@mv ${WRKSRC}/src/lib/util/png.h ${WRKSRC}/src/lib/util/localpng.h
@sed -i 's|"png.h"|"localpng.h"|' ${WRKSRC}/src/emu/*.cpp \
${WRKSRC}/src/lib/util/*.cpp ${WRKSRC}/src/tools/*.cpp
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/mame64 ${PREFIX}/bin/mame
${INSTALL_DATA} ${WRKSRC}/docs/man/mame.6 ${PREFIX}/man/man6
.for f in castool chdman floptool imgtool jedutil ldresample ldverify romcmp
${INSTALL_PROGRAM} ${WRKSRC}/${f} ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/docs/man/${f}.1 ${PREFIX}/man/man1
.endfor
${INSTALL_DATA_DIR} ${PREFIX}/share/mame
@cp -r ${WRKSRC}/artwork ${PREFIX}/share/mame
${INSTALL_DATA_DIR} ${PREFIX}/share/mame/keymaps
.for l in be br ch de es fr gb it pt se
${INSTALL_DATA} ${WRKSRC}/keymaps/km_${l}_LINUX.map \
${PREFIX}/share/mame/keymaps/km_${l}.map
.endfor
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mame
${SUBST_DATA} ${FILESDIR}/mame.ini \
${PREFIX}/share/examples/mame/mame.ini
.include <bsd.port.mk>

2
emulators/mame/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (mame-0.193.tar.gz) = a16QtgK++8rStpibHpMND/blN9yQH3sWFaPm3uwiB6I=
SIZE (mame-0.193.tar.gz) = 125851598

View File

@ -0,0 +1,46 @@
# This is the system-wide MAME configuration file.
# The following entries only list OpenBSD-specific configuration
# and the options you may be the most interested in.
#
# More options are available, you can list your current configuration
# with mame -showconfig.
#
# Users can also create their own mame.ini in a $HOME/.mame directory
# that can override system-wide settings.
#
# CORE SEARCH PATH OPTIONS
#
rompath $HOME/.mame/roms;${TRUEPREFIX}/share/mame/roms
samplepath $HOME/.mame/samples;${TRUEPREFIX}/share/mame/samples
artpath $HOME/.mame/artwork;${TRUEPREFIX}/share/mame/artwork
ctrlrpath $HOME/.mame/ctrlr;${TRUEPREFIX}/share/mame/ctrlr
inipath $HOME/.mame;${SYSCONFDIR}/mame
fontpath $HOME/.mame;${TRUEPREFIX}/share/mame
cheatpath $HOME/.mame/cheat;${TRUEPREFIX}/share/mame/cheat
#
# CORE OUTPUT DIRECTORY OPTIONS
#
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 OPTIONS
#
# Uncomment if your graphic chipset is drm(4) capable
#video opengl
#
# SDL KEYBOARD MAPPING
#
# If you have a non-US keyboard and your keymap is available in
# /usr/local/share/mame/keymaps, modify and uncomment the following
# lines.
#keymap 1
#keymap_file ${TRUEPREFIX}/share/mame/keymaps/km_fr.map

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-3rdparty_bgfx_examples_common_nanovg_fontstash_h,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Don't include malloc.h header on OpenBSD.
Index: 3rdparty/bgfx/examples/common/nanovg/fontstash.h
--- 3rdparty/bgfx/examples/common/nanovg/fontstash.h.orig
+++ 3rdparty/bgfx/examples/common/nanovg/fontstash.h
@@ -247,7 +247,6 @@ int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font,
static void* fons__tmpalloc(size_t size, void* up);
static void fons__tmpfree(void* ptr, void* up);
#else
-# include <malloc.h>
# include <string.h>
#endif // 0

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-3rdparty_bx_include_bx_bx_h,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Don't include alloca.h header on OpenBSD.
Index: 3rdparty/bx/include/bx/bx.h
--- 3rdparty/bx/include/bx/bx.h.orig
+++ 3rdparty/bx/include/bx/bx.h
@@ -6,7 +6,6 @@
#ifndef BX_H_HEADER_GUARD
#define BX_H_HEADER_GUARD
-#include <alloca.h> // alloca
#include <stdarg.h> // va_list
#include <stdint.h> // uint32_t
#include <stdlib.h> // size_t

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-3rdparty_bx_src_allocator_cpp,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Don't use malloc.h header on OpenBSD.
Index: 3rdparty/bx/src/allocator.cpp
--- 3rdparty/bx/src/allocator.cpp.orig
+++ 3rdparty/bx/src/allocator.cpp
@@ -6,8 +6,6 @@
#include "bx_p.h"
#include <bx/allocator.h>
-#include <malloc.h>
-
#ifndef BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT
# define BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT 8
#endif // BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-3rdparty_bx_src_mutex_cpp,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Index: 3rdparty/bx/src/mutex.cpp
--- 3rdparty/bx/src/mutex.cpp.orig
+++ 3rdparty/bx/src/mutex.cpp
@@ -13,7 +13,8 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
- || BX_PLATFORM_RPI
+ || BX_PLATFORM_RPI \
+ || BX_PLATFORM_BSD
# include <pthread.h>
#elif BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-3rdparty_bx_src_thread_cpp,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Index: 3rdparty/bx/src/thread.cpp
--- 3rdparty/bx/src/thread.cpp.orig
+++ 3rdparty/bx/src/thread.cpp
@@ -11,9 +11,10 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
- || BX_PLATFORM_RPI
+ || BX_PLATFORM_RPI \
+ || BX_PLATFORM_BSD
# include <pthread.h>
-# if defined(__FreeBSD__)
+# if defined(__FreeBSD__) || defined(__OpenBSD__)
# include <pthread_np.h>
# endif
# if BX_PLATFORM_LINUX && (BX_CRT_GLIBC < 21200)

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-3rdparty_genie_build_gmake_bsd_genie_make,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
Index: 3rdparty/genie/build/gmake.bsd/genie.make
--- 3rdparty/genie/build/gmake.bsd/genie.make.orig
+++ 3rdparty/genie/build/gmake.bsd/genie.make
@@ -28,8 +28,8 @@ else
RM = $(SILENT) del /F "$(subst /,\\,$(1))" 2> nul || exit 0
endif
-CC = gcc
-CXX = g++
+CC ?= gcc
+CXX ?= g++
AR = ar
ifndef RESCOMP
@@ -48,9 +48,9 @@ ifeq ($(config),release)
INCLUDES += -I../../src/host/lua-5.3.0/src
INCLUDES +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -MP $(DEFINES) $(INCLUDES)
- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
- ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
- ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os
+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra
+ ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra
+ ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
ALL_LDFLAGS += $(LDFLAGS) -L. -s -rdynamic
LDDEPS +=

View File

@ -0,0 +1,53 @@
$OpenBSD: patch-makefile,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
- Disable hardcoded -O3 optimizations
- Fix GCC_VERSION and CLANG_VERSION detection
Index: makefile
--- makefile.orig
+++ makefile
@@ -192,7 +192,7 @@ GENIEOS := freebsd
endif
ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
OS := openbsd
-GENIEOS := freebsd
+GENIEOS := bsd
endif
ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
OS := macosx
@@ -533,11 +533,6 @@ PROFILER =
SYMBOLS = 1
endif
-# specify a default optimization level if none explicitly stated
-ifndef OPTIMIZE
-OPTIMIZE = 3
-endif
-
# set the symbols level
ifdef SYMBOLS
PARAMS += --SYMBOLS='$(SYMBOLS)'
@@ -914,9 +909,9 @@ FASTBUILD_PARAMS += $(FASTBUILD_TARGET)-x32
endif
endif
else
-GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
+GCC_VERSION := $(shell cc -dumpversion 2> /dev/null)
ifneq ($(OS),solaris)
-CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\(\.[0-9]\)\?' -o | grep -e '[0-9]\.[0-9]\(\.[0-9]\)\?' -o | tail -n 1)
+CLANG_VERSION := $(shell cc --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\.[0-9]' -o | sed -e 's,version ,,' | tail -n 1)
endif
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
@@ -928,9 +923,9 @@ else
$(info Clang $(CLANG_VERSION) detected)
ifneq ($(TARGETOS),asmjs)
ifeq ($(ARCHITECTURE),_x64)
-ARCHITECTURE := _x64_clang
+ARCHITECTURE := _x64
else
-ARCHITECTURE := _x86_clang
+ARCHITECTURE := _x86
endif
endif
endif

View File

@ -0,0 +1,73 @@
$OpenBSD: patch-scripts_genie_lua,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
- Set OPT_FLAGS even when OPTIMIZE is unset, to allow passing CXXFLAGS
- Remove broken GCC version detection
Index: scripts/genie.lua
--- scripts/genie.lua.orig
+++ scripts/genie.lua
@@ -787,17 +787,19 @@ if _OPTIONS["NOWERROR"]==nil then
}
end
+-- add optional flags
+if _OPTIONS["OPT_FLAGS"] then
+ buildoptions {
+ _OPTIONS["OPT_FLAGS"]
+ }
+end
+
-- if we are optimizing, include optimization options
if _OPTIONS["OPTIMIZE"] then
buildoptions {
"-O".. _OPTIONS["OPTIMIZE"],
"-fno-strict-aliasing"
}
- if _OPTIONS["OPT_FLAGS"] then
- buildoptions {
- _OPTIONS["OPT_FLAGS"]
- }
- end
if _OPTIONS["LTO"]=="1" then
buildoptions {
-- windows native mingw GCC 5.2 fails with -flto=x with x > 1. bug unfixed as of this commit
@@ -961,39 +963,6 @@ end
- local version = str_to_version(_OPTIONS["gcc_version"])
- if string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "pnacl") or string.find(_OPTIONS["gcc"], "asmjs") or string.find(_OPTIONS["gcc"], "android") then
- if (version < 30400) then
- print("Clang version 3.4 or later needed")
- os.exit(-1)
- end
- buildoptions {
- "-Wno-cast-align",
- "-Wno-tautological-compare",
- "-Wno-unused-value",
- "-Wno-constant-logical-operand",
- "-Wno-missing-braces", -- clang is not as permissive as GCC about std::array initialization
- "-fdiagnostics-show-note-include-stack",
- }
- if (version >= 30500) then
- buildoptions {
- "-Wno-unknown-warning-option",
- "-Wno-extern-c-compat",
- "-Wno-unknown-attributes",
- "-Wno-ignored-qualifiers"
- }
- end
- else
- if (version < 50000) then
- print("GCC version 5.0 or later needed")
- os.exit(-1)
- end
- buildoptions {
- "-Wno-unused-result", -- needed for fgets,fread on linux
- -- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
- "-Wno-array-bounds",
- }
- end
end
if (_OPTIONS["PLATFORM"]=="alpha") then

6
emulators/mame/pkg/DESCR Normal file
View File

@ -0,0 +1,6 @@
MAME, formerly was an acronym which stood for Multi Arcade Machine Emulator,
documents and reproduces through emulation the inner components of arcade
machines, computers, consoles, chess computers, calculators, and many other
types of electronic amusement machines. As a nice side-effect, MAME allows
to use on a modern PC those programs and games which were originally
developed for the emulated machines.

75
emulators/mame/pkg/PLIST Normal file
View File

@ -0,0 +1,75 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2018/01/24 20:56:12 fcambus Exp $
@conflict sdlmame-*
@conflict sdlmame-tools-*
@conflict sdlmess-*
@bin bin/castool
@bin bin/chdman
@bin bin/floptool
@bin bin/imgtool
@bin bin/jedutil
@bin bin/ldresample
@bin bin/ldverify
@bin bin/mame
@bin bin/romcmp
@man man/man1/castool.1
@man man/man1/chdman.1
@man man/man1/floptool.1
@man man/man1/imgtool.1
@man man/man1/jedutil.1
@man man/man1/ldresample.1
@man man/man1/ldverify.1
@man man/man1/romcmp.1
@man man/man6/mame.6
share/examples/mame/
share/examples/mame/mame.ini
share/mame/
share/mame/artwork/
share/mame/artwork/LICENSE
share/mame/artwork/README.md
share/mame/artwork/aperture-grille.png
share/mame/artwork/aperture.png
share/mame/artwork/aperture1x2rb.png
share/mame/artwork/aperture1x3rb.png
share/mame/artwork/aperture2x4bg.png
share/mame/artwork/aperture2x4rb.png
share/mame/artwork/aperture4x6.png
share/mame/artwork/bgfx/
share/mame/artwork/bgfx/border_blur/
share/mame/artwork/bgfx/border_blur/default.lay
share/mame/artwork/bgfx/chains/
share/mame/artwork/bgfx/chains/crt-geom/
share/mame/artwork/bgfx/chains/crt-geom/aperture_1_2_bgr.png
share/mame/artwork/bgfx/chains/crt-geom/aperture_1_4_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/aperture_2_4_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/aperture_2_5_bgr.png
share/mame/artwork/bgfx/chains/crt-geom/aperture_3_6_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/delta_1_2x1_bgr.png
share/mame/artwork/bgfx/chains/crt-geom/delta_1_4x1_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/delta_2_4x1_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/delta_2_4x2_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/none.png
share/mame/artwork/bgfx/chains/crt-geom/slot_2_4x4_rgb.png
share/mame/artwork/bgfx/chains/crt-geom/slot_2_5x4_bgr.png
share/mame/artwork/bgfx/chains/crt-geom/slot_3_7x6_rgb.png
share/mame/artwork/bgfx/chains/hq2x.png
share/mame/artwork/bgfx/chains/hq3x.png
share/mame/artwork/bgfx/chains/hq4x.png
share/mame/artwork/dir.txt
share/mame/artwork/monochrome-chessboard.png
share/mame/artwork/monochrome-matrix.png
share/mame/artwork/scanlines.png
share/mame/artwork/shadow-mask.png
share/mame/artwork/slot-mask-aligned.png
share/mame/artwork/slot-mask.png
share/mame/artwork/white.png
share/mame/keymaps/
share/mame/keymaps/km_be.map
share/mame/keymaps/km_br.map
share/mame/keymaps/km_ch.map
share/mame/keymaps/km_de.map
share/mame/keymaps/km_es.map
share/mame/keymaps/km_fr.map
share/mame/keymaps/km_gb.map
share/mame/keymaps/km_it.map
share/mame/keymaps/km_pt.map
share/mame/keymaps/km_se.map