libretro-mame2010: fix building on non-x86 non-powerpc use the "ARM" CPU yield code (actually portable C) on everything where there's not inline ASM. while here, comment patches, convert line endings to unix.diff -r1.4 -r1.5 pkgsrc/emulators/libretro-mame2010/Makefile
(nia)
@@ -1,61 +1,66 @@ | @@ -1,61 +1,66 @@ | |||
1 | # $NetBSD: Makefile,v 1.4 2020/05/31 18:34:56 nia Exp $ | 1 | # $NetBSD: Makefile,v 1.5 2021/06/19 07:23:31 nia Exp $ | |
2 | 2 | |||
3 | DISTNAME= libretro-mame2010-20200525 | 3 | DISTNAME= libretro-mame2010-20200525 | |
4 | CATEGORIES= emulators | 4 | CATEGORIES= emulators | |
5 | GITHUB_PROJECT= mame2010-libretro | 5 | GITHUB_PROJECT= mame2010-libretro | |
6 | GITHUB_TAG= bef96188e7276422eab81b44b41361896885bae5 | 6 | GITHUB_TAG= bef96188e7276422eab81b44b41361896885bae5 | |
7 | 7 | |||
8 | MAINTAINER= pkgsrc-users@NetBSD.org | 8 | MAINTAINER= pkgsrc-users@NetBSD.org | |
9 | HOMEPAGE= https://docs.libretro.com/library/mame_2010/ | 9 | HOMEPAGE= https://docs.libretro.com/library/mame_2010/ | |
10 | COMMENT= Libretro core based on the MAME 0.139 arcade game emulator | 10 | COMMENT= Libretro core based on the MAME 0.139 arcade game emulator | |
11 | LICENSE= mame-license | 11 | LICENSE= mame-license | |
12 | 12 | |||
13 | USE_LANGUAGES= c c++ | 13 | USE_LANGUAGES= c c++ | |
14 | 14 | |||
15 | LIBRETRO_CORE= mame2010 | 15 | LIBRETRO_CORE= mame2010 | |
16 | 16 | |||
17 | TOOL_DEPENDS+= dos2unix-[0-9]*:../../converters/dos2unix | |||
18 | ||||
17 | MAKE_FLAGS+= BUILD_ZLIB=0 | 19 | MAKE_FLAGS+= BUILD_ZLIB=0 | |
18 | 20 | |||
19 | .include "../../mk/endian.mk" | 21 | .include "../../mk/endian.mk" | |
20 | 22 | |||
21 | .if ${MACHINE_ENDIAN} == "big" | 23 | .if ${MACHINE_ENDIAN} == "big" | |
22 | CFLAGS+= -DMSB_FIRST | 24 | CFLAGS+= -DMSB_FIRST | |
23 | .endif | 25 | .endif | |
24 | 26 | |||
25 | .include "../../mk/bsd.prefs.mk" | 27 | .include "../../mk/bsd.prefs.mk" | |
26 | 28 | |||
27 | .if !empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly" | 29 | .if !empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly" | |
28 | CFLAGS+= -DSDLMAME_BSD | 30 | CFLAGS+= -DSDLMAME_BSD | |
29 | .endif | 31 | .endif | |
30 | 32 | |||
31 | .if ${OPSYS} != "Linux" | 33 | .if ${OPSYS} != "Linux" | |
32 | CFLAGS+= -DNO_AFFINITY_NP | 34 | CFLAGS+= -DNO_AFFINITY_NP | |
33 | .endif | 35 | .endif | |
34 | 36 | |||
35 | CFLAGS+= -Wno-narrowing | |||
36 | ||||
37 | .if ${MACHINE_ARCH} != "x86_64" && ${MACHINE_ARCH} != "i386" | 37 | .if ${MACHINE_ARCH} != "x86_64" && ${MACHINE_ARCH} != "i386" | |
38 | MAKE_FLAGS+= FORCE_DRC_C_BACKEND=1 | 38 | MAKE_FLAGS+= FORCE_DRC_C_BACKEND=1 | |
39 | .endif | 39 | .endif | |
40 | 40 | |||
41 | .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) | 41 | .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) | |
42 | MAKE_FLAGS+= NATIVECC=${NATIVE_CXX:Q} | 42 | MAKE_FLAGS+= NATIVECC=${NATIVE_CXX:Q} | |
43 | MAKE_FLAGS+= NATIVELD=${NATIVE_CXX:Q} | 43 | MAKE_FLAGS+= NATIVELD=${NATIVE_CXX:Q} | |
44 | .else | 44 | .else | |
45 | MAKE_FLAGS+= NATIVECC=${CXX:Q} | 45 | MAKE_FLAGS+= NATIVECC=${CXX:Q} | |
46 | MAKE_FLAGS+= NATIVELD=${CXX:Q} | 46 | MAKE_FLAGS+= NATIVELD=${CXX:Q} | |
47 | .endif | 47 | .endif | |
48 | 48 | |||
49 | .for platform in ${LP64PLATFORMS} | 49 | .for platform in ${LP64PLATFORMS} | |
50 | . if ${MACHINE_PLATFORM:M${platform}} | 50 | . if ${MACHINE_PLATFORM:M${platform}} | |
51 | MAKE_FLAGS+= PTR64=1 | 51 | MAKE_FLAGS+= PTR64=1 | |
52 | . endif | 52 | . endif | |
53 | .endfor | 53 | .endfor | |
54 | 54 | |||
55 | .include "../../emulators/retroarch/core.mk" | 55 | .include "../../emulators/retroarch/core.mk" | |
56 | 56 | |||
57 | MAKE_FLAGS+= CC=${CXX:Q} | 57 | MAKE_FLAGS+= CC=${CXX:Q} | |
58 | MAKE_FLAGS+= LD=${CXX:Q} | 58 | MAKE_FLAGS+= LD=${CXX:Q} | |
59 | 59 | |||
60 | post-extract: | |||
61 | cd ${WRKSRC} && dos2unix Makefile | |||
62 | cd ${WRKSRC} && dos2unix src/emu/*.c src/emu/*.h | |||
63 | cd ${WRKSRC} && dos2unix src/osd/retro/osinline.h | |||
64 | ||||
60 | .include "../../devel/zlib/buildlink3.mk" | 65 | .include "../../devel/zlib/buildlink3.mk" | |
61 | .include "../../mk/bsd.pkg.mk" | 66 | .include "../../mk/bsd.pkg.mk" |
@@ -1,11 +1,12 @@ | @@ -1,11 +1,12 @@ | |||
1 | $NetBSD: distinfo,v 1.3 2020/05/30 20:36:15 nia Exp $ | 1 | $NetBSD: distinfo,v 1.4 2021/06/19 07:23:31 nia Exp $ | |
2 | 2 | |||
3 | SHA1 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 1a9b99431b50f576236b33a82b1a4a0c17754402 | 3 | SHA1 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 1a9b99431b50f576236b33a82b1a4a0c17754402 | |
4 | RMD160 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 52ab590b9401ae039cfae5beb34fc514144be9a1 | 4 | RMD160 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 52ab590b9401ae039cfae5beb34fc514144be9a1 | |
5 | SHA512 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 2da2fdf04c5198b24cf74402a13bdc77a61bd3dbcc5e682485884611ffffdc4824ac32709b3a6e24b5df1263392f4fa1939020c22202bbfea6f7ce907293b64e | 5 | SHA512 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 2da2fdf04c5198b24cf74402a13bdc77a61bd3dbcc5e682485884611ffffdc4824ac32709b3a6e24b5df1263392f4fa1939020c22202bbfea6f7ce907293b64e | |
6 | Size (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 24302224 bytes | 6 | Size (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 24302224 bytes | |
7 | SHA1 (patch-Makefile) = ac0a4ba498396911e195278e84cffdc5f98996a2 | 7 | SHA1 (patch-Makefile) = cfa8db8855296b1793c09d509590ea2a34fd45f9 | |
8 | SHA1 (patch-src_emu_emucore.h) = ecb9617e260559aeb685e9625195f2ad6c99244d | 8 | SHA1 (patch-src_emu_emucore.h) = 51e024ebb7a92d49cf873a0a988da45a483551b7 | |
9 | SHA1 (patch-src_emu_romload.c) = 7907e934439a7e5ed92c71394e6a9a0c5ef9cf94 | 9 | SHA1 (patch-src_emu_romload.c) = 130167a433cf4f7b7501a1bcf006509d5f0d5326 | |
10 | SHA1 (patch-src_emu_state.h) = 60109326f67e079d1cd073bc15393d3b3dbb2ce9 | 10 | SHA1 (patch-src_emu_state.h) = 89d49f5f9dbadc8c4bb703a40c8c1e7e4dae75cd | |
11 | SHA1 (patch-src_emu_uimenu.c) = 717302298958fd0734899537ca8b77f45aa8dd77 | 11 | SHA1 (patch-src_emu_uimenu.c) = a832b3c34e4fef3d11286e9a4722d9324e108447 | |
12 | SHA1 (patch-src_osd_retro_osinline.h) = 3f1063ef37b96f99cea29916cbc446f5c27c6da7 |
@@ -1,64 +1,65 @@ | @@ -1,64 +1,65 @@ | |||
1 | $NetBSD: patch-Makefile,v 1.2 2020/05/14 19:35:59 joerg Exp $ | 1 | $NetBSD: patch-Makefile,v 1.3 2021/06/19 07:23:31 nia Exp $ | |
2 | 2 | |||
3 | Avoid overriding build settings. | 3 | Avoid overriding build settings. | |
4 | Fix build problems with newer compilers. | |||
4 | 5 | |||
5 | --- Makefile.orig 2018-04-17 17:16:44.000000000 +0000 | 6 | --- Makefile.orig 2021-06-19 06:48:42.800581466 +0000 | |
6 | +++ Makefile | 7 | +++ Makefile | |
7 | @@ -55,14 +55,9 @@ LIBS = | 8 | @@ -57,14 +57,9 @@ LIBS = | |
8 | #------------------------------------------------- | 9 | #------------------------------------------------- | |
9 | 10 | |||
10 | # start with empties for everything | 11 | # start with empties for everything | |
11 | -CCOMFLAGS = -DDISABLE_MIDI | 12 | -CCOMFLAGS = -DDISABLE_MIDI | |
12 | -CONLYFLAGS = | 13 | -CONLYFLAGS = | |
13 | -COBJFLAGS = | 14 | -COBJFLAGS = | |
14 | -CPPONLYFLAGS = | 15 | -CPPONLYFLAGS = | |
15 | +CCOMFLAGS += -DDISABLE_MIDI | 16 | +CCOMFLAGS += -DDISABLE_MIDI | |
16 | # LDFLAGS are used generally; LDFLAGSEMULATOR are additional | 17 | # LDFLAGS are used generally; LDFLAGSEMULATOR are additional | |
17 | # flags only used when linking the core emulator | 18 | # flags only used when linking the core emulator | |
18 | -LDFLAGS = | 19 | -LDFLAGS = | |
19 | -LDFLAGSEMULATOR = | 20 | -LDFLAGSEMULATOR = | |
20 | 21 | |||
21 | GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)" | 22 | GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)" | |
22 | ifneq ($(GIT_VERSION)," unknown") | 23 | ifneq ($(GIT_VERSION)," unknown") | |
23 | @@ -143,15 +138,6 @@ ifeq ($(VRENDER),opengl) | 24 | @@ -145,15 +140,6 @@ ifeq ($(VRENDER),opengl) | |
24 | LIBS += -lGL | 25 | LIBS += -lGL | |
25 | endif | 26 | endif | |
26 | LDFLAGS += $(SHARED) | 27 | LDFLAGS += $(SHARED) | |
27 | - NATIVELD = g++ | 28 | - NATIVELD = g++ | |
28 | - NATIVELDFLAGS = -Wl,--warn-common -lstdc++ | 29 | - NATIVELDFLAGS = -Wl,--warn-common -lstdc++ | |
29 | - NATIVECC = g++ | 30 | - NATIVECC = g++ | |
30 | - NATIVECFLAGS = -std=gnu99 | 31 | - NATIVECFLAGS = -std=gnu99 | |
31 | - CC_AS = gcc | 32 | - CC_AS = gcc | |
32 | - CC = g++ | 33 | - CC = g++ | |
33 | - AR = @ar | 34 | - AR = @ar | |
34 | - LD = g++ | 35 | - LD = g++ | |
35 | - CCOMFLAGS += $(PLATCFLAGS) -ffast-math | 36 | - CCOMFLAGS += $(PLATCFLAGS) -ffast-math | |
36 | LIBS += -lstdc++ -lpthread | 37 | LIBS += -lstdc++ -lpthread | |
37 | 38 | |||
38 | # Android | 39 | # Android | |
39 | @@ -568,7 +554,7 @@ DEFS += -DFLAC__NO_DLL | 40 | @@ -656,7 +642,7 @@ DEFS += -DFLAC__NO_DLL | |
40 | 41 | |||
41 | # CFLAGS is defined based on C or C++ targets | 42 | # CFLAGS is defined based on C or C++ targets | |
42 | # (remember, expansion only happens when used, so doing it here is ok) | 43 | # (remember, expansion only happens when used, so doing it here is ok) | |
43 | -CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) | 44 | -CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) | |
44 | +CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) | 45 | +CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) | |
45 | 46 | |||
46 | # we compile C-only to C89 standard with GNU extensions | 47 | # we compile C-only to C89 standard with GNU extensions | |
47 | # we compile C++ code to C++98 standard with GNU extensions | 48 | # we compile C++ code to C++98 standard with GNU extensions | |
48 | @@ -578,7 +564,7 @@ CONLYFLAGS += -ansi | 49 | @@ -666,7 +652,7 @@ CONLYFLAGS += -ansi | |
49 | else | 50 | else | |
50 | CONLYFLAGS += -std=gnu89 | 51 | CONLYFLAGS += -std=gnu89 | |
51 | endif | 52 | endif | |
52 | -CPPONLYFLAGS += -x c++ -std=gnu++98 | 53 | -CPPONLYFLAGS += -x c++ -std=gnu++98 | |
53 | +CPPONLYFLAGS += -x c++ -std=gnu++11 -Wno-c++11-narrowing | 54 | +CPPONLYFLAGS += -x c++ -std=gnu++11 -Wno-narrowing | |
54 | COBJFLAGS += -x objective-c++ | 55 | COBJFLAGS += -x objective-c++ | |
55 | 56 | |||
56 | # this speeds it up a bit by piping between the preprocessor/compiler/assembler | 57 | # this speeds it up a bit by piping between the preprocessor/compiler/assembler | |
57 | @@ -588,7 +574,6 @@ ifeq ($(MDEBUG),1) | 58 | @@ -676,7 +662,6 @@ ifeq ($(MDEBUG),1) | |
58 | CCOMFLAGS += -O0 -g | 59 | CCOMFLAGS += -O0 -g | |
59 | else | 60 | else | |
60 | # add the optimization flag | 61 | # add the optimization flag | |
61 | -CCOMFLAGS += -O$(OPTIMIZE) | 62 | -CCOMFLAGS += -O$(OPTIMIZE) | |
62 | endif | 63 | endif | |
63 | 64 | |||
64 | # add the error warning flag | 65 | # add the error warning flag |
@@ -1,22 +1,25 @@ | @@ -1,22 +1,25 @@ | |||
1 | $NetBSD: patch-src_emu_state.h,v 1.2 2020/05/30 20:36:15 nia Exp $ | 1 | $NetBSD: patch-src_emu_state.h,v 1.3 2021/06/19 07:23:31 nia Exp $ | |
2 | ||||
3 | Consistently build as C++11 source, but ignore narrow issues. | |||
4 | Don't depend on ordering of pointers relative to zero. Avoid UDL. | |||
2 | 5 | |||
3 | --- src/emu/state.h.orig 2020-05-25 02:01:22.000000000 +0000 | 6 | --- src/emu/state.h.orig 2020-05-25 02:01:22.000000000 +0000 | |
4 | +++ src/emu/state.h | 7 | +++ src/emu/state.h | |
5 | @@ -18,17 +18,8 @@ | 8 | @@ -18,17 +18,8 @@ | |
6 | #ifndef __STATE_H__ | 9 | #ifndef __STATE_H__ | |
7 | #define __STATE_H__ | 10 | #define __STATE_H__ | |
8 | 11 | |||
9 | -#if (defined(__MACH__) && !defined(IOS)) || defined(ANDROID) | 12 | -#if (defined(__MACH__) && !defined(IOS)) || defined(ANDROID) | |
10 | #include <type_traits> | 13 | #include <type_traits> | |
11 | #define DEF_NAMESPACE std | 14 | #define DEF_NAMESPACE std | |
12 | -#elif defined(IOS) | 15 | -#elif defined(IOS) | |
13 | -#include <type_traits> | 16 | -#include <type_traits> | |
14 | -#define DEF_NAMESPACE std::tr1 | 17 | -#define DEF_NAMESPACE std::tr1 | |
15 | -#define DEF_NAMESPACE std | 18 | -#define DEF_NAMESPACE std | |
16 | -#elif defined(__GNUC__) | 19 | -#elif defined(__GNUC__) | |
17 | -#include <tr1/type_traits> | 20 | -#include <tr1/type_traits> | |
18 | -#define DEF_NAMESPACE std::tr1 | 21 | -#define DEF_NAMESPACE std::tr1 | |
19 | -#endif | 22 | -#endif | |
20 | 23 | |||
21 | 24 | |||
22 | /*************************************************************************** | 25 | /*************************************************************************** |
@@ -1,22 +1,22 @@ | @@ -1,22 +1,22 @@ | |||
1 | $NetBSD: patch-src_emu_emucore.h,v 1.1 2019/01/02 13:24:29 nia Exp $ | 1 | $NetBSD: patch-src_emu_emucore.h,v 1.2 2021/06/19 07:23:31 nia Exp $ | |
2 | 2 | |||
3 | Avoid colliding with libc symbols on NetBSD. | 3 | Avoid colliding with libc symbols on NetBSD. | |
4 | 4 | |||
5 | --- src/emu/emucore.h.orig 2018-04-17 17:16:44.000000000 +0000 | 5 | --- src/emu/emucore.h.orig 2018-04-17 17:16:44.000000000 +0000 | |
6 | +++ src/emu/emucore.h | 6 | +++ src/emu/emucore.h | |
7 | @@ -502,6 +502,7 @@ inline void fatalerror_exitcode(running_ | 7 | @@ -502,6 +502,7 @@ inline void fatalerror_exitcode(running_ | |
8 | //************************************************************************** | 8 | //************************************************************************** | |
9 | 9 | |||
10 | // population count | 10 | // population count | |
11 | +#ifndef __NetBSD__ | 11 | +#ifndef __NetBSD__ | |
12 | inline int popcount(UINT32 val) | 12 | inline int popcount(UINT32 val) | |
13 | { | 13 | { | |
14 | int count; | 14 | int count; | |
15 | @@ -510,6 +511,7 @@ inline int popcount(UINT32 val) | 15 | @@ -510,6 +511,7 @@ inline int popcount(UINT32 val) | |
16 | val &= val - 1; | 16 | val &= val - 1; | |
17 | return count; | 17 | return count; | |
18 | } | 18 | } | |
19 | +#endif | 19 | +#endif | |
20 | 20 | |||
21 | 21 | |||
22 | // convert a series of 32 bits into a float | 22 | // convert a series of 32 bits into a float |
@@ -1,20 +1,23 @@ | @@ -1,20 +1,23 @@ | |||
1 | $NetBSD: patch-src_emu_romload.c,v 1.1 2020/05/14 19:35:59 joerg Exp $ | 1 | $NetBSD: patch-src_emu_romload.c,v 1.2 2021/06/19 07:23:31 nia Exp $ | |
2 | ||||
3 | Consistently build as C++11 source, but ignore narrow issues. | |||
4 | Don't depend on ordering of pointers relative to zero. Avoid UDL. | |||
2 | 5 | |||
3 | --- src/emu/romload.c.orig 2020-05-13 15:21:49.756367021 +0000 | 6 | --- src/emu/romload.c.orig 2020-05-13 15:21:49.756367021 +0000 | |
4 | +++ src/emu/romload.c | 7 | +++ src/emu/romload.c | |
5 | @@ -586,13 +586,13 @@ static void display_rom_load_results(rom | 8 | @@ -586,13 +586,13 @@ static void display_rom_load_results(rom | |
6 | { | 9 | { | |
7 | /* create the error message and exit fatally */ | 10 | /* create the error message and exit fatally */ | |
8 | mame_printf_error("%s", romdata->errorstring.cstr()); | 11 | mame_printf_error("%s", romdata->errorstring.cstr()); | |
9 | - fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); | 12 | - fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); | |
10 | + fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the " GAMENOUN " cannot be run."); | 13 | + fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the " GAMENOUN " cannot be run."); | |
11 | } | 14 | } | |
12 | 15 | |||
13 | /* if we had warnings, output them, but continue */ | 16 | /* if we had warnings, output them, but continue */ | |
14 | if (romdata->warnings) | 17 | if (romdata->warnings) | |
15 | { | 18 | { | |
16 | - romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly."); | 19 | - romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly."); | |
17 | + romdata->errorstring.cat("WARNING: the " GAMENOUN " might not run correctly."); | 20 | + romdata->errorstring.cat("WARNING: the " GAMENOUN " might not run correctly."); | |
18 | mame_printf_warning("%s\n", romdata->errorstring.cstr()); | 21 | mame_printf_warning("%s\n", romdata->errorstring.cstr()); | |
19 | } | 22 | } | |
20 | } | 23 | } |
$NetBSD: patch-src_osd_retro_osinline.h,v 1.1 2021/06/19 07:23:31 nia Exp $
Use the "ARM" code as a portable fallback for other architectures.
--- src/osd/retro/osinline.h.orig 2021-06-19 06:40:29.471151424 +0000
+++ src/osd/retro/osinline.h
@@ -32,16 +32,11 @@ empty
#define _osd_exchange64(ptr, exchange) (register INT64 ret; __asm__ __volatile__ ("1: ldarx %[ret], 0, %[ptr] \n"" stdcx. %[exchange], 0, %[ptr] \n"" bne- 1b \n": [ret] "=&r" (ret): [ptr] "r" (ptr), [exchange] "r" (exchange): "cr0"); ret)
#define osd_exchange64 _osd_exchange64
#endif /* __ppc64__ || __PPC64__ */
-
-#endif
-
-#if defined(ARM_ENABLED)
-
+#else
#ifndef YieldProcessor
#define YieldProcessor() do {} while (0)
#define osd_yield_processor() YieldProcessor()
#endif
-
#endif
#include "eminline.h"