git: ddc812686212 - main - biology/kallisto: Clean up build

From: Jason W. Bacon <jwb_at_FreeBSD.org>
Date: Mon, 24 Jul 2023 15:46:19 UTC
The branch main has been updated by jwb:

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

commit ddc812686212150df9dd26893ec936b26102aff2
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2023-07-24 15:44:58 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2023-07-24 15:44:58 +0000

    biology/kallisto: Clean up build
    
    Silence warnings due to detected compiler standards
    Enable BAM support in cmake
    Patch out remaining aggressive optimizations
---
 biology/kallisto/Makefile                          |  8 ++++--
 biology/kallisto/files/patch-CMakeLists.txt        | 27 +++++++++++++++++-
 .../files/patch-ext_bifrost_CMakeLists.txt         | 33 ++++++++++++++++++++--
 biology/kallisto/files/patch-src_CMakeLists.txt    | 12 ++++----
 4 files changed, 69 insertions(+), 11 deletions(-)

diff --git a/biology/kallisto/Makefile b/biology/kallisto/Makefile
index ea7cb1a53596..4ae2b8bd94ec 100644
--- a/biology/kallisto/Makefile
+++ b/biology/kallisto/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=		kallisto
 DISTVERSIONPREFIX=	v
 DISTVERSION=		0.50.0
-PORTREVISION=		1
+PORTREVISION=		2
 PORTEPOCH=		1
 CATEGORIES=		biology
 
@@ -12,8 +12,8 @@ WWW=		https://pachterlab.github.io/kallisto/about.html
 LICENSE=	BSD2CLAUSE
 LICENSE_FILE=	${WRKSRC}/license.txt
 
-# Requires a 64-bit processor
 ONLY_FOR_ARCHS=	aarch64 amd64 powerpc64 powerpc64le riscv64
+ONLY_FOR_ARCHS_REASON=	Requires a 64-bit processor
 
 LIB_DEPENDS=	libhdf5.so:science/hdf5 \
 		libsz.so:science/libaec \
@@ -32,7 +32,9 @@ EXAMPLES_PLIST_FILES=	bin/kallisto-test
 # hdf5 is being phased out and is no longer built in by default, but is still
 # required for Sleuth (requires kallisto bootstrap estimates) and other
 # downstream tools.  Remove this after Sleuth et al catch up.
-CMAKE_ARGS+=		-DUSE_HDF5:BOOL=ON
+CMAKE_ARGS+=		-DUSE_HDF5:BOOL=ON -DUSE_BAM:BOOL=ON
+# WIP: Remove before committing
+CMAKE_ARGS+=		-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
 MAKE_JOBS_UNSAFE=	yes
 LDFLAGS+=		-lhts -lz
 
diff --git a/biology/kallisto/files/patch-CMakeLists.txt b/biology/kallisto/files/patch-CMakeLists.txt
index 7c6d4c95b51e..0eff9653f86c 100644
--- a/biology/kallisto/files/patch-CMakeLists.txt
+++ b/biology/kallisto/files/patch-CMakeLists.txt
@@ -1,6 +1,31 @@
 --- CMakeLists.txt.orig	2023-06-27 10:45:00 UTC
 +++ CMakeLists.txt
-@@ -56,42 +56,16 @@ ENDIF(LINK MATCHES static)
+@@ -33,10 +33,11 @@ if(${CMAKE_VERSION} VERSION_LESS 3.1)
+     # remove this block once CMake >=3.1 has fixated in the ecosystem
+     add_compile_options(-std=c++11)
+ else()
++    # Use c++11 to silence warnings
+     include(CheckCXXCompilerFlag)
+-    check_cxx_compiler_flag(-std=c++17 COMPILER_SUPPORTS_CXX17)
++    check_cxx_compiler_flag(-std=c++11 COMPILER_SUPPORTS_CXX17)
+     if(COMPILER_SUPPORTS_CXX17)
+-    set(CMAKE_CXX_STANDARD 17)
++    set(CMAKE_CXX_STANDARD 11)
+     else()
+     set(CMAKE_CXX_STANDARD 11)
+     endif()
+@@ -44,9 +45,7 @@ else()
+     set(CMAKE_CXX_EXTENSIONS OFF)
+ endif()
+ 
+-#add_compile_options(-Wall -Wno-unused-function)
+-add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
+-set(PROJECT_BIFROST_CMAKE_CXX_FLAGS "-Wno-subobject-linkage -Wno-return-type") # Suppress bifrost warning
++set(PROJECT_BIFROST_CMAKE_CXX_FLAGS "-Wno-return-type") # Suppress bifrost warning
+ 
+ if(LINK MATCHES static)
+     message("static build")
+@@ -56,42 +55,16 @@ ENDIF(LINK MATCHES static)
  
  
  include(ExternalProject)
diff --git a/biology/kallisto/files/patch-ext_bifrost_CMakeLists.txt b/biology/kallisto/files/patch-ext_bifrost_CMakeLists.txt
index c4c22a5e0666..d25cf028cfdd 100644
--- a/biology/kallisto/files/patch-ext_bifrost_CMakeLists.txt
+++ b/biology/kallisto/files/patch-ext_bifrost_CMakeLists.txt
@@ -1,6 +1,26 @@
---- ext/bifrost/CMakeLists.txt.orig	2023-07-14 14:27:24 UTC
+--- ext/bifrost/CMakeLists.txt.orig	2023-06-27 10:45:00 UTC
 +++ ext/bifrost/CMakeLists.txt
-@@ -30,8 +30,6 @@ if(COMPILATION_ARCH MATCHES "OFF")
+@@ -7,18 +7,12 @@ find_package(Threads REQUIRED)
+ # To enable a larger default k-mer size, replace MAX_KMER_SIZE with a larger multiple of 32: actual maximum k-mer size will be MAX_KMER_SIZE-1.
+ SET(MAX_KMER_SIZE "32" CACHE STRING "MAX_KMER_SIZE")
+ SET(MAX_GMER_SIZE "${MAX_KMER_SIZE}" CACHE STRING "MAX_GMER_SIZE")
+-# Enable architecture optimizations
+-SET(COMPILATION_ARCH "native" CACHE STRING "COMPILATION_ARCH")
+-# Enable AVX2 instructions
+-SET(ENABLE_AVX2 "ON" CACHE STRING "ENABLE_AVX2")
++SET(CMAKE_VERBOSE_MAKEFILE "ON")
+ 
+ # Set some default compile flags
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ 
+-set_property(SOURCE BlockedBloomFilter.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -funroll-loops")
+-
+-
+ #check if we are on arm64 and apple, if so, disable AVX2
+ if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
+ 	message("Disabling AVX2 instructions on arm64")
+@@ -30,8 +24,6 @@ if(COMPILATION_ARCH MATCHES "OFF")
  	message("Disabling native architecture compilation (including AVX2)")
  else(COMPILATION_ARCH MATCHES "OFF")
  	message("Compilation architecture: ${COMPILATION_ARCH}")
@@ -9,3 +29,12 @@
  endif(COMPILATION_ARCH MATCHES "OFF")
  
  if(ENABLE_AVX2 MATCHES "OFF")
+@@ -56,7 +48,7 @@ else(CMAKE_BUILD_TYPE MATCHES Debug)
+ 		set(CMAKE_EXE_LINKER_FLAGS "-pg")
+ 	else(CMAKE_BUILD_TYPE MATCHES Profile)
+ 		message("Build type: Release")
+-		add_compile_options(-O3)
++		add_compile_options(-O2)
+ 	endif(CMAKE_BUILD_TYPE MATCHES Profile) 
+ endif(CMAKE_BUILD_TYPE MATCHES Debug)
+ 
diff --git a/biology/kallisto/files/patch-src_CMakeLists.txt b/biology/kallisto/files/patch-src_CMakeLists.txt
index c7927b9e1478..87cd4b49b02d 100644
--- a/biology/kallisto/files/patch-src_CMakeLists.txt
+++ b/biology/kallisto/files/patch-src_CMakeLists.txt
@@ -1,6 +1,6 @@
---- src/CMakeLists.txt.orig	2023-07-06 14:07:38 UTC
+--- src/CMakeLists.txt.orig	2023-06-27 10:45:00 UTC
 +++ src/CMakeLists.txt
-@@ -3,10 +3,6 @@ file(GLOB headers *.h *.hpp)
+@@ -3,12 +3,6 @@ file(GLOB headers *.h *.hpp)
  
  list(REMOVE_ITEM sources main.cpp)
  
@@ -8,10 +8,12 @@
 -include_directories(../ext/htslib)
 -endif(USE_BAM)
 -
- add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
- 
+-add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
+-
  add_library(kallisto_core ${sources} ${headers})
-@@ -17,7 +13,7 @@ add_executable(kallisto main.cpp)
+ target_include_directories(kallisto_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+ 
+@@ -17,7 +11,7 @@ add_executable(kallisto main.cpp)
  find_package( Threads REQUIRED )
  ExternalProject_Get_Property(bifrost install_dir)
  if (USE_BAM)