emulators/mame: fix build on armv7 and arm64
Port now bundles LZMA with known build issues. Import patch set from archivers/7-zip to fix the build on armv7 and arm64. PR: 271987 Approved by: portmgr (build fix blanket) Obtained from: archivers/7-zip
This commit is contained in:
parent
1ebb93fd80
commit
cb40b0a439
9 changed files with 182 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
PORTNAME= mame
|
||||
DISTVERSION= 0.255
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= emulators games
|
||||
|
||||
MAINTAINER= agh@riseup.net
|
||||
|
@ -67,6 +68,8 @@ MAKE_ENV= LDOPTS="${LDFLAGS}" \
|
|||
USE_SYSTEM_LIB_ZLIB=1 \
|
||||
USE_TAPTUN=1
|
||||
|
||||
CFLAGS_aarch64= -march=armv8-a+crc+crypto
|
||||
|
||||
SUB_FILES= pkg-message mame.ini plugin.ini ui.ini
|
||||
|
||||
PORTDOCS= html/*
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
--- 3rdparty/lzma/CPP/7zip/7zip_gcc.mak.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/CPP/7zip/7zip_gcc.mak
|
||||
@@ -18,13 +18,13 @@ PROGPATH_STATIC = $(O)/$(PROG)s
|
||||
|
||||
|
||||
ifneq ($(CC), xlc)
|
||||
-CFLAGS_WARN_WALL = -Wall -Werror -Wextra
|
||||
+CFLAGS_WARN_WALL =
|
||||
endif
|
||||
|
||||
# for object file
|
||||
CFLAGS_BASE_LIST = -c
|
||||
# CFLAGS_BASE_LIST = -S
|
||||
-CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \
|
||||
+CFLAGS_BASE = $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \
|
||||
-DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
|
||||
-fPIC
|
||||
|
||||
@@ -131,7 +131,7 @@ DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(
|
||||
|
||||
# LOCAL_LIBS=-lpthread
|
||||
# LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
|
||||
-LIB2 = -lpthread -ldl
|
||||
+LIB2 = $(LOCAL_LIBS) -lpthread
|
||||
|
||||
|
||||
endif
|
|
@ -0,0 +1,12 @@
|
|||
--- 3rdparty/lzma/CPP/7zip/var_gcc.mak.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/CPP/7zip/var_gcc.mak
|
||||
@@ -6,7 +6,7 @@ IS_ARM64=
|
||||
CROSS_COMPILE=
|
||||
MY_ARCH=
|
||||
USE_ASM=
|
||||
-CC=$(CROSS_COMPILE)gcc
|
||||
-CXX=$(CROSS_COMPILE)g++
|
||||
+CC=$(CC)
|
||||
+CXX=$(CXX)
|
||||
|
||||
# -march=armv8-a+crc+crypto
|
|
@ -0,0 +1,27 @@
|
|||
--- 3rdparty/lzma/CPP/Windows/SystemInfo.cpp.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/CPP/Windows/SystemInfo.cpp
|
||||
@@ -20,6 +20,15 @@
|
||||
|
||||
#include <sys/auxv.h>
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+unsigned long getauxval(unsigned long type)
|
||||
+{
|
||||
+ unsigned long aux = 0;
|
||||
+ elf_aux_info(type, &aux, sizeof(aux));
|
||||
+ return aux;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
// #undef AT_HWCAP // to debug
|
||||
// #undef AT_HWCAP2 // to debug
|
||||
|
||||
@@ -36,7 +45,7 @@
|
||||
#endif
|
||||
*/
|
||||
|
||||
-#ifdef MY_CPU_ARM_OR_ARM64
|
||||
+#if defined(MY_CPU_ARM_OR_ARM64) && !defined(__FreeBSD__)
|
||||
#include <asm/hwcap.h>
|
||||
#endif
|
||||
#endif
|
11
emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c
Normal file
11
emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- 3rdparty/lzma/C/7zCrc.c.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/C/7zCrc.c
|
||||
@@ -71,7 +71,7 @@ UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
|
||||
-#if defined(MY_CPU_ARM_OR_ARM64)
|
||||
+#if defined(MY_CPU_ARM64)
|
||||
|
||||
// #pragma message("ARM*")
|
||||
|
11
emulators/mame/files/patch-3rdparty_lzma_C_Aes.c
Normal file
11
emulators/mame/files/patch-3rdparty_lzma_C_Aes.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- 3rdparty/lzma/C/Aes.c.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/C/Aes.c
|
||||
@@ -55,7 +55,7 @@ static Byte InvS[256];
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
#define USE_HW_AES
|
||||
-#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
|
||||
+#elif defined(MY_CPU_ARM) && defined(MY_CPU_LE)
|
||||
#if defined(__clang__)
|
||||
#if (__clang_major__ >= 8) // fix that check
|
||||
#define USE_HW_AES
|
38
emulators/mame/files/patch-3rdparty_lzma_C_AesOpt.c
Normal file
38
emulators/mame/files/patch-3rdparty_lzma_C_AesOpt.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
--- 3rdparty/lzma/C/AesOpt.c.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/C/AesOpt.c
|
||||
@@ -506,7 +506,7 @@ VAES_COMPAT_STUB (AesCtr_Code_HW)
|
||||
#endif // ! USE_INTEL_VAES
|
||||
|
||||
|
||||
-#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
|
||||
+#elif defined(MY_CPU_ARM64) && defined(MY_CPU_LE)
|
||||
|
||||
#if defined(__clang__)
|
||||
#if (__clang_major__ >= 8) // fix that check
|
||||
@@ -773,4 +773,25 @@ AES_FUNC_START2 (AesCtr_Code_HW)
|
||||
|
||||
#endif // USE_HW_AES
|
||||
|
||||
-#endif // MY_CPU_ARM_OR_ARM64
|
||||
+#else
|
||||
+
|
||||
+/* no USE_HW_AES */
|
||||
+
|
||||
+#pragma message("AES HW_SW stub was used")
|
||||
+
|
||||
+#define AES_TYPE_keys UInt32
|
||||
+#define AES_TYPE_data Byte
|
||||
+
|
||||
+#define AES_FUNC_START(name) \
|
||||
+ void MY_FAST_CALL name(UInt32 *p, Byte *data, size_t numBlocks) \
|
||||
+
|
||||
+#define AES_COMPAT_STUB(name) \
|
||||
+ AES_FUNC_START(name); \
|
||||
+ AES_FUNC_START(name ## _HW) \
|
||||
+ { name(p, data, numBlocks); }
|
||||
+
|
||||
+AES_COMPAT_STUB (AesCbc_Encode)
|
||||
+AES_COMPAT_STUB (AesCbc_Decode)
|
||||
+AES_COMPAT_STUB (AesCtr_Code)
|
||||
+
|
||||
+#endif
|
42
emulators/mame/files/patch-3rdparty_lzma_C_CpuArch.c
Normal file
42
emulators/mame/files/patch-3rdparty_lzma_C_CpuArch.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
--- 3rdparty/lzma/C/CpuArch.c.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/C/CpuArch.c
|
||||
@@ -417,6 +417,31 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
|
||||
|
||||
#include <sys/auxv.h>
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+static unsigned long get_hwcap(int aux) {
|
||||
+ unsigned long hwcap;
|
||||
+ if (elf_aux_info(aux, &hwcap, sizeof hwcap) != 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return hwcap;
|
||||
+}
|
||||
+
|
||||
+#ifdef MY_CPU_ARM64
|
||||
+BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap(AT_HWCAP) & HWCAP_CRC32; }
|
||||
+BoolInt CPU_IsSupported_NEON(void) { return 1; }
|
||||
+BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap(AT_HWCAP) & HWCAP_SHA1; }
|
||||
+BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap(AT_HWCAP) & HWCAP_SHA2; }
|
||||
+BoolInt CPU_IsSupported_AES(void) { return get_hwcap(AT_HWCAP) & HWCAP_AES; }
|
||||
+#else /* MY_CPU_ARM */
|
||||
+BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_CRC32; }
|
||||
+BoolInt CPU_IsSupported_NEON(void) { return get_hwcap(AT_HWCAP) & HWCAP_NEON; }
|
||||
+BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap(AT_HWCAP2) & HWCAP2_SHA1; }
|
||||
+BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_SHA2; }
|
||||
+BoolInt CPU_IsSupported_AES(void) { return get_hwcap(AT_HWCAP2) & HWCAP2_AES; }
|
||||
+#endif
|
||||
+
|
||||
+#else // __FreeBSD__
|
||||
+
|
||||
#define USE_HWCAP
|
||||
|
||||
#ifdef USE_HWCAP
|
||||
@@ -450,6 +475,7 @@ MY_HWCAP_CHECK_FUNC (SHA1)
|
||||
MY_HWCAP_CHECK_FUNC (SHA2)
|
||||
MY_HWCAP_CHECK_FUNC (AES)
|
||||
|
||||
+#endif // FreeBSD
|
||||
#endif // __APPLE__
|
||||
#endif // _WIN32
|
||||
|
11
emulators/mame/files/patch-3rdparty_lzma_C_Sha256Opt.c
Normal file
11
emulators/mame/files/patch-3rdparty_lzma_C_Sha256Opt.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- 3rdparty/lzma/C/Sha256Opt.c.orig 2023-05-30 17:50:57 UTC
|
||||
+++ 3rdparty/lzma/C/Sha256Opt.c
|
||||
@@ -212,7 +212,7 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[
|
||||
|
||||
#endif // USE_HW_SHA
|
||||
|
||||
-#elif defined(MY_CPU_ARM_OR_ARM64)
|
||||
+#elif defined(MY_CPU_ARM64)
|
||||
|
||||
#if defined(__clang__)
|
||||
#if (__clang_major__ >= 8) // fix that check
|
Loading…
Reference in a new issue