Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jun 2021 17:58:04 GMT
From:      "Jason W. Bacon" <jwb@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 69656bf0d7d9 - main - biology/sra-tools: NCBI's toolkit for handling data in INSDC Sequence Read Archives
Message-ID:  <202106221758.15MHw4et061199@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jwb:

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

commit 69656bf0d7d99660e536c22472a5eae639695a97
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2021-06-22 17:55:15 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2021-06-22 17:55:15 +0000

    biology/sra-tools: NCBI's toolkit for handling data in INSDC Sequence Read Archives
    
    SRA tools is a toolkit for using data in the INSDC Sequence Read Archives.
    
    SRAs operated by International Nucleotide Sequence Database Collaboration
    houses sequence reads and alignments generated by "next-gen" sequencers.
    
    This port is a bit convoluted due to the fact that the sra-tools build
    requires access to the ncbi-vdb source tree.  Hence, ncbi-vdb is treated
    as a submodule here rather than a separate library port.  We are working
    with upstream with hope for long-term improvements.
---
 biology/Makefile                                   |   1 +
 biology/sra-tools/Makefile                         | 105 +++++++
 biology/sra-tools/distinfo                         |   7 +
 biology/sra-tools/files/Makefile.bsd               |  72 +++++
 biology/sra-tools/files/byteswap.h                 |  40 +++
 biology/sra-tools/files/ld.bsd.clang.sh            |  47 +++
 biology/sra-tools/files/ld.bsd.cmn.sh              | 158 ++++++++++
 biology/sra-tools/files/ld.bsd.dlib.sh             | 308 +++++++++++++++++++
 biology/sra-tools/files/ld.bsd.exe.sh              | 326 +++++++++++++++++++++
 biology/sra-tools/files/ld.bsd.gcc.sh              |  47 +++
 biology/sra-tools/files/ld.bsd.ln.sh               |  98 +++++++
 biology/sra-tools/files/ld.bsd.slib.sh             | 146 +++++++++
 .../sra-tools/files/patch-build_ld.linux.exe.sh    |  11 +
 .../files/patch-ncbi-vdb_build_Makefile.clang      |  30 ++
 .../files/patch-ncbi-vdb_build_Makefile.env        |  25 ++
 .../files/patch-ncbi-vdb_build_Makefile.gcc        |  35 +++
 .../files/patch-ncbi-vdb_build_Makefile.install    |  11 +
 .../files/patch-ncbi-vdb_build_Makefile.shell      |  31 ++
 .../patch-ncbi-vdb_interfaces_os_sun_atomic32.h    |  85 ++++++
 .../files/patch-ncbi-vdb_libs_ext_Makefile         |  12 +
 .../files/patch-ncbi-vdb_libs_kfg_config.c         |  20 ++
 .../files/patch-ncbi-vdb_libs_klib_unix_systime.c  |  11 +
 .../files/patch-ncbi-vdb_libs_kns_unix_syssock.c   |  10 +
 .../files/patch-ncbi-vdb_libs_ncbi-vdb_Makefile    |  20 ++
 .../files/patch-ncbi-vdb_libs_search_Makefile      |  12 +
 .../files/patch-ncbi-vdb_setup_konfigure.perl      | 243 +++++++++++++++
 .../files/patch-ncbi-vdb_setup_os-arch.prl         |  20 ++
 .../files/patch-ncbi-vdb_test_kapp_run-sig-core.sh |  49 ++++
 .../files/patch-ncbi-vdb_test_kfg_kfgtest.cpp      |  11 +
 .../files/patch-ncbi-vdb_test_klib_printf-test.c   |  11 +
 .../files/patch-ncbi-vdb_test_kns_Makefile         |  19 ++
 .../patch-ncbi-vdb_test_vdb_test-dependencies.cpp  |  11 +
 ...s_redirect-rejected-names-cgi-http-to-https.cpp |  11 +
 biology/sra-tools/files/patch-setup_install.perl   |  13 +
 biology/sra-tools/files/patch-setup_konfigure.perl | 121 ++++++++
 .../files/patch-tools_bam-loader_loader-imp.c      |  10 +
 .../sra-tools/files/patch-tools_copycat_Makefile   |  11 +
 .../files/patch-tools_driver-tool_Makefile         |  16 +
 .../files/patch-tools_driver-tool_cmdline.cpp      |  13 +
 .../patch-tools_driver-tool_utf8proc_Makefile      |  11 +
 .../patch-tools_fastq-loader_spot-assembler.c      |  11 +
 .../sra-tools/files/patch-tools_sra-sort_Makefile  |  13 +
 .../files/patch-tools_util_validate-names4.c       |  13 +
 biology/sra-tools/pkg-descr                        |  18 ++
 biology/sra-tools/pkg-plist                        |  57 ++++
 45 files changed, 2350 insertions(+)

diff --git a/biology/Makefile b/biology/Makefile
index ec9728ced8ee..158eb70ede1a 100644
--- a/biology/Makefile
+++ b/biology/Makefile
@@ -175,6 +175,7 @@
     SUBDIR += smithwaterman
     SUBDIR += snpeff
     SUBDIR += spoa
+    SUBDIR += sra-tools
     SUBDIR += stacks
     SUBDIR += star
     SUBDIR += stringtie
diff --git a/biology/sra-tools/Makefile b/biology/sra-tools/Makefile
new file mode 100644
index 000000000000..0b6a54bd67ca
--- /dev/null
+++ b/biology/sra-tools/Makefile
@@ -0,0 +1,105 @@
+PORTNAME=	sra-tools
+DISTVERSION=	2.11.0
+CATEGORIES=	biology
+
+MAINTAINER=	jwb@FreeBSD.org
+COMMENT=	NCBI's toolkit for handling data in INSDC Sequence Read Archives
+
+LICENSE=		PD LGPL21+
+LICENSE_COMB=		multi
+LICENSE_FILE_PD=	${WRKSRC}/LICENSE
+LICENSE_DISTFILES_LGPL21+ =
+
+ONLY_FOR_ARCHS=		amd64
+ONLY_FOR_ARCHS_REASON=	NCBI-VDB requires SSE2 instructions, no 32-bit support
+
+BUILD_DEPENDS=	bash:shells/bash \
+		${LOCALBASE}/lib/libngs-c++.a:biology/ngs-sdk
+LIB_DEPENDS=	libxml2.so:textproc/libxml2 \
+		libhdf5.so:science/hdf5 \
+		libepoll-shim.so:devel/libepoll-shim
+
+USES=		compiler:c11 gmake localbase:ldflags perl5 shebangfix
+USE_PERL5=	build
+USE_GITHUB=	yes
+
+SHEBANG_GLOB=	*.sh *.pl
+GH_ACCOUNT=	ncbi
+GH_TUPLE+=	ncbi:ngs:${DISTVERSION}:ngs/ngs # ported as biology/ngs-sdk
+GH_TUPLE+=	ncbi:ncbi-vdb:${DISTVERSION}:vdb/ncbi-vdb
+
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-ngs-sdk-prefix=${LOCALBASE} \
+		--with-ncbi-vdb-sources=${NCBI_VDB_WRKSRC} \
+		--with-xml2-prefix=${LOCALBASE} \
+		--with-hdf5-prefix=${LOCALBASE} \
+		CC="${CC}" CXX="${CXX}" TOOLS="${CHOSEN_COMPILER_TYPE}" \
+		--with-ncbi-vdb-build=${NCBI_VDB_WRKSRC}/amd64-portbld-freebsd$$(${FREEBSD_RELEASE})
+MAKE_ARGS=	CCNAME=${CC} CXXNAME=${CXX} PKGCFLAGS="${CFLAGS}" \
+		INST_ETCDIR=${STAGEDIR}${PREFIX}/etc
+
+NCBI_VDB_WRKSRC=	${WRKSRC}/ncbi-vdb
+NCBI_VDB_FILESDIR=	${FILESDIR}
+FREEBSD_RELEASE=	uname -r | cut -d - -f 1
+
+CFLAGS+=	-I${WRKSRC}/interfaces/os/sun
+CXXFLAGS+=	-I${WRKSRC}/interfaces/os/sun
+
+BINARY_ALIAS=	gcc=${CC} g++=${CXX}
+
+# for port developers, building with these options may fail
+OPTIONS_DEFINE=		DEBUG OPTIMIZED_CFLAGS TEST
+DEBUG_PREVENTS=		OPTIMIZED_CFLAGS
+DEBUG_CONFIGURE_WITH=	debug
+OPTIMIZED_CFLAGS_MAKE_ARGS_OFF=	OPT=""
+TEST_TEST_TARGET=	test
+TEST_USES=		python
+
+# ncbi-vdb build extras
+VDB_CONFIGURE_ARGS=	\
+		--with-xml2-prefix=${LOCALBASE} \
+		--with-hdf5-prefix=${LOCALBASE} \
+		--prefix=${PREFIX} \
+		--build=amd64-portbld-freebsd$$(${FREEBSD_RELEASE}) \
+		CC="${CC}" CXX="${CXX}" TOOLS="${CHOSEN_COMPILER_TYPE}"
+VDB_MAKE_ARGS+=	-j 1 CCNAME=${CC} CXXNAME=${CXX} PKGCFLAGS="${CFLAGS}"
+MAKE_ENV+=	CPATH="${LOCALBASE}/include/libepoll-shim"
+CFLAGS+=	-I${WRKSRC}/lib
+
+pre-patch:
+	@${CP} ${FILESDIR}/Makefile.bsd ${NCBI_VDB_WRKSRC}/build/
+	@${CP} ${FILESDIR}/ld.bsd.*.sh ${NCBI_VDB_WRKSRC}/build/
+	@${MKDIR} ${NCBI_VDB_WRKSRC}/interfaces/os/bsd
+	@${CP} -p ${NCBI_VDB_WRKSRC}/interfaces/os/mac/endian.h \
+		${NCBI_VDB_WRKSRC}/interfaces/os/bsd/
+
+post-patch:
+	@${GREP} -q '@@PREFIX@@' ${WRKSRC}/ncbi-vdb/libs/kfg/config.c || (echo "@@PREFIX@@ in file/patch-libs_kfg_config.c is overwritten probably due to using 'make makepatch'"; exit 1)
+	@${REINPLACE_CMD} -e 's#@@PREFIX@@#"${PREFIX}"#' ${WRKSRC}/ncbi-vdb/libs/kfg/config.c
+	@${LN} -s ${WRKSRC}/ncbi-vdb/interfaces/cc/gcc/x86_64 ${WRKSRC}/ncbi-vdb/interfaces/cc/gcc/amd64
+
+post-patch-TEST-on:
+	@${REINPLACE_CMD} -e 's|python|${PYTHON_CMD}|' ${WRKSRC}/test/kget/Makefile
+
+pre-configure:
+	@${CP} ${NCBI_VDB_WRKSRC}/setup/os-arch.prl ${WRKSRC}/setup/os-arch.prl
+	# same as in biology/ncbi-vdb
+	@${CP} ${NCBI_VDB_FILESDIR}/Makefile.bsd ${WRKSRC}/build/
+	@${CP} ${NCBI_VDB_WRKSRC}/build/ld.bsd.*.sh ${WRKSRC}/build/
+	@${MKDIR} ${WRKSRC}/interfaces/override
+	@${CP} ${NCBI_VDB_WRKSRC}/interfaces/os/sun/atomic32.h ${WRKSRC}/interfaces/override
+	@${CP} ${FILESDIR}/byteswap.h ${WRKSRC}/interfaces/override
+	@cd ${WRKSRC}/ncbi-vdb && ./configure ${VDB_CONFIGURE_ARGS}
+	@${ECHO} ${CHOSEN_COMPILER_TYPE} > ${WRKSRC}/ncbi-vdb/build/COMP
+	@cd ${WRKSRC}/ncbi-vdb && ${DO_MAKE_BUILD} ${VDB_MAKE_ARGS}
+
+post-build-TEST-on:	do-test
+
+do-install:
+	cd ${WRKSRC}/amd64-portbld-freebsd*/sra-tools/bsd/clang/*/rel/bin && \
+	    for f in `ls *.${PORTVERSION}`; do \
+		${INSTALL_PROGRAM} $${f} \
+		${STAGEDIR}${PREFIX}/bin/`basename $${f%%.${PORTVERSION}}`; \
+	done
+
+.include <bsd.port.mk>
diff --git a/biology/sra-tools/distinfo b/biology/sra-tools/distinfo
new file mode 100644
index 000000000000..fa75acf23fe6
--- /dev/null
+++ b/biology/sra-tools/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1624382289
+SHA256 (ncbi-sra-tools-2.11.0_GH0.tar.gz) = 10ac0a4d1fafc274bc107de811891d3e803d0713a247581dece4448231883810
+SIZE (ncbi-sra-tools-2.11.0_GH0.tar.gz) = 8966605
+SHA256 (ncbi-ngs-2.11.0_GH0.tar.gz) = 5fde50784760c00b403c2cc42ead15a4e9477697ee439f0a16edb4de3f52dfcc
+SIZE (ncbi-ngs-2.11.0_GH0.tar.gz) = 1100365
+SHA256 (ncbi-ncbi-vdb-2.11.0_GH0.tar.gz) = 9a65e3885b9ae1ebecbec871f04ce3162ac3764fb556ecdc8c1e61993e2164aa
+SIZE (ncbi-ncbi-vdb-2.11.0_GH0.tar.gz) = 22277539
diff --git a/biology/sra-tools/files/Makefile.bsd b/biology/sra-tools/files/Makefile.bsd
new file mode 100644
index 000000000000..7692ec277948
--- /dev/null
+++ b/biology/sra-tools/files/Makefile.bsd
@@ -0,0 +1,72 @@
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# default compiler
+ifeq (,$(COMP))
+	COMP = clang
+endif
+
+# handle attempts to set cross-compilation architecture
+# note that if your installation is set up for cross compilation,
+# you can try to enable it on your own.
+ifeq (i386,$(ARCH))
+i386:
+	@ true
+x86_64:
+	@ echo "FreeBSD builds do not support cross-compilation to this architecture"
+endif
+
+ifeq (x86_64,$(ARCH))
+i386:
+	@ echo "FreeBSD builds do not support cross-compilation to this architecture"
+x86_64:
+	@ true
+endif
+
+.PHONY: i386 x86_64
+
+
+# library prefix
+LPFX = lib
+
+# file extensions
+OBJX = o
+LOBX = pic.o
+LIBX = a
+SHLX = so
+
+# compilation defines
+DEFINES	:= -DBSD -DUNIX -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DPKGNAME=bsd$(BITS)
+
+# FreeBSD is a Unix variant; for most cases, linux sources do well
+OS_DAD = linux
+OS_GDAD = unix
+
+# flex+bison: on Mac, use source-controlled generated .c/.h files
+YACC = @ true
+LEX = @ true
+
+# build matrix
+COMPILERS = CLANG GCC
diff --git a/biology/sra-tools/files/byteswap.h b/biology/sra-tools/files/byteswap.h
new file mode 100644
index 000000000000..ef07fe98db64
--- /dev/null
+++ b/biology/sra-tools/files/byteswap.h
@@ -0,0 +1,40 @@
+/*===========================================================================
+*
+*                            PUBLIC DOMAIN NOTICE
+*               National Center for Biotechnology Information
+*
+*  This software/database is a "United States Government Work" under the
+*  terms of the United States Copyright Act.  It was written as part of
+*  the author's official duties as a United States Government employee and
+*  thus cannot be copyrighted.  This software/database is freely available
+*  to the public for use. The National Library of Medicine and the U.S.
+*  Government have not placed any restriction on its use or reproduction.
+*
+*  Although all reasonable efforts have been taken to ensure the accuracy
+*  and reliability of the software and data, the NLM and the U.S.
+*  Government do not and cannot warrant the performance or results that
+*  may be obtained by using this software or data. The NLM and the U.S.
+*  Government disclaim all warranties, express or implied, including
+*  warranties of performance, merchantability or fitness for any particular
+*  purpose.
+*
+*  Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+*/
+
+#ifndef _h_byteswap_
+#define _h_byteswap_
+
+#include <stdint.h>
+#include <sys/endian.h>
+
+/* N.B. Sun's BSWAP seems to be macro-based,
+   meaning that (x) will be evaluated multiple times */
+
+#define bswap_16(x) bswap16 (x)
+#define bswap_32(x) bswap32 (x)
+#define bswap_64(x) bswap64 (x)
+
+#endif /* _h_byteswap_ */
diff --git a/biology/sra-tools/files/ld.bsd.clang.sh b/biology/sra-tools/files/ld.bsd.clang.sh
new file mode 100755
index 000000000000..61c7779adcf1
--- /dev/null
+++ b/biology/sra-tools/files/ld.bsd.clang.sh
@@ -0,0 +1,47 @@
+#!/usr/local/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# define linker params
+LD_EXPORT_GLOBAL="-Wl,--export-dynamic"
+LD_MULTIPLE_DEFS="-Wl,-zmuldefs"
+LD_STATIC="-Wl,-Bstatic"
+LD_DYNAMIC="-Wl,-Bdynamic"
+LD_ALL_SYMBOLS="-Wl,-whole-archive"
+LD_REF_SYMBOLS="-Wl,-no-whole-archive"
+
+# build command
+DLIB_CMD="$LD -shared"
+EXE_CMD="$LD"
+
+# versioned output
+if [ "$VERS" = "" ]
+then
+    DLIB_CMD="$DLIB_CMD -o $TARG"
+    EXE_CMD="$EXE_CMD -o $TARG"
+else
+    set-vers $(echo $VERS | tr '.' ' ')
+    DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.so.$VERS -Wl,-soname,$NAME.so.$MAJ"
+    EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
+fi
diff --git a/biology/sra-tools/files/ld.bsd.cmn.sh b/biology/sra-tools/files/ld.bsd.cmn.sh
new file mode 100755
index 000000000000..a0a65f39884b
--- /dev/null
+++ b/biology/sra-tools/files/ld.bsd.cmn.sh
@@ -0,0 +1,158 @@
+#!/usr/local/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+# script name
+SELF_NAME="$(basename $0)"
+
+# parameters
+LD="$1"
+ARCH="$2"
+BUILD="$3"
+shift 3
+
+SRCDIR="$1"
+BINDIR="$2"
+OUTDIR="$3"
+TARG="$4"
+NAME="$5"
+DBGAP="$6"
+shift 6
+
+VERS="$1"
+VERSFILE="$2"
+DEPFILE="$3"
+shift 3
+
+MODE="$1"
+SCMFLAGS="$2"
+LDFLAGS="$3"
+shift 3
+
+LDIRS="$1"
+XDIRS="$2"
+shift 2
+
+OBJS="$1"
+LIBS="$2"
+
+# decode MODE
+STATIC=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+DYLD=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+KPROC=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+THREADS=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+HAVE_M=$(expr $MODE % 2)
+MODE=$(expr $MODE / 2)
+HAVE_XML=$(expr $MODE % 2)
+
+# decode SCMFLAGS
+CHECKSUM=$(expr $SCMFLAGS % 2)
+STATICSYSLIBS=$(expr $SCMFLAGS / 2)
+
+# return parameter for find-lib
+LIBPATH=''
+
+# initial command state
+CMD=''
+LD_STATIC_STATE=0
+LD_ALL_STATE=0
+
+# for breaking out version
+set-vers ()
+{
+    MAJ=$1
+    MIN=$2
+    REL=$3
+}
+
+# for locating libraries
+find-lib ()
+{
+    _lib="lib$1"
+    _dirs="$2"
+
+    LIBPATH=''
+
+    while [ "$_dirs" != "" ]
+    do
+        _dir="${_dirs%%:*}"
+
+        if [ "$_dir" != "" ]
+        then
+            if [ -e "$_dir/$_lib" ]
+            then
+                while [ -L "$_dir/$_lib" ]
+                do
+                    _lib=$(readlink -n "$_dir/$_lib")
+                done
+                LIBPATH="$_dir/$_lib"
+                break;
+            fi
+        fi
+
+        _dirs="${_dirs#$_dir}"
+        _dirs="${_dirs#:}"
+    done
+}
+
+# setting state
+load-static ()
+{
+    if [ $LD_STATIC_STATE -eq 0 ]
+    then
+        CMD="$CMD $LD_STATIC"
+        LD_STATIC_STATE=1
+    fi
+}
+
+load-dynamic ()
+{
+    if [ $LD_STATIC_STATE -eq 1 ]
+    then
+        CMD="$CMD $LD_DYNAMIC"
+        LD_STATIC_STATE=0
+    fi
+}
+
+load-all-symbols ()
+{
+    if [ $LD_ALL_STATE -eq 0 ]
+    then
+        CMD="$CMD $LD_ALL_SYMBOLS"
+        LD_ALL_STATE=1
+    fi
+}
+
+load-ref-symbols ()
+{
+    if [ $LD_ALL_STATE -eq 1 ]
+    then
+        CMD="$CMD $LD_REF_SYMBOLS"
+        LD_ALL_STATE=0
+    fi
+}
diff --git a/biology/sra-tools/files/ld.bsd.dlib.sh b/biology/sra-tools/files/ld.bsd.dlib.sh
new file mode 100755
index 000000000000..a74f2b006818
--- /dev/null
+++ b/biology/sra-tools/files/ld.bsd.dlib.sh
@@ -0,0 +1,308 @@
+#!/usr/local/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : require shared
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : ignore
+# ===========================================================================
+
+
+# script name
+SELF_NAME="$(basename $0)"
+BUILD_DIR="$(dirname $0)"
+
+# parameters and common functions
+source "${0%dlib.sh}cmn.sh"
+
+# discover tool chain
+case "$LD" in
+g*)
+    source "${0%dlib.sh}gcc.sh"
+    ;;
+c*)
+    source "${0%dlib.sh}clang.sh"
+    ;;
+ *)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# DLIB_CMD was started in tool-specific source
+CMD="$DLIB_CMD $LDFLAGS"
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# list of static libraries used to create dynamic lib
+SLIBS=''
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        [ "$DIR" != "" ] && CMD="$CMD -L$DIR"
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+
+    # update LD_LIBRARY_PATH
+    unset LD_LIBRARY_PATH
+    export LD_LIBRARY_PATH="$LDIRS:$XDIRS"
+
+    # tack on libraries, finding as we go
+    for LIB in $LIBS
+    do
+
+        # strip off switch
+        LIBNAME="${LIB#-[lsd]}"
+
+        # look at linkage
+        case "$LIB" in
+        -ldl|-ddl)
+
+            # always load libdl as shared library
+            load-ref-symbols
+            load-dynamic
+#            CMD="$CMD -ldl"
+            ;;
+
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # try static only
+            if [ $FOUND -eq 0 ]
+            then
+                find-lib $LIBNAME.a $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # add it to dependencies
+                    DEPS="$DEPS $LIBPATH"
+                    SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                    # load static
+                    load-static
+                    load-all-symbols
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                if [ $STATICSYSLIBS -eq 1 ]
+                then
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to static
+                        load-static
+                        load-all-symbols
+                        ;;
+
+                    *)
+                        # set load to dynamic
+                        load-ref-symbols
+                        load-dynamic
+                        ;;
+
+                    esac
+                else
+                    # set load to normal
+                    load-ref-symbols
+                    load-dynamic
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -s*)
+
+            # force static load
+            FOUND=0
+            find-lib $LIBNAME.a $LDIRS
+            if [ "$LIBPATH" != "" ]
+            then
+
+                # found it
+                FOUND=1
+
+                # add it to dependencies
+                DEPS="$DEPS $LIBPATH"
+                SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
+
+                # load static
+                load-static
+                load-all-symbols
+                CMD="$CMD -l$LIBNAME"
+
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+
+                if [ $STATIC -eq 1 ] || [ $STATICSYSLIBS -eq 1 ]
+                then
+                    # set load to static
+                    load-static
+                    load-all-symbols
+                else
+
+                    case "$LIBNAME" in
+                    z|bz2)
+                        # set load to dynamic
+                        load-ref-symbols
+                        load-dynamic
+                        ;;
+
+                    *)
+                        # set load to static
+                        load-static
+                        load-all-symbols
+                        ;;
+                    esac
+                fi
+
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        -d*)
+
+            # only dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
+                then
+
+                    # found it
+                    FOUND=1
+
+                    # load normally
+                    load-ref-symbols
+                    load-dynamic
+                    CMD="$CMD -l$LIBNAME"
+
+                fi
+            fi
+
+            # not found within our directories
+            if [ $FOUND -eq 0 ]
+            then
+                # set load to normal
+                load-ref-symbols
+                load-dynamic
+                CMD="$CMD -l$LIBNAME"
+            fi
+            ;;
+
+        esac
+
+    done
+fi
+
+# put state back to normal
+load-ref-symbols
+load-dynamic
+
+# add in pthreads
+if [ $THREADS -ne 0 ]
+then
+    CMD="$CMD -lpthread"
+fi
+
+# add in xml
+if [ $HAVE_XML -ne 0 ]
+then
+    CMD="$CMD -lxml2"
+fi
+
+# add in math library
+if [ $HAVE_M -ne 0 ]
+then
+    CMD="$CMD -lm"
+fi
+
+# produce shared library
+echo "$CMD"
+$CMD || exit $?
+
+# produce dependencies
+if [ "$DEPFILE" != "" ]
+then
+    echo "$TARG: $DEPS" > "$DEPFILE"
+fi
+
+if [ $CHECKSUM -eq 1 ]
+then
+    SCM_DIR="${BUILD_DIR%/*}/scm"
+    LOGFILE="$SCM_DIR/scm.log"
+    MSG=">>>>> scm: calling the collect script from ld.linux.dlib.sh <<<<<<"
+    #echo "$MSG"
+    echo "$MSG" >> $LOGFILE
+
+    "$BUILD_DIR/scm-collect.sh" "$OBJS" "$SLIBS" | sort -u > "$TARG.md5"
+fi
diff --git a/biology/sra-tools/files/ld.bsd.exe.sh b/biology/sra-tools/files/ld.bsd.exe.sh
new file mode 100755
index 000000000000..650a212780c3
--- /dev/null
+++ b/biology/sra-tools/files/ld.bsd.exe.sh
@@ -0,0 +1,326 @@
+#!/usr/local/bin/bash
+# ===========================================================================
+#
+#                            PUBLIC DOMAIN NOTICE
+#               National Center for Biotechnology Information
+#
+#  This software/database is a "United States Government Work" under the
+#  terms of the United States Copyright Act.  It was written as part of
+#  the author's official duties as a United States Government employee and
+#  thus cannot be copyrighted.  This software/database is freely available
+#  to the public for use. The National Library of Medicine and the U.S.
+#  Government have not placed any restriction on its use or reproduction.
+#
+#  Although all reasonable efforts have been taken to ensure the accuracy
+#  and reliability of the software and data, the NLM and the U.S.
+#  Government do not and cannot warrant the performance or results that
+#  may be obtained by using this software or data. The NLM and the U.S.
+#  Government disclaim all warranties, express or implied, including
+#  warranties of performance, merchantability or fitness for any particular
+#  purpose.
+#
+#  Please cite the author in any work or product based on this material.
+#
+# ===========================================================================
+
+
+# ===========================================================================
+# input library types, and their handling
+#
+#  normal linkage
+#   -l : find shared or static
+#   -s : require static
+#   -d : ignore - will be dynamically loaded
+#
+#  static linkage
+#   -l : require static
+#   -s : require static
+#   -d : require static
+# ===========================================================================
+
+
+# script name
+SELF_NAME="$(basename $0)"
+BUILD_DIR="$(dirname $0)"
+
+# parameters and common functions
+source "${0%exe.sh}cmn.sh"
+
+# discover tool chain
+case "$LD" in
+g*)
+    source "${0%exe.sh}gcc.sh"
+    ;;
+c*)
+    source "${0%exe.sh}clang.sh"
+    ;;
+*)
+    echo "$SELF_NAME: unrecognized ld tool - '$LD'"
+    exit 5
+esac
+
+# EXE_CMD was started in tool-specific source
+CMD="$EXE_CMD $LDFLAGS"
+
+# if building a static executable against dynamic libraries
+# the main application will substitute for name lookup
+if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
+then
+#    CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
+    CMD="$CMD $LD_EXPORT_GLOBAL"
+fi
+
+# tack on object files
+CMD="$CMD $OBJS"
+
+# list of static libraries used to create executable
+SLIBS=''
+
+# initial dependency upon Makefile and vers file
+DEPS="$SRCDIR/Makefile $VERSFILE"
+if [ "$LIBS" != "" ]
+then
+    # tack on paths
+    DIRS="$LDIRS:$XDIRS"
+    while [ "$DIRS" != "" ]
+    do
+        DIR="${DIRS%%:*}"
+        [ "$DIR" != "" ] && CMD="$CMD -L$DIR"
+        DIRS="${DIRS#$DIR}"
+        DIRS="${DIRS#:}"
+    done
+
+    # update LD_LIBRARY_PATH
+    unset LD_LIBRARY_PATH
+    export LD_LIBRARY_PATH="$LDIRS:$XDIRS"
+
+    # tack on libraries, finding as we go
+    for LIB in $LIBS
+    do
+
+        # strip off switch
+        LIBNAME="${LIB#-[lsd]}"
+
+        # look at linkage
+        case "$LIB" in
+        -ldl|-ddl)
+
+            # always load libdl as shared library
+            load-ref-symbols
+            load-dynamic
+#            CMD="$CMD -ldl"
+            ;;
+
+        -l*)
+
+            # normal or dynamic linkage
+            FOUND=0
+            if [ $STATIC -eq 0 ]
+            then
+                find-lib $LIBNAME.so $LDIRS
+                if [ "$LIBPATH" != "" ]
*** 1707 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106221758.15MHw4et061199>