git: 6863162eb9e7 - main - biology/hisat2: Add support for powerpc64* and aarch64

From: Jason W. Bacon <jwb_at_FreeBSD.org>
Date: Sun, 28 Nov 2021 22:56:48 UTC
The branch main has been updated by jwb:

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

commit 6863162eb9e7e3c3acdf4365f3dd7d5ea0279234
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2021-11-28 22:52:09 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2021-11-28 22:52:09 +0000

    biology/hisat2: Add support for powerpc64* and aarch64
    
    Minor patches to utilize simde to emulate SSE (from Debian package)
    Add -fsigned-char since clang defaults to unsigned on aarch64
    Remove -DPOPCNT_CAPABILITY (not truly safe even on amd64)
---
 biology/hisat2/Makefile                         | 10 ++++++----
 biology/hisat2/files/patch-Makefile             |  9 +++++++++
 biology/hisat2/files/patch-aligner__sw.h        | 17 +++++++++++++++++
 biology/hisat2/files/patch-processor__support.h | 21 +++++++++++++++++++++
 biology/hisat2/files/patch-sse__util.h          | 17 +++++++++++++++++
 5 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/biology/hisat2/Makefile b/biology/hisat2/Makefile
index 33d56578fcf8..f30120ce4824 100644
--- a/biology/hisat2/Makefile
+++ b/biology/hisat2/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=		hisat2
 DISTVERSIONPREFIX=	v
 DISTVERSION=		2.2.1
-PORTREVISION=		1
+PORTREVISION=		2
 CATEGORIES=		biology perl5 python
 
 MAINTAINER=	jwb@FreeBSD.org
@@ -10,10 +10,12 @@ COMMENT=	Alignment program for mapping next-generation sequencing reads
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=		amd64
+ONLY_FOR_ARCHS=		aarch64 amd64 powerpc64 powerpc64le
 ONLY_FOR_ARCHS_REASON=	64-bit code, some assembly language
 
-USES=		gmake perl5 python shebangfix
+BUILD_DEPENDS=	simde>0:devel/simde
+
+USES=		gmake localbase perl5 python shebangfix
 USE_GITHUB=	yes
 
 SHEBANG_FILES=	hisat2 hisat2-build hisat2-inspect \
@@ -22,6 +24,6 @@ SHEBANG_FILES=	hisat2 hisat2-build hisat2-inspect \
 		scripts/*.pl docs_jhu/*.pl
 GH_ACCOUNT=	DaehwanKimLab
 
-CFLAGS+=	-Wno-deprecated-declarations -Wno-char-subscripts
+CFLAGS+=	-Wno-deprecated-declarations -Wno-char-subscripts -fsigned-char
 
 .include <bsd.port.mk>
diff --git a/biology/hisat2/files/patch-Makefile b/biology/hisat2/files/patch-Makefile
index 856bf8d629b6..b3027907ae07 100644
--- a/biology/hisat2/files/patch-Makefile
+++ b/biology/hisat2/files/patch-Makefile
@@ -15,6 +15,15 @@
  HEADERS = $(wildcard *.h)
  BOWTIE_MM = 1
  BOWTIE_SHARED_MEM = 0
+@@ -55,7 +57,7 @@ ifneq (,$(findstring Darwin,$(shell uname)))
+ 	MACOS = 1
+ endif
+ 
+-EXTRA_FLAGS += -DPOPCNT_CAPABILITY -std=c++11
++EXTRA_FLAGS += -std=c++11
+ INC += -I. -I third_party 
+ 
+ MM_DEF = 
 @@ -152,31 +154,9 @@ HISAT2_REPEAT_CPPS_MAIN = $(REPEAT_CPPS) $(BUILD_CPPS)
  SEARCH_FRAGMENTS = $(wildcard search_*_phase*.c)
  VERSION = $(shell cat VERSION)
diff --git a/biology/hisat2/files/patch-aligner__sw.h b/biology/hisat2/files/patch-aligner__sw.h
new file mode 100644
index 000000000000..24a24028ee6c
--- /dev/null
+++ b/biology/hisat2/files/patch-aligner__sw.h
@@ -0,0 +1,17 @@
+--- aligner_sw.h.orig	2020-07-24 20:07:54 UTC
++++ aligner_sw.h
+@@ -66,11 +66,13 @@
+ 
+ #define INLINE_CUPS
+ 
++#define	SIMDE_ENABLE_NATIVE_ALIASES
++
++#include <simde/x86/sse2.h>
+ #include <stdint.h>
+ #include <iostream>
+ #include <limits>
+ #include "threading.h"
+-#include <emmintrin.h>
+ #include "aligner_sw_common.h"
+ #include "aligner_sw_nuc.h"
+ #include "ds.h"
diff --git a/biology/hisat2/files/patch-processor__support.h b/biology/hisat2/files/patch-processor__support.h
new file mode 100644
index 000000000000..e85c19b63f84
--- /dev/null
+++ b/biology/hisat2/files/patch-processor__support.h
@@ -0,0 +1,21 @@
+--- processor_support.h.orig	2020-07-24 20:07:54 UTC
++++ processor_support.h
+@@ -12,7 +12,7 @@
+ 
+ #if defined(__INTEL_COMPILER)
+ #   define USING_INTEL_COMPILER
+-#elif defined(__GNUC__)
++#elif defined(__GNUC__) && (defined(__amd64__) || defined(__i386__))
+ #   define USING_GCC_COMPILER
+ #   include <cpuid.h>
+ #elif defined(_MSC_VER)
+@@ -52,8 +52,7 @@ class ProcessorSupport { (public)
+ #elif defined(USING_GCC_COMPILER)
+         __get_cpuid(0x1, &regs.EAX, &regs.EBX, &regs.ECX, &regs.EDX);
+ #else
+-        std::cerr << "ERROR: please define __cpuid() for this build.\n"; 
+-        assert(0);
++	return false;
+ #endif
+         if( !( (regs.ECX & BIT(20)) && (regs.ECX & BIT(23)) ) ) return false;
+     }
diff --git a/biology/hisat2/files/patch-sse__util.h b/biology/hisat2/files/patch-sse__util.h
new file mode 100644
index 000000000000..0241493cad77
--- /dev/null
+++ b/biology/hisat2/files/patch-sse__util.h
@@ -0,0 +1,17 @@
+--- sse_util.h.orig	2021-11-27 23:25:39 UTC
++++ sse_util.h
+@@ -20,11 +20,13 @@
+ #ifndef SSE_UTIL_H_
+ #define SSE_UTIL_H_
+ 
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include <simde/x86/sse2.h>
++
+ #include "assert_helpers.h"
+ #include "ds.h"
+ #include "limit.h"
+ #include <iostream>
+-#include <emmintrin.h>
+ 
+ class EList_m128i {
+ public: