Here's a fix so citra works on arm64.  Briefly tested on my arm64
thinkpad x13s, runs and passes tests.

OK?


Index: emulators/citra/Makefile
===================================================================
RCS file: /cvs/openbsd/ports/emulators/citra/Makefile,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 Makefile
--- emulators/citra/Makefile    22 Jan 2023 15:23:57 -0000      1.21
+++ emulators/citra/Makefile    17 Feb 2023 13:34:12 -0000
@@ -10,6 +10,7 @@ COMMENT =     nintendo 3DS emulator
 DISTNAME =     citra-unified-source-20230110-ad2cbe2
 V =            1827
 PKGNAME =      citra-0.0.0.${V}
+REVISION =     0
 
 CATEGORIES =   emulators
 
@@ -62,6 +63,12 @@ CXXFLAGS +=  -I${LOCALBASE}/include -I${L
 
 post-extract:
        rm -rf ${WRKSRC}/externals/{sdl2,catch2,fmt,boost,cryptopp}
+
+.if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386
+PKG_ARGS +=    -Dx86=1
+.else
+PKG_ARGS +=    -Dx86=0
+.endif
 
 .include <bsd.port.arch.mk>
 
Index: emulators/citra/patches/patch-src_common_aarch64_cpu_detect_cpp
===================================================================
RCS file: emulators/citra/patches/patch-src_common_aarch64_cpu_detect_cpp
diff -N emulators/citra/patches/patch-src_common_aarch64_cpu_detect_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ emulators/citra/patches/patch-src_common_aarch64_cpu_detect_cpp     17 Feb 
2023 12:10:39 -0000
@@ -0,0 +1,62 @@
+Index: src/common/aarch64/cpu_detect.cpp
+--- src/common/aarch64/cpu_detect.cpp.orig
++++ src/common/aarch64/cpu_detect.cpp
+@@ -14,13 +14,17 @@
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ // clang-format on
+-#elif !defined(_WIN32)
++#elif !defined(_WIN32) && !defined(__OpenBSD__)
+ #ifndef __FreeBSD__
+ #include <asm/hwcap.h>
+ #endif // __FreeBSD__
+ #include <sys/auxv.h>
+ #include <unistd.h>
+ #endif // __APPLE__
++#ifdef __OpenBSD__
++#include <sys/sysctl.h>
++#include <machine/cpu.h>      /* CPU_ID_AA64ISAR0 */
++#endif // __OpenBSD__
+ 
+ #include "common/aarch64/cpu_detect.h"
+ #include "common/file_util.h"
+@@ -36,6 +40,10 @@ static std::string GetCPUString() {
+     }
+     return buf;
+ }
++#elif defined(__OpenBSD__)
++static std::string GetCPUString() {
++    return "Unknown";
++}
+ #elif !defined(WIN32)
+ static std::string GetCPUString() {
+     constexpr char procfile[] = "/proc/cpuinfo";
+@@ -76,6 +84,28 @@ static CPUCaps Detect() {
+     caps.sha1 = true;
+     caps.sha2 = true;
+     caps.cpu_string = GetCPUString();
++#elif defined(__OpenBSD__)
++    int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 };
++    size_t len = sizeof(uint64_t);
++    uint64_t cpu_id = 0;
++
++    caps.fp = true;
++    caps.cpu_string = GetCPUString();
++
++    if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) != 1) {
++#define AA64ISA_AES   (0x3 << 4)
++#define AA64ISA_SHA1  (0x1 << 8)
++#define AA64ISA_SHA2  (0x3 << 12)
++#define AA64ISA_CRC32 (0x1 << 16)
++
++        caps.fp = true;
++        caps.asimd = false;   // XXX
++        caps.aes = cpu_id & AA64ISA_AES;
++        caps.crc32 = cpu_id & AA64ISA_CRC32;
++        caps.sha1 = cpu_id & AA64ISA_SHA1;
++        caps.sha2 = cpu_id & AA64ISA_SHA2;
++
++    }
+ #elif defined(_WIN32)
+     // Windows does not provide any mechanism for querying the system 
registers on ARMv8, unlike
+     // Linux which traps the register reads and emulates them in the kernel. 
There are environment
Index: emulators/citra/pkg/PFRAG.x86
===================================================================
RCS file: emulators/citra/pkg/PFRAG.x86
diff -N emulators/citra/pkg/PFRAG.x86
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ emulators/citra/pkg/PFRAG.x86       17 Feb 2023 13:30:52 -0000
@@ -0,0 +1,9 @@
+include/xbyak/
+include/xbyak/xbyak.h
+include/xbyak/xbyak_bin2hex.h
+include/xbyak/xbyak_mnemonic.h
+include/xbyak/xbyak_util.h
+lib/cmake/xbyak/
+lib/cmake/xbyak/xbyak-config-version.cmake
+lib/cmake/xbyak/xbyak-config.cmake
+lib/cmake/xbyak/xbyak-targets.cmake
Index: emulators/citra/pkg/PLIST
===================================================================
RCS file: /cvs/openbsd/ports/emulators/citra/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 PLIST
--- emulators/citra/pkg/PLIST   22 Jan 2023 15:23:58 -0000      1.6
+++ emulators/citra/pkg/PLIST   17 Feb 2023 13:29:53 -0000
@@ -1,3 +1,4 @@
+%%x86%%
 @bin bin/citra
 @bin bin/citra-qt
 @bin bin/citra-room
@@ -152,20 +153,11 @@ include/dynarmic/ir/opt/passes.h
 include/dynarmic/ir/terminal.h
 include/dynarmic/ir/type.h
 include/dynarmic/ir/value.h
-include/xbyak/
-include/xbyak/xbyak.h
-include/xbyak/xbyak_bin2hex.h
-include/xbyak/xbyak_mnemonic.h
-include/xbyak/xbyak_util.h
 lib/cmake/dynarmic/
 lib/cmake/dynarmic/dynarmicConfig.cmake
 lib/cmake/dynarmic/dynarmicConfigVersion.cmake
 lib/cmake/dynarmic/dynarmicTargets${MODCMAKE_BUILD_SUFFIX}
 lib/cmake/dynarmic/dynarmicTargets.cmake
-lib/cmake/xbyak/
-lib/cmake/xbyak/xbyak-config-version.cmake
-lib/cmake/xbyak/xbyak-config.cmake
-lib/cmake/xbyak/xbyak-targets.cmake
 @static-lib lib/libdynarmic.a
 @man man/man6/citra-qt.6
 @man man/man6/citra.6

-- 
Murphy's Law is recursive.  Washing your car to make it rain doesn't
work.

Reply via email to