From nobody Mon Jun 26 23:30:42 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qqkc443P3z4kNJm; Mon, 26 Jun 2023 23:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qqkc42z7Cz3wbp; Mon, 26 Jun 2023 23:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687822244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qjmDctKyIu611sYhZfQjyNoxAYM2f/PJe6CzmKQ+2q4=; b=c2q4bSVdjUqT02bc+59IY9p+KNRUyJnRyFjUYG1GNLNX2cQT3vQLZ62ePefdILjVVxfOW5 bkGMkowP4GgVpcsYi+IAfyXSShfYw2WjDymz8AK9B8xveM6tBNVJz5bkFpcwliKdLk49x3 9LHiKaCMdBKVrEWCGyF+owS1umCDYepzf/CZD6oxVTThzNMi7dqgkINg9ccRRqwVL8OPre r8ARBdmzJV7Ucgz7U6fAALlK4k1Fwr/WfVWB7d91aOilxuB04X+o5EEgPA2CuTYnWKk/NV Us12/1wD05WeGSwRaTGW20MezhM0NkQaFoK4CKF41slGOojsOeJuh5vzlhRQyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687822244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qjmDctKyIu611sYhZfQjyNoxAYM2f/PJe6CzmKQ+2q4=; b=xDkrVlPx3J2AYIezJAa0XNQC6UTCCQr51VxcHcJJ81D5Gq/E8pYPbMoahfTZd425QokVmH X7cdrqD5xrWQCz61P9PnJ8swPxwozWNhIpno+ZbDfIqBIIb95FyCm/xHrppKWhKgffCfzZ CQ5XMv7bzhEhYBUB15Vq+Y95MCN+3sSOnqgsGjqIrmJqggrS1NC4LysRc1IP8GaF3Wh7x3 FwSW5gkVMi5lp/6zMEyUB8nIbbpL7oSq7ObA+X8Ro1x1MGOgbD8m9siOuWqsOo8E4wG7lG 9jbWfzCrQTJzFg4jKhEm82gDihYVMiQ012IejNeJO5Q9Gpdk4D3WeuUJDVn1qQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687822244; a=rsa-sha256; cv=none; b=erMt6qS+4gtSf5KS4Wr8pCQbYiS4EpWpfQchP6clkxG+8EWwSqVC0O2T1nXzo6FW8/K/wd NxmZoFOnCORlq4hGzoYg/3o+qxI1jMMPzQYFFc/pBzJ26X16HTCDVeKlOwNtvkh0vkFQ0g 6zBO+iyklwBL7zO1MfKGvle58+t9Oprz4Zym79QnbjEshRfDrZ/6XGIcHp69sbqAQjaWvc q0izPqzt/uGSZDa6IDKmIlxAvFM6lPGRfPdMo6v772bmkKKOA7ntzk13QGM2S2m6Lp79ls bov/DD2h0MqX5Ot43jx55Q8iyyBP1QkCzybtUzQA+pVCp6WxWyHuum5o6BUJ8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qqkc34KhgzVCW; Mon, 26 Jun 2023 23:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35QNUgXw025689; Mon, 26 Jun 2023 23:30:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35QNUgw2025687; Mon, 26 Jun 2023 23:30:42 GMT (envelope-from git) Date: Mon, 26 Jun 2023 23:30:42 GMT Message-Id: <202306262330.35QNUgw2025687@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Robert Clausecker Subject: git: cb40b0a43949 - main - emulators/mame: fix build on armv7 and arm64 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb40b0a43949a621f407fa3b65dff7349b024ba2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=cb40b0a43949a621f407fa3b65dff7349b024ba2 commit cb40b0a43949a621f407fa3b65dff7349b024ba2 Author: Robert Clausecker AuthorDate: 2023-06-25 16:58:55 +0000 Commit: Robert Clausecker CommitDate: 2023-06-26 23:30:28 +0000 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 --- emulators/mame/Makefile | 3 ++ .../patch-3rdparty_lzma_CPP_7zip_7zip__gcc.mak | 27 ++++++++++++++ .../patch-3rdparty_lzma_CPP_7zip_var__gcc.mak | 12 +++++++ .../patch-3rdparty_lzma_CPP_Windows_SystemInfo.cpp | 27 ++++++++++++++ emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c | 11 ++++++ emulators/mame/files/patch-3rdparty_lzma_C_Aes.c | 11 ++++++ .../mame/files/patch-3rdparty_lzma_C_AesOpt.c | 38 ++++++++++++++++++++ .../mame/files/patch-3rdparty_lzma_C_CpuArch.c | 42 ++++++++++++++++++++++ .../mame/files/patch-3rdparty_lzma_C_Sha256Opt.c | 11 ++++++ 9 files changed, 182 insertions(+) diff --git a/emulators/mame/Makefile b/emulators/mame/Makefile index ffeae0127dc2..07f8578e0c3c 100644 --- a/emulators/mame/Makefile +++ b/emulators/mame/Makefile @@ -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/* diff --git a/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_7zip__gcc.mak b/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_7zip__gcc.mak new file mode 100644 index 000000000000..3949c6e06167 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_7zip__gcc.mak @@ -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 diff --git a/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_var__gcc.mak b/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_var__gcc.mak new file mode 100644 index 000000000000..cfd83c3c7213 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_CPP_7zip_var__gcc.mak @@ -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 diff --git a/emulators/mame/files/patch-3rdparty_lzma_CPP_Windows_SystemInfo.cpp b/emulators/mame/files/patch-3rdparty_lzma_CPP_Windows_SystemInfo.cpp new file mode 100644 index 000000000000..25e855008237 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_CPP_Windows_SystemInfo.cpp @@ -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 + ++#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 + #endif + #endif diff --git a/emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c b/emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c new file mode 100644 index 000000000000..5047b6809214 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_C_7zCrc.c @@ -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*") + diff --git a/emulators/mame/files/patch-3rdparty_lzma_C_Aes.c b/emulators/mame/files/patch-3rdparty_lzma_C_Aes.c new file mode 100644 index 000000000000..8c66c80c974f --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_C_Aes.c @@ -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 diff --git a/emulators/mame/files/patch-3rdparty_lzma_C_AesOpt.c b/emulators/mame/files/patch-3rdparty_lzma_C_AesOpt.c new file mode 100644 index 000000000000..d9c7100bbe30 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_C_AesOpt.c @@ -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 diff --git a/emulators/mame/files/patch-3rdparty_lzma_C_CpuArch.c b/emulators/mame/files/patch-3rdparty_lzma_C_CpuArch.c new file mode 100644 index 000000000000..0845a73832cb --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_C_CpuArch.c @@ -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 + ++#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 + diff --git a/emulators/mame/files/patch-3rdparty_lzma_C_Sha256Opt.c b/emulators/mame/files/patch-3rdparty_lzma_C_Sha256Opt.c new file mode 100644 index 000000000000..525d4f9e96e0 --- /dev/null +++ b/emulators/mame/files/patch-3rdparty_lzma_C_Sha256Opt.c @@ -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