git: 29bea60c5980 - main - biology/btllib: New port: Bioinformatics Technology Lab common code library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 21 Jul 2023 22:24:21 UTC
The branch main has been updated by yuri:

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

commit 29bea60c598052bbf71415e494a179adbe143a8e
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-07-21 22:22:58 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-07-21 22:24:04 +0000

    biology/btllib: New port: Bioinformatics Technology Lab common code library
---
 biology/Makefile                                   |  1 +
 biology/btllib/Makefile                            | 30 ++++++++++++
 biology/btllib/distinfo                            |  7 +++
 biology/btllib/files/patch-meson.build             | 54 ++++++++++++++++++++++
 biology/btllib/files/patch-src_btllib_status.cpp   | 18 ++++++++
 .../files/patch-subprojects_cpptoml_CMakeLists.txt | 13 ++++++
 biology/btllib/pkg-descr                           |  1 +
 biology/btllib/pkg-plist                           | 32 +++++++++++++
 8 files changed, 156 insertions(+)

diff --git a/biology/Makefile b/biology/Makefile
index 4f426e0a00ca..4f885c16edba 100644
--- a/biology/Makefile
+++ b/biology/Makefile
@@ -28,6 +28,7 @@
     SUBDIR += bolt-lmm
     SUBDIR += bowtie
     SUBDIR += bowtie2
+    SUBDIR += btllib
     SUBDIR += bwa
     SUBDIR += canu
     SUBDIR += cd-hit
diff --git a/biology/btllib/Makefile b/biology/btllib/Makefile
new file mode 100644
index 000000000000..14d9616c5a00
--- /dev/null
+++ b/biology/btllib/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	btllib
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.6.2
+CATEGORIES=	biology devel
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Bioinformatics Technology Lab common code library
+WWW=		https://github.com/bcgsc/btllib
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	bash:shells/bash \
+		samtools:biology/samtools \
+		cmake:devel/cmake-core
+LIB_DEPENDS=	libsdsl.so:devel/sdsl-lite
+RUN_DEPENDS=	samtools:biology/samtools
+
+USES=		meson pkgconfig python:build shebangfix
+
+SHEBANG_FILES=	scripts/*
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	bcgsc
+GH_TUPLE=	p-ranav:argparse:15d745f:argparse/subprojects/argparse \
+		skystrife:cpptoml:fededad:cpptoml/subprojects/cpptoml
+
+BINARY_ALIAS=	python3=${PYTHON_CMD} # python3-config=${PYTHON_CMD}-config # installs python binding into a wrong location, see https://github.com/bcgsc/btllib/issues/111
+
+.include <bsd.port.mk>
diff --git a/biology/btllib/distinfo b/biology/btllib/distinfo
new file mode 100644
index 000000000000..4e0da820e3fc
--- /dev/null
+++ b/biology/btllib/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1689975725
+SHA256 (bcgsc-btllib-v1.6.2_GH0.tar.gz) = cba796cb83791e8524f5108459892a1131748cda55189c9acea21d4bdb80e7a0
+SIZE (bcgsc-btllib-v1.6.2_GH0.tar.gz) = 848942
+SHA256 (p-ranav-argparse-15d745f_GH0.tar.gz) = f033d4eb4a430b4ae4bf3c2a40e087709bf77462c1f9968ae07828437219a370
+SIZE (p-ranav-argparse-15d745f_GH0.tar.gz) = 105608
+SHA256 (skystrife-cpptoml-fededad_GH0.tar.gz) = dd2d129b67f537ae7d6f8d8d084c8c0d772d0f5b4b3118c1892e67ff536e335e
+SIZE (skystrife-cpptoml-fededad_GH0.tar.gz) = 47398
diff --git a/biology/btllib/files/patch-meson.build b/biology/btllib/files/patch-meson.build
new file mode 100644
index 000000000000..878516f5d78b
--- /dev/null
+++ b/biology/btllib/files/patch-meson.build
@@ -0,0 +1,54 @@
+--- meson.build.orig	2023-07-06 15:52:18 UTC
++++ meson.build
+@@ -1,7 +1,7 @@
+ project('btllib', 'cpp',
+         version : '1.6.2',
+         license : 'GPL3',
+-        default_options : [ 'cpp_std=c++17', 'warning_level=3', 'werror=true', 'b_coverage=true' ],
++        default_options : [ 'cpp_std=c++17', 'warning_level=3', 'b_coverage=true' ],
+         meson_version : '>= 0.60.0')
+ 
+ # Configuration
+@@ -48,22 +48,28 @@ threads_dep = dependency('threads')
+ openmp_dep = dependency('openmp', required : false)
+ 
+ cmake_options = cmake.subproject_options()
+-cmake_options.set_override_option('werror', 'false')
++#cmake_options.set_override_option('werror', 'false')
+ cmake_options.set_install(false)
+ 
+ cpptoml_subproject = cmake.subproject('cpptoml', options : cmake_options)
+ cpptomp_dep = cpptoml_subproject.dependency('cpptoml')
+ 
+-run_command(meson.project_source_root() + '/scripts/prepare-sdsl')
++#run_command(meson.project_source_root() + '/scripts/prepare-sdsl')
+ 
+-sdsl_subproject = cmake.subproject('sdsl-lite', options : cmake_options)
+-sdsl_dep = sdsl_subproject.dependency('sdsl', include_type: 'system')
++#sdsl_subproject = cmake.subproject('sdsl-lite', options : cmake_options)
+ 
++#sdsl_dep = sdsl_subproject.dependency('sdsl', include_type: 'system')
++
++pkg = import('pkgconfig')
++sdsl_dep = dependency('sdsl-lite')
++#lib = library('foo', dependencies : [bar])
++#pkg.generate(lib)
++
+ deps = [ threads_dep, openmp_dep, cpptomp_dep, sdsl_dep ]
+ 
+ # These are unfortunate hacks. Currently, neither cpptoml nor sdsl-lite install their headers (even when set_install(true) is called), and so we need to do it manually
+ meson.add_install_script('scripts/install-cpptoml')
+-meson.add_install_script('scripts/install-sdsl-lite')
++#meson.add_install_script('scripts/install-sdsl-lite')
+ 
+ argparse_subproject = cmake.subproject('argparse', options : cmake_options)
+ argparse_dep = argparse_subproject.dependency('argparse')
+@@ -126,7 +132,7 @@ run_target('test-wrappers', command: join_paths(rootpa
+ btllib_include = [ include_directories('include'), include_directories('.') ]
+ btllib_sources = run_command('scripts/get-files', 'src').stdout().strip().split()
+ 
+-btllib_lib = static_library('btllib',
++btllib_lib = shared_library('btllib',
+                            btllib_sources,
+                            include_directories : btllib_include,
+                            dependencies : deps,
diff --git a/biology/btllib/files/patch-src_btllib_status.cpp b/biology/btllib/files/patch-src_btllib_status.cpp
new file mode 100644
index 000000000000..930452d89fad
--- /dev/null
+++ b/biology/btllib/files/patch-src_btllib_status.cpp
@@ -0,0 +1,18 @@
+--- src/btllib/status.cpp.orig	2023-07-21 18:23:40 UTC
++++ src/btllib/status.cpp
+@@ -84,7 +84,7 @@ get_strerror()
+   char buf[buflen];
+ // POSIX and GNU implementation of strerror_r differ, even in function signature
+ // and so we need to check which one is used
+-#if __APPLE__ ||                                                               \
++#if __APPLE__ || __FreeBSD__  ||                                         \
+   ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
+   strerror_r(errno, buf, buflen);
+   return buf;
+@@ -111,4 +111,4 @@ check_file_accessibility(const std::string& filepath)
+   btllib::check_error(ret != 0, get_strerror() + ": " + filepath);
+ }
+ 
+-} // namespace btllib
+\ No newline at end of file
++} // namespace btllib
diff --git a/biology/btllib/files/patch-subprojects_cpptoml_CMakeLists.txt b/biology/btllib/files/patch-subprojects_cpptoml_CMakeLists.txt
new file mode 100644
index 000000000000..d660dd9b08b0
--- /dev/null
+++ b/biology/btllib/files/patch-subprojects_cpptoml_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- subprojects/cpptoml/CMakeLists.txt.orig	2023-05-06 14:38:35 UTC
++++ subprojects/cpptoml/CMakeLists.txt
+@@ -11,8 +11,8 @@ include(CMakePushCheckState)
+ 
+ cmake_push_check_state()
+ 
+-option(ENABLE_LIBCXX "Use libc++ for the C++ standard library" ON)
+-option(CPPTOML_BUILD_EXAMPLES "Build examples" ON)
++option(ENABLE_LIBCXX "Use libc++ for the C++ standard library" OFF)
++option(CPPTOML_BUILD_EXAMPLES "Build examples" OFF)
+ 
+ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+ 
diff --git a/biology/btllib/pkg-descr b/biology/btllib/pkg-descr
new file mode 100644
index 000000000000..c802b1fe9d44
--- /dev/null
+++ b/biology/btllib/pkg-descr
@@ -0,0 +1 @@
+Bioinformatics Technology Lab's common code library in C++.
diff --git a/biology/btllib/pkg-plist b/biology/btllib/pkg-plist
new file mode 100644
index 000000000000..ccb8f845f30f
--- /dev/null
+++ b/biology/btllib/pkg-plist
@@ -0,0 +1,32 @@
+bin/indexlr
+bin/mi_bf_generate
+bin/randseq
+include/btllib/aahash.hpp
+include/btllib/aahash_consts.hpp
+include/btllib/bloom_filter.hpp
+include/btllib/counting_bloom_filter-inl.hpp
+include/btllib/counting_bloom_filter.hpp
+include/btllib/cpptoml.h
+include/btllib/cstring.hpp
+include/btllib/data_stream.hpp
+include/btllib/graph.hpp
+include/btllib/indexlr.hpp
+include/btllib/mi_bloom_filter-inl.hpp
+include/btllib/mi_bloom_filter.hpp
+include/btllib/nthash.hpp
+include/btllib/nthash_consts.hpp
+include/btllib/nthash_lowlevel.hpp
+include/btllib/order_queue.hpp
+include/btllib/process_pipeline.hpp
+include/btllib/randseq.hpp
+include/btllib/seq.hpp
+include/btllib/seq_reader.hpp
+include/btllib/seq_reader_fasta_module.hpp
+include/btllib/seq_reader_fastq_module.hpp
+include/btllib/seq_reader_multiline_fasta_module.hpp
+include/btllib/seq_reader_multiline_fastq_module.hpp
+include/btllib/seq_reader_sam_module.hpp
+include/btllib/seq_writer.hpp
+include/btllib/status.hpp
+include/btllib/util.hpp
+lib/libbtllib.so