Source: ares
Version: 132-1
Severity: wishlist
Tags: ftbfs
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

Compiling the ares failed for loong64 in the Debian Package Auto-Building environment. The error messages is as follows,
```
make[1]: Entering directory '/<<PKGBUILDDIR>>/desktop-ui'
../nall/GNUmakefile:123: *** unknown arch, please specify manually..  Stop.
make[1]: Leaving directory '/<<PKGBUILDDIR>>/desktop-ui'
dh_auto_clean: error: cd desktop-ui && make -j16 distclean returned exit code 2
```
The full build log can be found at https://buildd.debian.org/status/logs.php?pkg=ares&ver=132-1&arch=loong64.

I have added the loongarch64 support in ares source code.
The ares source package was compiled successfully on my local environment.
Please consider the patch I have attached.
I have also submitted the pull-request to ares upstream, please see https://github.com/ares-emulator/ares/pull/1356.
If you have any questions, you can contact me at any time.

thanks,
Dandan Zhang

Description: Add loongarch64 support 
Last-Update: 2023-12-28

--- ares-132.orig/nall/GNUmakefile
+++ ares-132/nall/GNUmakefile
@@ -90,6 +90,8 @@ ifneq ($(filter amd64-% x86_64-%,$(machi
   machine := amd64
 else ifneq ($(filter arm64-% aarch64-%,$(machine_str)),)
   machine := arm64
+else ifneq ($(filter loong64-% loongarch64-%,$(machine_str)),)
+  machine := loong64
 else ifneq ($(filter powerpc64-% powerpc64le-%,$(machine_str)),)
   machine := ppc64
 endif
--- ares-132.orig/nall/intrinsics.hpp
+++ ares-132/nall/intrinsics.hpp
@@ -183,6 +183,7 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 0;
   };
@@ -196,6 +197,7 @@ namespace nall {
     static constexpr bool amd64 = 1;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 0;
   };
@@ -207,6 +209,7 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 1;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 0;
   };
@@ -217,6 +220,18 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 1;
+    static constexpr bool loong64 = 0;
+    static constexpr bool ppc64 = 0;
+    static constexpr bool ppc32 = 0;
+  };
+#elif defined(__loongarch64)
+  #define ARCHITECTURE_LOONG64
+  struct Architecture {
+    static constexpr bool x86   = 0;
+    static constexpr bool amd64 = 0;
+    static constexpr bool arm64 = 0;
+    static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 1;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 0;
   };
@@ -227,6 +242,7 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 1;
     static constexpr bool ppc32 = 0;
   };
@@ -237,6 +253,7 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 1;
   };
@@ -248,6 +265,7 @@ namespace nall {
     static constexpr bool amd64 = 0;
     static constexpr bool arm64 = 0;
     static constexpr bool arm32 = 0;
+    static constexpr bool loong64 = 0;
     static constexpr bool ppc64 = 0;
     static constexpr bool ppc32 = 0;
   };
@@ -259,7 +277,7 @@ namespace nall {
 
 /* Endian detection */
 
-#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64)
+#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64) || defined(__loongarch64)
   #define ENDIAN_LITTLE
   struct Endian {
     static constexpr bool Little = 1;

Reply via email to