git: 869afa4fe605 - main - biology/star: Update to 2.7.9a

From: Jason W. Bacon <jwb_at_FreeBSD.org>
Date: Fri, 26 Nov 2021 21:58:59 UTC
The branch main has been updated by jwb:

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

commit 869afa4fe605c72d26da47f2e6e838e06166c533
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2021-11-26 21:57:02 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2021-11-26 21:57:02 +0000

    biology/star: Update to 2.7.9a
    
    Also unbundle htslib
    
    Changes:        https://github.com/alexdobin/STAR/releases/tag/2.7.9a
---
 biology/star/Makefile                            | 24 ++++++--
 biology/star/distinfo                            |  6 +-
 biology/star/files/patch-Makefile                | 72 ++++++++++++++++++------
 biology/star/files/patch-SharedMemory.cpp        | 11 ----
 biology/star/files/patch-SpliceGraph.cpp         | 10 ++++
 biology/star/files/patch-SuffixArrayFuns.cpp     | 50 ++++++++++++++++
 biology/star/files/patch-bamSortByCoordinate.cpp | 11 ++++
 biology/star/files/patch-opal_opal.cpp           | 13 +++++
 8 files changed, 162 insertions(+), 35 deletions(-)

diff --git a/biology/star/Makefile b/biology/star/Makefile
index 67da9de6c511..66d4ac8a4dc0 100644
--- a/biology/star/Makefile
+++ b/biology/star/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	STAR
-DISTVERSION=	2.7.3a
-PORTREVISION=	1
+DISTVERSION=	2.7.9a
 CATEGORIES=	biology
 PKGNAMEPREFIX=	rna-
 
@@ -10,17 +9,34 @@ COMMENT=	Spliced Transcripts Alignment to a Reference
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKDIR}/STAR-${DISTVERSION}/LICENSE
 
-# 64-bit only, needs 16+ GiB RAM for typical eukaryotic genome
 NOT_FOR_ARCHS=	i386 powerpc
+NOT_FOR_ARCHS_REASON=Needs 16+ GiB RAM for typical eukaryotic genome
 
-USES=		compiler:c++11-lang gmake
+LIB_DEPENDS=	libhts.so:biology/htslib
+
+USES=		compiler:c++11-lang gmake localbase:ldflags
 USE_GITHUB=	yes
 GH_ACCOUNT=	alexdobin
 
 WRKSRC_SUBDIR=	source
+MAKE_FLAGS=	HTSLIB=''
 
 PLIST_FILES=	bin/STAR
 
+post-patch:
+	${RM} -rf ${WRKSRC}/htslib
+	${REINPLACE_CMD} \
+		-e 's|"htslib/htslib/sam.h"|<htslib/sam.h>|g' \
+		-e 's|"htslib/htslib/kstring.h"|<htslib/kstring.h>|g' \
+		-e 's|"htslib/htslib/bgzf.h"|<htslib/bgzf.h>|g' \
+		${WRKSRC}/BAMfunctions.cpp \
+		${WRKSRC}/IncludeDefine.h \
+		${WRKSRC}/STAR.cpp \
+		${WRKSRC}/bamRemoveDuplicates.cpp \
+		${WRKSRC}/bam_cat.c \
+		${WRKSRC}/bam_cat.h \
+		${WRKSRC}/signalFromBAM.h
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/STAR ${STAGEDIR}${PREFIX}/bin
 
diff --git a/biology/star/distinfo b/biology/star/distinfo
index 9527dfa82397..de8a1837007f 100644
--- a/biology/star/distinfo
+++ b/biology/star/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1586376571
-SHA256 (alexdobin-STAR-2.7.3a_GH0.tar.gz) = de204175351dc5f5ecc40cf458f224617654bdb8e00df55f0bb03a5727bf26f9
-SIZE (alexdobin-STAR-2.7.3a_GH0.tar.gz) = 8550987
+TIMESTAMP = 1637942811
+SHA256 (alexdobin-STAR-2.7.9a_GH0.tar.gz) = ff52c9d6daaa9fb7261efa3aa49ef6ce5262aa089b0762a3cbc751e81321050e
+SIZE (alexdobin-STAR-2.7.9a_GH0.tar.gz) = 10669338
diff --git a/biology/star/files/patch-Makefile b/biology/star/files/patch-Makefile
index 99f3c4aa1237..e455160380a3 100644
--- a/biology/star/files/patch-Makefile
+++ b/biology/star/files/patch-Makefile
@@ -1,23 +1,61 @@
---- Makefile.orig	2019-10-08 19:10:51 UTC
+--- Makefile.orig	2021-05-05 12:01:50 UTC
 +++ Makefile
-@@ -20,11 +20,16 @@ LDFLAGS_gdb := $(LDFLAGS_shared)
+@@ -11,6 +11,10 @@ CXXFLAGSextra ?=
+ # user may define the compiler
+ CXX ?= g++
  
- COMPTIMEPLACE := -D'COMPILATION_TIME_PLACE="$(shell echo `date` $(HOSTNAME):`pwd`)"'
- 
--CXXFLAGS_common := -pipe -std=c++11 -Wall -Wextra -fopenmp $(COMPTIMEPLACE)
--CXXFLAGS_main := -O3 $(CXXFLAGS_common)
--CXXFLAGS_gdb :=  -O0 -g $(CXXFLAGS_common)
-+# Defaults, overridden by make arguments or environment
-+CXXFLAGS ?= -pipe -O3 -Wall -Wextra
-+CFLAGS ?= -pipe -O3 -Wall -Wextra
- 
--CFLAGS := -O3 -pipe -Wall -Wextra $(CFLAGS)
-+# Unconditionally set essential flags
-+CXXFLAGS_common := -std=c++11 -fopenmp $(COMPTIMEPLACE)
-+CXXFLAGS_main += $(CXXFLAGS_common)
++# user may set to '' and sed "htslib/htslib/*.h" to <htslib/*.h>
++# if they don't want the bundled htslib
++HTSLIB ?= htslib
 +
-+# -O or -O2 should work fine with gdb as well
-+CXXFLAGS_gdb :=  -O0 -g $(CXXFLAGS_common)
+ # pre-defined flags
+ LDFLAGS_shared := -pthread -Lhtslib -Bstatic -lhts -Bdynamic -lz
+ LDFLAGS_static := -static -static-libgcc -pthread -Lhtslib -lhts -lz
+@@ -18,7 +22,8 @@ LDFLAGS_Mac :=-pthread -lz htslib/libhts.a
+ LDFLAGS_Mac_static :=-pthread -lz -static-libgcc htslib/libhts.a
+ LDFLAGS_gdb := $(LDFLAGS_shared)
+ 
+-DATE_FMT = --iso-8601=seconds
++# --iso-8601 is not portable
++DATE_FMT = -Iseconds
+ ifdef SOURCE_DATE_EPOCH
+     BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
+ else
+@@ -30,13 +35,13 @@ BUILD_PLACE ?= $(HOSTNAME):$(shell pwd)
+ COMPTIMEPLACE := -D'COMPILATION_TIME_PLACE="$(BUILD_DATE) $(BUILD_PLACE)"'
+ 
+ # Defaults, can be overridden by make arguments or environment
+-CXXFLAGS ?= -pipe -Wall -Wextra
++CXXFLAGS ?= -pipe -Wall -Wextra -O3
+ CFLAGS ?= -pipe -Wall -Wextra -O3
+ CXXFLAGS_SIMD ?= -mavx2
  
+ # Unconditionally set essential flags and optimization options
+ CXXFLAGS_common := -std=c++11 -fopenmp $(COMPTIMEPLACE)
+-CXXFLAGS_main := -O3 $(CXXFLAGS_common)
++CXXFLAGS_main := $(CXXFLAGS_common)
+ CXXFLAGS_gdb := -O0 -g3 $(CXXFLAGS_common)
  
  ##########################################################################################################
+@@ -102,7 +107,7 @@ clean:
+ 
+ .PHONY: CLEAN
+ CLEAN: clean
+-	$(MAKE) -C htslib clean
++	$(MAKE) -C $(HTSLIB) clean
+ 
+ 
+ .PHONY: clean_solo
+@@ -119,10 +124,10 @@ ifneq ($(MAKECMDGOALS),CLEAN)
+ ifneq ($(MAKECMDGOALS),clean_solo)
+ ifneq ($(MAKECMDGOALS),STARforMac)
+ ifneq ($(MAKECMDGOALS),STARforMacGDB)
+-Depend.list: $(SOURCES) parametersDefault.xxd htslib
++Depend.list: $(SOURCES) parametersDefault.xxd $(HTSLIB)
+ 	echo $(SOURCES)
+ 	'rm' -f ./Depend.list
+-	$(CXX) $(CXXFLAGS_common) -MM $^ >> Depend.list
++	$(CXX) $(CXXFLAGS) $(CXXFLAGS_common) -MM $^ >> Depend.list
+ include Depend.list
+ endif
+ endif
diff --git a/biology/star/files/patch-SharedMemory.cpp b/biology/star/files/patch-SharedMemory.cpp
deleted file mode 100644
index 54f83b99f369..000000000000
--- a/biology/star/files/patch-SharedMemory.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- SharedMemory.cpp.orig	2019-04-21 19:57:39 UTC
-+++ SharedMemory.cpp
-@@ -11,7 +11,7 @@
- #include <semaphore.h>
- #include <errno.h>
- 
--#ifdef COMPILE_FOR_MAC
-+#if defined(COMPILE_FOR_MAC) || defined(__FreeBSD__)
-   //some Mac's idiosyncrasies: standard SHM libraries are very old and missing some definitions
-   #define SHM_NORESERVE 0
- #endif
diff --git a/biology/star/files/patch-SpliceGraph.cpp b/biology/star/files/patch-SpliceGraph.cpp
new file mode 100644
index 000000000000..d52310db50d4
--- /dev/null
+++ b/biology/star/files/patch-SpliceGraph.cpp
@@ -0,0 +1,10 @@
+--- SpliceGraph.cpp.orig	2021-11-26 18:13:48 UTC
++++ SpliceGraph.cpp
+@@ -1,7 +1,6 @@
+ /*
+  * Created by Fahimeh Mirhaj on 6/10/19.
+ */
+-using namespace std;
+ 
+ #include "SpliceGraph.h"
+ #include "GTF.h"
diff --git a/biology/star/files/patch-SuffixArrayFuns.cpp b/biology/star/files/patch-SuffixArrayFuns.cpp
new file mode 100644
index 000000000000..4d27ac86d4d2
--- /dev/null
+++ b/biology/star/files/patch-SuffixArrayFuns.cpp
@@ -0,0 +1,50 @@
+--- SuffixArrayFuns.cpp.orig	2021-11-26 18:14:36 UTC
++++ SuffixArrayFuns.cpp
+@@ -15,7 +15,7 @@ uint compareSeqToGenome(Genome &mapGen, char** s2, uin
+      * dirR forward or reverse direction search on read sequence
+      */
+ 
+-    register int64 ii;
++    int64 ii;
+ 
+     uint SAstr=mapGen.SA[iSA];
+     bool dirG = (SAstr>>mapGen.GstrandBit) == 0; //forward or reverse strand of the genome
+@@ -231,7 +231,7 @@ uint compareSeqToGenome1(Genome &mapGen, char** s2, ui
+ 
+     //TODO no need for complementary sequence
+ 
+-    register int64 ii;
++    int64 ii;
+ 
+     uint SAstr=mapGen.SA[iSA];
+     bool dirG = (SAstr>>mapGen.GstrandBit) == 0; //forward or reverse strand of the genome
+@@ -356,13 +356,13 @@ uint funCalcSAiFromSA(char* gSeq, PackedArray& gSA, Ge
+     bool dirG = (SAstr>>mapGen.GstrandBit) == 0; //forward or reverse strand of the genome
+     SAstr &= mapGen.GstrandMask;
+     iL4=-1;
+-    register uint saind=0;
++    uint saind=0;
+     if (dirG)
+     {
+-        register uint128 g1=*( (uint128*) (gSeq+SAstr) );
++        uint128 g1=*( (uint128*) (gSeq+SAstr) );
+         for (int ii=0; ii<L; ii++)
+         {
+-            register char g2=(char) g1;
++            char g2=(char) g1;
+             if (g2>3)
+             {
+                 iL4=ii;
+@@ -376,10 +376,10 @@ uint funCalcSAiFromSA(char* gSeq, PackedArray& gSA, Ge
+         return saind;
+     } else
+     {
+-        register uint128 g1=*( (uint128*) (gSeq+mapGen.nGenome-SAstr-16) );
++        uint128 g1=*( (uint128*) (gSeq+mapGen.nGenome-SAstr-16) );
+         for (int ii=0; ii<L; ii++)
+         {
+-            register char g2=(char) (g1>>(8*(15-ii)));
++            char g2=(char) (g1>>(8*(15-ii)));
+             if (g2>3)
+             {
+                 iL4=ii;
diff --git a/biology/star/files/patch-bamSortByCoordinate.cpp b/biology/star/files/patch-bamSortByCoordinate.cpp
new file mode 100644
index 000000000000..5ba13ed77fc9
--- /dev/null
+++ b/biology/star/files/patch-bamSortByCoordinate.cpp
@@ -0,0 +1,11 @@
+--- bamSortByCoordinate.cpp.orig	2021-11-26 16:17:37 UTC
++++ bamSortByCoordinate.cpp
+@@ -64,7 +64,7 @@ void bamSortByCoordinate (Parameters &P, ReadAlignChun
+                             boolWait=false;
+                             totalMem+=newMem;
+                         };
+-                        sleep(0.1);
++                        usleep(10000);
+                     };
+                     BAMbinSortByCoordinate(ibin,binN,binS,P.runThreadN,P.outBAMsortTmpDir, P, genome, solo);
+                     #pragma omp critical
diff --git a/biology/star/files/patch-opal_opal.cpp b/biology/star/files/patch-opal_opal.cpp
new file mode 100644
index 000000000000..dcda064df27a
--- /dev/null
+++ b/biology/star/files/patch-opal_opal.cpp
@@ -0,0 +1,13 @@
+--- opal/opal.cpp.orig	2021-11-26 16:14:46 UTC
++++ opal/opal.cpp
+@@ -5,10 +5,8 @@
+ #include <limits>
+ #include <vector>
+ 
+-extern "C" {
+ #define SIMDE_ENABLE_NATIVE_ALIASES
+ #include <simde_avx2.h> // AVX2 and lower
+-}
+ 
+ #include "opal.h"
+