File: build.sh

package info (click to toggle)
ncbi-tools6 6.1.20120620-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 241,628 kB
  • ctags: 101,236
  • sloc: ansic: 1,431,713; cpp: 6,248; pascal: 3,949; xml: 3,390; sh: 3,090; perl: 1,077; csh: 488; makefile: 449; ruby: 93; lisp: 81
file content (85 lines) | stat: -rw-r--r-- 1,637 bytes parent folder | download | duplicates (3)
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
#! /bin/sh
# $Id: build.sh,v 1.1 2009/01/23 19:48:09 ivanov Exp $
# Author:  Vladimir Ivanov (ivanov@ncbi.nlm.nih.gov)
#
# Build C Toolkit on MSVC9 32/64.


########### Arguments

script="$0"
cfgs="${1:-Debug Release DebugDLL ReleaseDLL}"
arch="$2"
target="${3:-all_ncbi}"


########### Global variables

timer="date +'%H:%M'"
out=".build.$$"


########## Functions

error()
{
  echo "[`basename $script`] ERROR:  $1"
  exit 1

}

generate_msvc9_error_check_file() {
  cat <<-EOF >$1
	/(^| : |^The source )([fatal error]* [CDULNKPRJVT]*[0-9]*: |The .* are both configured to produce |Error executing )/ {
	  print \$0
	  exit
	}
	EOF
}


########## Main

# Get build dir
build_dir=`dirname $script`
build_dir=`(cd "$build_dir"; pwd)`

if [ ! -d $build_dir ] ; then
  error "Build directory $build_dir not found"
  exit 1
fi
cd $build_dir


# Generate errors check script

check_awk=$build_dir/build_check.awk
generate_msvc9_error_check_file $check_awk


# Build

for cfg in $cfgs ; do
   start=`eval $timer`
   echo Start time: $start
   echo "INFO: Building \"$cfg\""
   $build_dir/build_exec.bat "ncbi.sln" build "$arch" "$cfg" "$target" $out
   status=$?
   cat $out
   echo "Build time: $start - `eval $timer`"
   if [ $status -ne 0 ] ; then
     # Check on errors
     failed="1"
     grep '^ *Build: .* succeeded, .* failed' /tmp/build.$$ >/dev/null 2>&1  && \
       awk -f $check_awk $out >$out.res 2>/dev/null  &&  test ! -s $out.res  &&  failed="0"
     rm -f $out.res >/dev/null 2>&1
     rm -f $out     >/dev/null 2>&1
     if [ "$failed" = "1" ]; then
       exit 4
     fi
   fi
   rm -f $out >/dev/null 2>&1
done


exit 0