git: dd5b5fe1a47f - main - devel/simdjson: fix build on powerpc64

Piotr Kubaj pkubaj at FreeBSD.org
Tue Jun 15 08:42:15 UTC 2021


The branch main has been updated by pkubaj:

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

commit dd5b5fe1a47fe18a4a753711435750fdae1ce353
Author:     Piotr Kubaj <pkubaj at FreeBSD.org>
AuthorDate: 2021-06-15 08:41:07 +0000
Commit:     Piotr Kubaj <pkubaj at FreeBSD.org>
CommitDate: 2021-06-15 08:41:07 +0000

    devel/simdjson: fix build on powerpc64
    
    FreeBSD uses sys/endian.h header instead of byteswap.h and bswap64() instead of bswap_64().
    
    -mpower8-vector is necessary because the port uses new SIMD introduced in POWER8.
    /wrkdirs/usr/ports/devel/simdjson/work/simdjson-0.9.5/include/simdjson/ppc64/numberparsing.h:4:10: fatal error: 'byteswap.h' file not found
---
 devel/simdjson/Makefile                              |  1 +
 .../patch-include_simdjson_ppc64_numberparsing.h     | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/devel/simdjson/Makefile b/devel/simdjson/Makefile
index 269d92484b4b..d2b048bf386e 100644
--- a/devel/simdjson/Makefile
+++ b/devel/simdjson/Makefile
@@ -10,6 +10,7 @@ LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BROKEN_i386=	does not build (error: unknown type name '__uint128_t')
+CXXFLAGS_powerpc64=	-mpower8-vector
 
 USES=		cmake compiler:c++17-lang
 USE_GITHUB=	yes
diff --git a/devel/simdjson/files/patch-include_simdjson_ppc64_numberparsing.h b/devel/simdjson/files/patch-include_simdjson_ppc64_numberparsing.h
new file mode 100644
index 000000000000..225292a389e9
--- /dev/null
+++ b/devel/simdjson/files/patch-include_simdjson_ppc64_numberparsing.h
@@ -0,0 +1,20 @@
+--- include/simdjson/ppc64/numberparsing.h.orig	2021-06-13 11:45:59 UTC
++++ include/simdjson/ppc64/numberparsing.h
+@@ -1,7 +1,7 @@
+ #ifndef SIMDJSON_PPC64_NUMBERPARSING_H
+ #define SIMDJSON_PPC64_NUMBERPARSING_H
+ 
+-#include <byteswap.h>
++#include <sys/endian.h>
+ 
+ namespace simdjson {
+ namespace SIMDJSON_IMPLEMENTATION {
+@@ -14,7 +14,7 @@ parse_eight_digits_unrolled(const uint8_t *chars) {
+   uint64_t val;
+   std::memcpy(&val, chars, sizeof(uint64_t));
+ #ifdef __BIG_ENDIAN__
+-  val = bswap_64(val);
++  val = bswap64(val);
+ #endif
+   val = (val & 0x0F0F0F0F0F0F0F0F) * 2561 >> 8;
+   val = (val & 0x00FF00FF00FF00FF) * 6553601 >> 16;


More information about the dev-commits-ports-main mailing list