File: make-tool.sh

package info (click to toggle)
ncbi-tools6 6.1.20170106%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 468,492 kB
  • sloc: ansic: 1,474,204; pascal: 6,740; cpp: 6,248; xml: 3,390; sh: 2,139; perl: 1,084; csh: 508; makefile: 437; javascript: 198; ruby: 93; lisp: 81
file content (184 lines) | stat: -rwxr-xr-x 4,888 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#! /bin/sh
#  $Id: make-tool.sh,v 6.6 1999/12/06 18:31:22 kimelman Exp $
#  $RCSfile: make-tool.sh,v $

progname=$0
options="$*"

usage() {
    if [ "x$1" != x ] ; then
        echo "Unrecognized option <$1>" >&2
    fi
    cat >&2 <<EOF

    Usage: 
      $progname --help 
            output this message

      $progname --config <config_file> [<config options>...]
            create configuration file for make (included by makefile.A)
            
      $progname --install <target.install> <webdir> <mode>
            
    config options:
        --mode=MODE
                where MODE is either:
                production 
                development (default)
        --target=TARGET
                where TARGET is either:
                mmdbsrv
                vastsrv
                loader
                web     (default) include mmdbsrv & vastsrv
                all     
        --retrieval=RMODE
                where RMODE is either a combination of :
                  FF - for file based retrieval
                  PS - for Sybase based retrieval
        --threads=Y/N (N by default)
EOF
    if [ "x$1" != x ] ; then
        exit 1
    fi
    exit 0
}

emit_config() {
    mode=development
    target=all
    threads=N
    retrieval=FF
    OS=`uname -s`
    
    if   [ $OS != SunOS -a $OS != IRIX64 ] ; then
        echo "Unknown operating system($OS) - configuration failed" >&2
        exit 1
    fi

    while [ $# -gt 0 ] ; do
        case $1 in
            --mode=prod*)   mode=production  ;;
            --mode=deve*)   mode=development ;;
            --target=mmdb*) target=mmdb      ;;
            --target=vast*) target=vast      ;;
            --target=load*) target=load      ;;
            --target=web)   target=web       ;;
            --target=all)   target=all       ;;
            --threads=Y)    threads=Y        ;;
            --threads=N)    threads=N        ;;
            --retrieval=FF) retrieval=FF     ;;
            --retrieval=PS) retrieval=PS     ;; 
            *)              usage $1         ;;
        esac
        shift
    done
    
    if [ $threads = Y ] ; then
        echo 'SYBLIBRARY = $(NCBI_SYBLIBS_CT_r)'
        echo 'LDFLAGS1=$(NCBI_THR_ALTOBJ) -lthread'
    else
        echo 'SYBLIBRARY = $(NCBI_SYBLIBS_CT)'
    fi
    
    #
    # production/development mode customization
    #
    echo "mode=$mode"
    if [ $mode = production ] ; then
        echo 'OPTFLAG  = $(NCBI_OPTFLAG)'
        echo 'LIBPATH  = $(NCBI_LIBDIR)'
        if   [ $OS = SunOS  ] ; then
            echo 'webdir=/net/neptune/pubmed/WWW/test/www.server/cgi-bin/Entrez/Structure'
            echo 'loaddir=bin'
            echo 'testurl=http://neptune/cgi-bin/Entrez/Structure'
        else
            echo 'webdir=/net/vaster/usr/attic/httpd.public/cgi-bin/Structure'
            echo 'loaddir=/net/vaster/usr/people2/bryant/MDB/Pubstruct'
            echo 'testurl=http://vaster/cgi-bin/Structure'
        fi
    else
        echo 'OPTFLAG  = -g'
        echo 'LIBPATH  = $(NCBI_ALTLIB)'
        if   [ $OS = SunOS  ] ; then
            echo 'webdir=/net/neptune/pubmed/WWW/dvlp/www.server/cgi-bin/Entrez/Structure'
            echo 'loaddir=bin'
            echo 'testurl=http://neptune:5701/cgi-bin/Entrez/Structure'
        else
            echo 'webdir=/net/vaster/usr/attic/httpd.local/cgi-bin/Structure'
            echo 'loaddir=bin'
            echo 'testurl=http://vaster:6224/cgi-bin/Structure'
        fi
    fi

    echo "RMODE=${retrieval}"
    
    case $target in 
        mmdb) 
            echo "TARGET=mmdbsrv"
            ;;
        vast) 
            echo "TARGET=vastsrv"
            ;;
        load) 
            echo "TARGET=loader"
            ;;
        web)
            echo "TARGET=mmdbsrv vastsrv"
            ;;
        all)
            echo "TARGET=mmdbsrv vastsrv loader"
            ;;
    esac
}


case $1 in
    --help)
        usage 
        ;;
    --config)
        cfile=$2
        shift 2
        emit_config $* >$cfile
        ;;
    --install)
        fname=$2
        fbase=`basename $fname .FF`
        fbase=`basename $fbase .PS`
        webdir=$3
        mode=$4
        if [ x$mode = xproduction ] ; then
            ext=REAL
        else
            ext=NEW
        fi
	cp $fname ${webdir}/$fname
	cd ${webdir} 
        [ -r $fbase ] || ln -s wrapper.sh $fbase ;
        [ ! -r $fbase.$ext ] || rm -f $fbase.$ext
        ln -s $fname $fbase.$ext
	whoami >${fbase}.recepient
        ;;
    --test)
        webdir=$2
        binary=$3
        mode=$4
        if [ x$mode = xproduction ] ; then
            ext=
        else
            ext=.NEW
        fi
        cmdline="$5"
        cd $webdir
        . ./.syb_set
        SYBASE=$SYBASE_conf
        LANG=
        export SYBASE LANG
        echo "" | ./$binary$ext "$cmdline" >/dev/null
        ;;
    *)
        usage $*
        ;;
esac
exit 0