Hi,

archivers/p7zip currently fails to build on loongson, because of a
mistake in patch-C_CpuArch_h: we were implying that __mips64__ always
means that we're running big-endian, but that's wrong for loongson
(which is mips64el).

__MIPSEL__ and __mips64__ are both detected by CpuArch.h, so p7zip
tries to build thinking that it's both big- and little-endian, and
the build fails right at the start.

The following diff just patches CpuArch.h to use <endian.h> instead,
which makes things simpler and correct.

I don't think REVISION needs to be bumped, because it shouldn't change
anything for the architectures where it didn't build (except if there
was an arch where we were successfully building, but with the wrong
endianness).

Index: patches/patch-C_CpuArch_h
===================================================================
RCS file: /cvs/ports/archivers/p7zip/patches/patch-C_CpuArch_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-C_CpuArch_h
--- patches/patch-C_CpuArch_h   10 Apr 2016 19:53:09 -0000      1.2
+++ patches/patch-C_CpuArch_h   2 Jul 2017 09:14:29 -0000
@@ -1,25 +1,52 @@
 $OpenBSD: patch-C_CpuArch_h,v 1.2 2016/04/10 19:53:09 naddy Exp $
 
-Add support for more OpenBSD architectures.
+Use <endian.h> to determine endianness, instead of a complex and 
+incorrect list of architectures.
 
---- C/CpuArch.h.orig   Wed Feb 17 01:27:16 2016
-+++ C/CpuArch.h        Sun Apr  3 19:05:55 2016
-@@ -66,6 +66,8 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and 
-     || defined(__MIPSEL__) \
-     || defined(__MIPSEL) \
-     || defined(_MIPSEL) \
-+    || defined(__alpha__) \
-+    || defined(__sh__) \
-     || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == 
__ORDER_LITTLE_ENDIAN__))
-   #define MY_CPU_LE
+Index: C/CpuArch.h
+--- C/CpuArch.h.orig
++++ C/CpuArch.h
+@@ -5,6 +5,7 @@
+ #define __CPU_ARCH_H
+ 
+ #include "7zTypes.h"
++#include <endian.h>
+ 
+ EXTERN_C_BEGIN
+ 
+@@ -56,33 +57,9 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and 
+ #define MY_CPU_IA64_LE
  #endif
-@@ -82,6 +84,9 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and 
-     || defined(__s390x__) \
-     || defined(__zarch__) \
-     || defined(__sparc) \
-+    || defined(__sparc__) \
-+    || defined(__hppa__) \
-+    || defined(__mips64__) \
-     || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
+ 
+-#if defined(MY_CPU_X86_OR_AMD64) \
+-    || defined(MY_CPU_ARM_LE) \
+-    || defined(MY_CPU_IA64_LE) \
+-    || defined(__LITTLE_ENDIAN__) \
+-    || defined(__ARMEL__) \
+-    || defined(__THUMBEL__) \
+-    || defined(__AARCH64EL__) \
+-    || defined(__MIPSEL__) \
+-    || defined(__MIPSEL) \
+-    || defined(_MIPSEL) \
+-    || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == 
__ORDER_LITTLE_ENDIAN__))
++#if BYTE_ORDER == LITTLE_ENDIAN
+   #define MY_CPU_LE
+-#endif
+-
+-#if defined(__BIG_ENDIAN__) \
+-    || defined(__ARMEB__) \
+-    || defined(__THUMBEB__) \
+-    || defined(__AARCH64EB__) \
+-    || defined(__MIPSEB__) \
+-    || defined(__MIPSEB) \
+-    || defined(_MIPSEB) \
+-    || defined(__m68k__) \
+-    || defined(__s390__) \
+-    || defined(__s390x__) \
+-    || defined(__zarch__) \
+-    || defined(__sparc) \
+-    || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
++#elif BYTE_ORDER == BIG_ENDIAN
    #define MY_CPU_BE
  #endif
+ 

Reply via email to