Package: 0ad
Version: 0.0.18-1
Severity: wishlist
Tags: upstream
User: debian-...@lists.debian.org
Usertags: arm64

It would be nice if 0 A.D. would support ARM64.  There are Android
based devices on ARM64 already and I suspect we'll be seeing Linux
desktop devices based on ARM64 soon as well.

I know this is really an upstream issue, but it would be great if you
could raise an upstream feature request.

I briefly looked into it and created a patch with some obvious
locations where ARM64 (or AARCH64, as it's officially called) should
be added, but I'm sure it's incomplete.  I also noticed
libraries/source/nvtt where ARM is referenced.

Note that I followed the existing code in source/lib/byte_order.h but
imho this is not an optimal way to do things as e.g. MIPS and ARM can
be both little or big endian.

-- 
Martin Michlmayr
http://www.cyrius.com/
diff -urN a/0ad-0.0.18/build/premake/premake4.lua 
0ad-0.0.18/build/premake/premake4.lua
--- 0ad-0.0.18/build/premake/premake4.lua       2015-06-27 22:16:37.000000000 
+0000
+++ 0ad-0.0.18/build/premake/premake4.lua       2015-06-27 22:15:40.420000000 
+0000
@@ -86,6 +86,8 @@
                        arch = "x86"
                elseif string.find(machine, "arm") == 1 then
                        arch = "arm"
+               elseif string.find(machine, "aarch64") == 1 then
+                       arch = "aarch64"
                else
                        print("WARNING: Cannot determine architecture from GCC, 
assuming x86")
                end
diff -urN a/0ad-0.0.18/source/lib/byte_order.h 
0ad-0.0.18/source/lib/byte_order.h
--- 0ad-0.0.18/source/lib/byte_order.h  2012-01-17 22:05:43.000000000 +0000
+++ 0ad-0.0.18/source/lib/byte_order.h  2015-06-27 22:12:51.870000000 +0000
@@ -33,7 +33,7 @@
 #ifndef BYTE_ORDER
 # define LITTLE_ENDIAN 0x4321
 # define BIG_ENDIAN    0x1234
-# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || 
ARCH_MIPS || defined(__LITTLE_ENDIAN__)
+# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || 
ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__)
 #  define BYTE_ORDER LITTLE_ENDIAN
 # else
 #  define BYTE_ORDER BIG_ENDIAN
diff -urN a/0ad-0.0.18/source/lib/sysdep/arch.h 
0ad-0.0.18/source/lib/sysdep/arch.h
--- 0ad-0.0.18/source/lib/sysdep/arch.h 2010-09-05 09:38:30.000000000 +0000
+++ 0ad-0.0.18/source/lib/sysdep/arch.h 2015-06-27 22:10:59.160000000 +0000
@@ -58,6 +58,12 @@
 #else
 # define ARCH_ARM 0
 #endif
+// .. AArch64 (ARM64)
+#if defined(__aarch64__)
+# define ARCH_AARCH64 1
+#else
+# define ARCH_AARCH64 0
+#endif
 // .. MIPS
 #if defined(__MIPS__) || defined(__mips__) || defined(__mips)
 # define ARCH_MIPS 1
@@ -66,7 +72,7 @@
 #endif
 
 // ensure exactly one architecture has been detected
-#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_MIPS) != 1
+#if 
(ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS) != 1
 # error "architecture not correctly detected (either none or multiple ARCH_* 
defined)"
 #endif
 
diff -urN a/0ad-0.0.18/source/ps/GameSetup/HWDetect.cpp 
0ad-0.0.18/source/ps/GameSetup/HWDetect.cpp
--- 0ad-0.0.18/source/ps/GameSetup/HWDetect.cpp 2015-01-24 14:46:52.000000000 
+0000
+++ 0ad-0.0.18/source/ps/GameSetup/HWDetect.cpp 2015-06-27 22:12:17.480000000 
+0000
@@ -223,6 +223,7 @@
        scriptInterface.SetProperty(settings, "arch_ia32", ARCH_IA32);
        scriptInterface.SetProperty(settings, "arch_amd64", ARCH_AMD64);
        scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM);
+       scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64);
 
 #ifdef NDEBUG
        scriptInterface.SetProperty(settings, "build_debug", 0);

Reply via email to