1#!/usr/local/bin/bash 2# =========================================================================== 3# 4# PUBLIC DOMAIN NOTICE 5# National Center for Biotechnology Information 6# 7# This software/database is a "United States Government Work" under the 8# terms of the United States Copyright Act. It was written as part of 9# the author's official duties as a United States Government employee and 10# thus cannot be copyrighted. This software/database is freely available 11# to the public for use. The National Library of Medicine and the U.S. 12# Government have not placed any restriction on its use or reproduction. 13# 14# Although all reasonable efforts have been taken to ensure the accuracy 15# and reliability of the software and data, the NLM and the U.S. 16# Government do not and cannot warrant the performance or results that 17# may be obtained by using this software or data. The NLM and the U.S. 18# Government disclaim all warranties, express or implied, including 19# warranties of performance, merchantability or fitness for any particular 20# purpose. 21# 22# Please cite the author in any work or product based on this material. 23# 24# =========================================================================== 25 26# script name 27SELF_NAME="$(basename $0)" 28 29# parameters 30LD="$1" 31ARCH="$2" 32BUILD="$3" 33shift 3 34 35SRCDIR="$1" 36BINDIR="$2" 37OUTDIR="$3" 38TARG="$4" 39NAME="$5" 40DBGAP="$6" 41shift 6 42 43VERS="$1" 44VERSFILE="$2" 45DEPFILE="$3" 46shift 3 47 48MODE="$1" 49SCMFLAGS="$2" 50LDFLAGS="$3" 51shift 3 52 53LDIRS="$1" 54XDIRS="$2" 55shift 2 56 57OBJS="$1" 58LIBS="$2" 59 60# decode MODE 61STATIC=$(expr $MODE % 2) 62MODE=$(expr $MODE / 2) 63DYLD=$(expr $MODE % 2) 64MODE=$(expr $MODE / 2) 65KPROC=$(expr $MODE % 2) 66MODE=$(expr $MODE / 2) 67THREADS=$(expr $MODE % 2) 68MODE=$(expr $MODE / 2) 69HAVE_M=$(expr $MODE % 2) 70MODE=$(expr $MODE / 2) 71HAVE_XML=$(expr $MODE % 2) 72 73# decode SCMFLAGS 74CHECKSUM=$(expr $SCMFLAGS % 2) 75STATICSYSLIBS=$(expr $SCMFLAGS / 2) 76 77# return parameter for find-lib 78LIBPATH='' 79 80# initial command state 81CMD='' 82LD_STATIC_STATE=0 83LD_ALL_STATE=0 84 85# for breaking out version 86set-vers () 87{ 88 MAJ=$1 89 MIN=$2 90 REL=$3 91} 92 93# for locating libraries 94find-lib () 95{ 96 _lib="lib$1" 97 _dirs="$2" 98 99 LIBPATH='' 100 101 while [ "$_dirs" != "" ] 102 do 103 _dir="${_dirs%%:*}" 104 105 if [ "$_dir" != "" ] 106 then 107 if [ -e "$_dir/$_lib" ] 108 then 109 while [ -L "$_dir/$_lib" ] 110 do 111 _lib=$(readlink -n "$_dir/$_lib") 112 done 113 LIBPATH="$_dir/$_lib" 114 break; 115 fi 116 fi 117 118 _dirs="${_dirs#$_dir}" 119 _dirs="${_dirs#:}" 120 done 121} 122 123# setting state 124load-static () 125{ 126 if [ $LD_STATIC_STATE -eq 0 ] 127 then 128 CMD="$CMD $LD_STATIC" 129 LD_STATIC_STATE=1 130 fi 131} 132 133load-dynamic () 134{ 135 if [ $LD_STATIC_STATE -eq 1 ] 136 then 137 CMD="$CMD $LD_DYNAMIC" 138 LD_STATIC_STATE=0 139 fi 140} 141 142load-all-symbols () 143{ 144 if [ $LD_ALL_STATE -eq 0 ] 145 then 146 CMD="$CMD $LD_ALL_SYMBOLS" 147 LD_ALL_STATE=1 148 fi 149} 150 151load-ref-symbols () 152{ 153 if [ $LD_ALL_STATE -eq 1 ] 154 then 155 CMD="$CMD $LD_REF_SYMBOLS" 156 LD_ALL_STATE=0 157 fi 158} 159