diff options
author | nia <nia@pkgsrc.org> | 2021-06-19 07:23:31 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2021-06-19 07:23:31 +0000 |
commit | 777b068b95d46d2de229d3688bd4d1c0c9b1488d (patch) | |
tree | 2a2e2a8ad170acd8e71de78a3f17968028dd06fd | |
parent | 60974128bdc1e0f2096386d7c96fb6ced44ea425 (diff) | |
download | pkgsrc-777b068b95d46d2de229d3688bd4d1c0c9b1488d.tar.gz |
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.
8 files changed, 172 insertions, 132 deletions
diff --git a/emulators/libretro-mame2010/Makefile b/emulators/libretro-mame2010/Makefile index 73d56e52cba..2104ea19f71 100644 --- a/emulators/libretro-mame2010/Makefile +++ b/emulators/libretro-mame2010/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2020/05/31 18:34:56 nia Exp $ +# $NetBSD: Makefile,v 1.5 2021/06/19 07:23:31 nia Exp $ DISTNAME= libretro-mame2010-20200525 CATEGORIES= emulators @@ -14,6 +14,8 @@ USE_LANGUAGES= c c++ LIBRETRO_CORE= mame2010 +TOOL_DEPENDS+= dos2unix-[0-9]*:../../converters/dos2unix + MAKE_FLAGS+= BUILD_ZLIB=0 .include "../../mk/endian.mk" @@ -32,8 +34,6 @@ CFLAGS+= -DSDLMAME_BSD CFLAGS+= -DNO_AFFINITY_NP .endif -CFLAGS+= -Wno-narrowing - .if ${MACHINE_ARCH} != "x86_64" && ${MACHINE_ARCH} != "i386" MAKE_FLAGS+= FORCE_DRC_C_BACKEND=1 .endif @@ -57,5 +57,10 @@ MAKE_FLAGS+= PTR64=1 MAKE_FLAGS+= CC=${CXX:Q} MAKE_FLAGS+= LD=${CXX:Q} +post-extract: + cd ${WRKSRC} && dos2unix Makefile + cd ${WRKSRC} && dos2unix src/emu/*.c src/emu/*.h + cd ${WRKSRC} && dos2unix src/osd/retro/osinline.h + .include "../../devel/zlib/buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/emulators/libretro-mame2010/distinfo b/emulators/libretro-mame2010/distinfo index fa5e075d397..f15176e1431 100644 --- a/emulators/libretro-mame2010/distinfo +++ b/emulators/libretro-mame2010/distinfo @@ -1,11 +1,12 @@ -$NetBSD: distinfo,v 1.3 2020/05/30 20:36:15 nia Exp $ +$NetBSD: distinfo,v 1.4 2021/06/19 07:23:31 nia Exp $ SHA1 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 1a9b99431b50f576236b33a82b1a4a0c17754402 RMD160 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 52ab590b9401ae039cfae5beb34fc514144be9a1 SHA512 (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 2da2fdf04c5198b24cf74402a13bdc77a61bd3dbcc5e682485884611ffffdc4824ac32709b3a6e24b5df1263392f4fa1939020c22202bbfea6f7ce907293b64e Size (libretro-mame2010-20200525-bef96188e7276422eab81b44b41361896885bae5.tar.gz) = 24302224 bytes -SHA1 (patch-Makefile) = ac0a4ba498396911e195278e84cffdc5f98996a2 -SHA1 (patch-src_emu_emucore.h) = ecb9617e260559aeb685e9625195f2ad6c99244d -SHA1 (patch-src_emu_romload.c) = 7907e934439a7e5ed92c71394e6a9a0c5ef9cf94 -SHA1 (patch-src_emu_state.h) = 60109326f67e079d1cd073bc15393d3b3dbb2ce9 -SHA1 (patch-src_emu_uimenu.c) = 717302298958fd0734899537ca8b77f45aa8dd77 +SHA1 (patch-Makefile) = cfa8db8855296b1793c09d509590ea2a34fd45f9 +SHA1 (patch-src_emu_emucore.h) = 51e024ebb7a92d49cf873a0a988da45a483551b7 +SHA1 (patch-src_emu_romload.c) = 130167a433cf4f7b7501a1bcf006509d5f0d5326 +SHA1 (patch-src_emu_state.h) = 89d49f5f9dbadc8c4bb703a40c8c1e7e4dae75cd +SHA1 (patch-src_emu_uimenu.c) = a832b3c34e4fef3d11286e9a4722d9324e108447 +SHA1 (patch-src_osd_retro_osinline.h) = 3f1063ef37b96f99cea29916cbc446f5c27c6da7 diff --git a/emulators/libretro-mame2010/patches/patch-Makefile b/emulators/libretro-mame2010/patches/patch-Makefile index 3ae54e0136a..ec8986bf685 100644 --- a/emulators/libretro-mame2010/patches/patch-Makefile +++ b/emulators/libretro-mame2010/patches/patch-Makefile @@ -1,64 +1,65 @@ -$NetBSD: patch-Makefile,v 1.2 2020/05/14 19:35:59 joerg Exp $ +$NetBSD: patch-Makefile,v 1.3 2021/06/19 07:23:31 nia Exp $ Avoid overriding build settings. +Fix build problems with newer compilers. ---- Makefile.orig 2018-04-17 17:16:44.000000000 +0000 +--- Makefile.orig 2021-06-19 06:48:42.800581466 +0000 +++ Makefile -@@ -55,14 +55,9 @@ LIBS =
- #-------------------------------------------------
-
- # start with empties for everything
--CCOMFLAGS = -DDISABLE_MIDI
--CONLYFLAGS =
--COBJFLAGS =
--CPPONLYFLAGS =
-+CCOMFLAGS += -DDISABLE_MIDI
- # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
- # flags only used when linking the core emulator
--LDFLAGS =
--LDFLAGSEMULATOR =
-
- GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
- ifneq ($(GIT_VERSION)," unknown")
-@@ -143,15 +138,6 @@ ifeq ($(VRENDER),opengl)
- LIBS += -lGL
- endif
- LDFLAGS += $(SHARED)
-- NATIVELD = g++
-- NATIVELDFLAGS = -Wl,--warn-common -lstdc++
-- NATIVECC = g++
-- NATIVECFLAGS = -std=gnu99
-- CC_AS = gcc
-- CC = g++
-- AR = @ar
-- LD = g++
-- CCOMFLAGS += $(PLATCFLAGS) -ffast-math
- LIBS += -lstdc++ -lpthread
-
- # Android
-@@ -568,7 +554,7 @@ DEFS += -DFLAC__NO_DLL
-
- # CFLAGS is defined based on C or C++ targets
- # (remember, expansion only happens when used, so doing it here is ok)
--CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
-+CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
-
- # we compile C-only to C89 standard with GNU extensions
- # we compile C++ code to C++98 standard with GNU extensions
-@@ -578,7 +564,7 @@ CONLYFLAGS += -ansi
- else
- CONLYFLAGS += -std=gnu89
- endif
--CPPONLYFLAGS += -x c++ -std=gnu++98
-+CPPONLYFLAGS += -x c++ -std=gnu++11 -Wno-c++11-narrowing
- COBJFLAGS += -x objective-c++
-
- # this speeds it up a bit by piping between the preprocessor/compiler/assembler
-@@ -588,7 +574,6 @@ ifeq ($(MDEBUG),1)
- CCOMFLAGS += -O0 -g
- else
- # add the optimization flag
--CCOMFLAGS += -O$(OPTIMIZE)
- endif
-
- # add the error warning flag
+@@ -57,14 +57,9 @@ LIBS = + #------------------------------------------------- + + # start with empties for everything +-CCOMFLAGS = -DDISABLE_MIDI +-CONLYFLAGS = +-COBJFLAGS = +-CPPONLYFLAGS = ++CCOMFLAGS += -DDISABLE_MIDI + # LDFLAGS are used generally; LDFLAGSEMULATOR are additional + # flags only used when linking the core emulator +-LDFLAGS = +-LDFLAGSEMULATOR = + + GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)" + ifneq ($(GIT_VERSION)," unknown") +@@ -145,15 +140,6 @@ ifeq ($(VRENDER),opengl) + LIBS += -lGL + endif + LDFLAGS += $(SHARED) +- NATIVELD = g++ +- NATIVELDFLAGS = -Wl,--warn-common -lstdc++ +- NATIVECC = g++ +- NATIVECFLAGS = -std=gnu99 +- CC_AS = gcc +- CC = g++ +- AR = @ar +- LD = g++ +- CCOMFLAGS += $(PLATCFLAGS) -ffast-math + LIBS += -lstdc++ -lpthread + + # Android +@@ -656,7 +642,7 @@ DEFS += -DFLAC__NO_DLL + + # CFLAGS is defined based on C or C++ targets + # (remember, expansion only happens when used, so doing it here is ok) +-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) ++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) + + # we compile C-only to C89 standard with GNU extensions + # we compile C++ code to C++98 standard with GNU extensions +@@ -666,7 +652,7 @@ CONLYFLAGS += -ansi + else + CONLYFLAGS += -std=gnu89 + endif +-CPPONLYFLAGS += -x c++ -std=gnu++98 ++CPPONLYFLAGS += -x c++ -std=gnu++11 -Wno-narrowing + COBJFLAGS += -x objective-c++ + + # this speeds it up a bit by piping between the preprocessor/compiler/assembler +@@ -676,7 +662,6 @@ ifeq ($(MDEBUG),1) + CCOMFLAGS += -O0 -g + else + # add the optimization flag +-CCOMFLAGS += -O$(OPTIMIZE) + endif + + # add the error warning flag diff --git a/emulators/libretro-mame2010/patches/patch-src_emu_emucore.h b/emulators/libretro-mame2010/patches/patch-src_emu_emucore.h index 3028c25a8f5..e29f72095c0 100644 --- a/emulators/libretro-mame2010/patches/patch-src_emu_emucore.h +++ b/emulators/libretro-mame2010/patches/patch-src_emu_emucore.h @@ -1,22 +1,22 @@ -$NetBSD: patch-src_emu_emucore.h,v 1.1 2019/01/02 13:24:29 nia Exp $ +$NetBSD: patch-src_emu_emucore.h,v 1.2 2021/06/19 07:23:31 nia Exp $ Avoid colliding with libc symbols on NetBSD. --- src/emu/emucore.h.orig 2018-04-17 17:16:44.000000000 +0000 +++ src/emu/emucore.h @@ -502,6 +502,7 @@ inline void fatalerror_exitcode(running_ - //**************************************************************************
-
- // population count
-+#ifndef __NetBSD__
- inline int popcount(UINT32 val)
- {
- int count;
-@@ -510,6 +511,7 @@ inline int popcount(UINT32 val)
- val &= val - 1;
- return count;
- }
-+#endif
-
-
- // convert a series of 32 bits into a float
+ //************************************************************************** + + // population count ++#ifndef __NetBSD__ + inline int popcount(UINT32 val) + { + int count; +@@ -510,6 +511,7 @@ inline int popcount(UINT32 val) + val &= val - 1; + return count; + } ++#endif + + + // convert a series of 32 bits into a float diff --git a/emulators/libretro-mame2010/patches/patch-src_emu_romload.c b/emulators/libretro-mame2010/patches/patch-src_emu_romload.c index 83099fd2f41..4b296b02a8c 100644 --- a/emulators/libretro-mame2010/patches/patch-src_emu_romload.c +++ b/emulators/libretro-mame2010/patches/patch-src_emu_romload.c @@ -1,20 +1,23 @@ -$NetBSD: patch-src_emu_romload.c,v 1.1 2020/05/14 19:35:59 joerg Exp $ +$NetBSD: patch-src_emu_romload.c,v 1.2 2021/06/19 07:23:31 nia Exp $ + +Consistently build as C++11 source, but ignore narrow issues. +Don't depend on ordering of pointers relative to zero. Avoid UDL. --- src/emu/romload.c.orig 2020-05-13 15:21:49.756367021 +0000 +++ src/emu/romload.c @@ -586,13 +586,13 @@ static void display_rom_load_results(rom - {
- /* create the error message and exit fatally */
- mame_printf_error("%s", romdata->errorstring.cstr());
-- fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run.");
-+ fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the " GAMENOUN " cannot be run.");
- }
-
- /* if we had warnings, output them, but continue */
- if (romdata->warnings)
- {
-- romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly.");
-+ romdata->errorstring.cat("WARNING: the " GAMENOUN " might not run correctly.");
- mame_printf_warning("%s\n", romdata->errorstring.cstr());
- }
- }
+ { + /* create the error message and exit fatally */ + mame_printf_error("%s", romdata->errorstring.cstr()); +- fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); ++ fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the " GAMENOUN " cannot be run."); + } + + /* if we had warnings, output them, but continue */ + if (romdata->warnings) + { +- romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly."); ++ romdata->errorstring.cat("WARNING: the " GAMENOUN " might not run correctly."); + mame_printf_warning("%s\n", romdata->errorstring.cstr()); + } + } diff --git a/emulators/libretro-mame2010/patches/patch-src_emu_state.h b/emulators/libretro-mame2010/patches/patch-src_emu_state.h index 2cee1502afd..b0ffcaafb09 100644 --- a/emulators/libretro-mame2010/patches/patch-src_emu_state.h +++ b/emulators/libretro-mame2010/patches/patch-src_emu_state.h @@ -1,22 +1,25 @@ -$NetBSD: patch-src_emu_state.h,v 1.2 2020/05/30 20:36:15 nia Exp $ +$NetBSD: patch-src_emu_state.h,v 1.3 2021/06/19 07:23:31 nia Exp $ + +Consistently build as C++11 source, but ignore narrow issues. +Don't depend on ordering of pointers relative to zero. Avoid UDL. --- src/emu/state.h.orig 2020-05-25 02:01:22.000000000 +0000 +++ src/emu/state.h @@ -18,17 +18,8 @@ - #ifndef __STATE_H__
- #define __STATE_H__
-
--#if (defined(__MACH__) && !defined(IOS)) || defined(ANDROID)
- #include <type_traits>
- #define DEF_NAMESPACE std
--#elif defined(IOS)
--#include <type_traits>
--#define DEF_NAMESPACE std::tr1
--#define DEF_NAMESPACE std
--#elif defined(__GNUC__)
--#include <tr1/type_traits>
--#define DEF_NAMESPACE std::tr1
--#endif
-
-
- /***************************************************************************
+ #ifndef __STATE_H__ + #define __STATE_H__ + +-#if (defined(__MACH__) && !defined(IOS)) || defined(ANDROID) + #include <type_traits> + #define DEF_NAMESPACE std +-#elif defined(IOS) +-#include <type_traits> +-#define DEF_NAMESPACE std::tr1 +-#define DEF_NAMESPACE std +-#elif defined(__GNUC__) +-#include <tr1/type_traits> +-#define DEF_NAMESPACE std::tr1 +-#endif + + + /*************************************************************************** diff --git a/emulators/libretro-mame2010/patches/patch-src_emu_uimenu.c b/emulators/libretro-mame2010/patches/patch-src_emu_uimenu.c index fc5e07f6474..830fb79264f 100644 --- a/emulators/libretro-mame2010/patches/patch-src_emu_uimenu.c +++ b/emulators/libretro-mame2010/patches/patch-src_emu_uimenu.c @@ -1,17 +1,20 @@ -$NetBSD: patch-src_emu_uimenu.c,v 1.1 2020/05/14 19:35:59 joerg Exp $ +$NetBSD: patch-src_emu_uimenu.c,v 1.2 2021/06/19 07:23:31 nia Exp $ + +Consistently build as C++11 source, but ignore narrow issues. +Don't depend on ordering of pointers relative to zero. Avoid UDL. --- src/emu/uimenu.c.orig 2020-05-13 17:06:07.589487572 +0000 +++ src/emu/uimenu.c @@ -3516,9 +3516,9 @@ static void menu_select_game_populate(ru - /* if nothing there, add a single multiline item and return */
- if (matchcount == 0)
- {
-- ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n"
-- "If this is your first time using "APPNAME", please see the config.txt file in "
-- "the docs directory for information on configuring "APPNAME".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
-+ ui_menu_item_append(menu, "No " GAMESNOUN " found. Please check the rompath specified in the " CONFIGNAME ".ini file.\n\n"
-+ "If this is your first time using " APPNAME ", please see the config.txt file in "
-+ "the docs directory for information on configuring " APPNAME ".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
- return;
- }
-
+ /* if nothing there, add a single multiline item and return */ + if (matchcount == 0) + { +- ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n" +- "If this is your first time using "APPNAME", please see the config.txt file in " +- "the docs directory for information on configuring "APPNAME".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); ++ ui_menu_item_append(menu, "No " GAMESNOUN " found. Please check the rompath specified in the " CONFIGNAME ".ini file.\n\n" ++ "If this is your first time using " APPNAME ", please see the config.txt file in " ++ "the docs directory for information on configuring " APPNAME ".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); + return; + } + diff --git a/emulators/libretro-mame2010/patches/patch-src_osd_retro_osinline.h b/emulators/libretro-mame2010/patches/patch-src_osd_retro_osinline.h new file mode 100644 index 00000000000..eaab9d77ce5 --- /dev/null +++ b/emulators/libretro-mame2010/patches/patch-src_osd_retro_osinline.h @@ -0,0 +1,24 @@ +$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" |