git: 5953f15101db - main - devel/zydis: fix build on riscv64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 30 Sep 2022 08:24:28 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5953f15101db1fee998b4f17d4ef683427ff9c88

commit 5953f15101db1fee998b4f17d4ef683427ff9c88
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-09-30 08:23:52 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-09-30 08:24:22 +0000

    devel/zydis: fix build on riscv64
---
 devel/zydis/Makefile                                                 | 2 +-
 devel/zydis/files/patch-dependencies_zycore_include_Zycore_Defines.h | 4 +++-
 devel/zydis/files/patch-dependencies_zycore_src_Format.c             | 4 ++--
 devel/zydis/files/patch-src_String.c                                 | 4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/devel/zydis/Makefile b/devel/zydis/Makefile
index 044319d5b8cc..d89aa8cb484d 100644
--- a/devel/zydis/Makefile
+++ b/devel/zydis/Makefile
@@ -10,7 +10,7 @@ WWW=		https://zydis.re
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=		aarch64 amd64 armv6 armv7 i386 powerpc powerpc64
+ONLY_FOR_ARCHS=		aarch64 amd64 armv6 armv7 i386 powerpc powerpc64 riscv64
 ONLY_FOR_ARCHS_REASON=	see definitions in include/Zycore/Defines.h
 
 USES=		cmake cpe dos2unix localbase:ldflags
diff --git a/devel/zydis/files/patch-dependencies_zycore_include_Zycore_Defines.h b/devel/zydis/files/patch-dependencies_zycore_include_Zycore_Defines.h
index 82cd1dcc2051..c320cd4c421e 100644
--- a/devel/zydis/files/patch-dependencies_zycore_include_Zycore_Defines.h
+++ b/devel/zydis/files/patch-dependencies_zycore_include_Zycore_Defines.h
@@ -1,6 +1,6 @@
 --- dependencies/zycore/include/Zycore/Defines.h.orig	2022-09-29 22:15:50 UTC
 +++ dependencies/zycore/include/Zycore/Defines.h
-@@ -131,6 +131,10 @@
+@@ -131,6 +131,12 @@
  #   define ZYAN_AARCH64
  #elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__)
  #   define ZYAN_ARM
@@ -8,6 +8,8 @@
 +#   define ZYAN_PPC64
 +#elif defined(__powerpc__)
 +#   define ZYAN_PPC
++#elif defined(__riscv) && __riscv_xlen == 64
++#   define ZYAN_RISCV64
  #elif defined(__EMSCRIPTEN__)
      // Nothing to do, `ZYAN_EMSCRIPTEN` is both platform and arch macro for this one.
  #else
diff --git a/devel/zydis/files/patch-dependencies_zycore_src_Format.c b/devel/zydis/files/patch-dependencies_zycore_src_Format.c
index c207378cc1a2..63287a0d6ace 100644
--- a/devel/zydis/files/patch-dependencies_zycore_src_Format.c
+++ b/devel/zydis/files/patch-dependencies_zycore_src_Format.c
@@ -23,7 +23,7 @@
  ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
  {
 -#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
-+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64)
++#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
      return ZyanStringAppendDecU64(string, value, padding_length);
  #else
      // Working with 64-bit values is slow on non 64-bit systems
@@ -32,7 +32,7 @@
      ZyanBool uppercase)
  {
 -#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
-+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64)
++#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
      return ZyanStringAppendHexU64(string, value, padding_length, uppercase);
  #else
      // Working with 64-bit values is slow on non 64-bit systems
diff --git a/devel/zydis/files/patch-src_String.c b/devel/zydis/files/patch-src_String.c
index 70044c976829..ec8eb9e43828 100644
--- a/devel/zydis/files/patch-src_String.c
+++ b/devel/zydis/files/patch-src_String.c
@@ -23,7 +23,7 @@
      }
  
 -#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
-+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64)
++#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
      ZYAN_CHECK(ZydisStringAppendDecU64(string, value, padding_length));
  #else
      if (value & 0xFFFFFFFF00000000)
@@ -32,7 +32,7 @@
      }
  
 -#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
-+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64)
++#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64)
      ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, uppercase));
  #else
      if (value & 0xFFFFFFFF00000000)