freebsd-ports/biology/sra-tools/files/ld.bsd.cmn.sh
Jason W. Bacon 69656bf0d7 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.
2021-06-22 12:55:15 -05:00

158 lines
3.1 KiB
Bash
Executable file

#!/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
}