git: 2988f607eda5 - main - textproc/randlm: fix build on powerpc*

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Mon, 21 Feb 2022 11:32:41 UTC
The branch main has been updated by pkubaj:

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

commit 2988f607eda5bb18408318bb5a5e3a2d5917ea31
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-02-21 11:30:36 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-02-21 11:30:36 +0000

    textproc/randlm: fix build on powerpc*
    
    rdtsc() is available only on amd64 / i386.
---
 textproc/randlm/Makefile                    |  1 -
 textproc/randlm/files/patch-src-LDHT-Util.h | 22 ++++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/textproc/randlm/Makefile b/textproc/randlm/Makefile
index 08a7c11132fd..31849bcfbbbe 100644
--- a/textproc/randlm/Makefile
+++ b/textproc/randlm/Makefile
@@ -14,7 +14,6 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 BROKEN_aarch64=		fails to compile: invalid output constraint =a in assembler
 BROKEN_armv6=		fails to compile: invalid output constraint =a in assembler
-BROKEN_powerpc64=	fails to compile: 'itr' does not name a type
 BROKEN_riscv64=		fails to compile: invalid output constraint =a in assembler
 
 BUILD_DEPENDS=	${LOCALBASE}/include/google/sparse_hash_map:devel/sparsehash
diff --git a/textproc/randlm/files/patch-src-LDHT-Util.h b/textproc/randlm/files/patch-src-LDHT-Util.h
index 4d03aae6710f..c3eb320265ef 100644
--- a/textproc/randlm/files/patch-src-LDHT-Util.h
+++ b/textproc/randlm/files/patch-src-LDHT-Util.h
@@ -1,5 +1,5 @@
---- src/LDHT/Util.h.orig	2012-03-30 14:53:05.000000000 +0400
-+++ src/LDHT/Util.h	2014-08-30 18:08:50.000000000 +0400
+--- src/LDHT/Util.h.orig	2012-03-30 10:53:05 UTC
++++ src/LDHT/Util.h
 @@ -10,6 +10,10 @@
  #include <cstdlib>
  #include <cstring>
@@ -11,3 +11,21 @@
  
  #define V(expr) std::cerr << __FILE__ << ":" \
                            << __LINE__ << " " \
+@@ -43,6 +47,9 @@ class Util { (public)
+     static uint64_t hash(uint64_t a, uint64_t b, uint64_t P, uint8_t* e);
+     static uint64_t hash(uint64_t a, uint64_t b, uint64_t P, uint64_t e);
+     static inline uint64_t rdtsc() {
++#if defined(__powerpc__)
++        return __builtin_readcyclecounter();
++#else
+         uint32_t lo, hi;
+         __asm__ __volatile__(
+                 "xorl %%eax,%%eax\n"
+@@ -52,6 +59,7 @@ class Util { (public)
+                 :
+                 : "%ebx", "%ecx");
+         return static_cast<uint64_t>(hi) << 32 | lo;
++#endif
+     };
+ };
+