shellfiles/common.sh.in
author Claus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 13:54:38 +0100
changeset 542 aa25a71be62a
parent 160 fadfbf804005
permissions -rw-r--r--
#DOCUMENTATION by cg class: stx_goodies_builder_quickSelfTest class definition class: stx_goodies_builder_quickSelfTest class added:18 methods
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
159
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
# ### START OF common.sh.in ##########################################
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
#
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
# Common set of function to build a project. 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
# 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
# Determine operating system, bit simple but works
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
if [ "$OS" == "Windows_NT" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
    WIN32=1
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
    UNIX=0
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
    WIN32=0
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
    UNIX=1
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
# =====================================================
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
# Utility functions
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
# =====================================================
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
# Simple logging functions
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
function info {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    echo "[INF] $1"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
    if [ ! -z "$2" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
        echo "      $2"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
function error {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
    echo     "[ERR] $1"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
    if [ ! -z "$2" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
        echo "      $2"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    exit 1
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
# Run make in current directory. Caller should cd to target 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
# directory before calling this method.
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
function mk {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
    if [ "$WIN32" == "1" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
    	cmd /C bmake.bat $1 $2
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    else
160
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
    43
    	if [ -f Makefile.init ]; then
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
    44
            make -f Makefile.init || error "Failed to make package"
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
    45
        else
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
    46
            error "No Makefile.init found"
159
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    	fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    	make $1 $2 || error "Make failed"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
# Run tests for package specified in first argument. 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
function sunit {    
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
    pushd stx/goodies/builder/reports
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    info "Running tests for $1"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    if [ "$WIN32" == "1" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
        cmd /C report-runner.bat -D ../../../.. -r Builder::TestReport -p "$1" || error "Failed to run reports"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
        (echo "" | ./report-runner.sh -D ../../../.. -r Builder::TestReport -p "$1") || error "Failed to run reports"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
    popd
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
# Main function. Performs complete build or given task
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
function main {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    pushd "$BUILD"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    if [ -z "$1" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    	info "Checking out..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    	checkout
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    	info "Compiling..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
    	compile
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
    	info "Running tests..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    	runtests
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
        case "$1" in
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
            checkout)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    	        info "Checking out..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    	        checkout;;
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
            compile)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
                info "Compiling..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    	        compile;;
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
            tests)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    	        info "Running tests..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    	        runtests;;
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
            test)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
    	        info "Running tests..."
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    	        runtests;;
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
            *)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
                error "Invalid command ($1)"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
        esac
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    popd
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    exit 0
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
# Setup...
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
if [ "$WIN32" == "1" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    # WINDOWS
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    # MUST export this, otherwise libjpeg fails to build!!!"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    if [ -z "$BCB"]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
        export BCB="C:\Borland\BCC55"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
    # To make cvs/ssh happy
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    if [ -z "$CVS_RSH" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
        export CVS_RSH=plink
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
    # Set home
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    export HOME=$USERPROFILE
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    # LINUX
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
    # to get Mercurial on build slave
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    export PATH=$PATH:/home/vrany/bin
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
if [ -z "$CVSROOT" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
    error "CVSROOT not set!"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
# Sorry, it's lot easier for all to have all the messages in EN :-)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
export LANG=en_GB.UTF-8
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
# When run interactively, Jenkins env variables
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
# may not be set...
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
if [ -z "$WORKSPACE" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
  WORKSPACE="$PWD"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
    INTERACTIVE=1
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
    INTERACTIVE=0
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
if [ "$INTERACTIVE" == "0" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
  if [ "$WIN32" == "1" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    WORKSPACE="$PWD"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
  fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
if [ -z "$BUILD_NUMBER" ]; then
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
    BUILD_NUMBER=$(date +%Y_%m_%d_interactive)
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
160
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
   142
BUILD="$PWD"
159
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
echo "INFO: BUILD=\"$BUILD\""
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
if [ -d "$BUILD" ]; then
160
fadfbf804005 Updates to work with new UNIX makefiles.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 159
diff changeset
   148
    if [ "$BUILD" != "$PWD" ]; then
159
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
        info "Build directory already exists!"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
    fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
else
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
    mkdir -p "$BUILD"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
fi
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
# ===================================================================
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
# Actual build functions. 
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
# ===================================================================
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
#
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
# User scripts should override following functions to define a build
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
function checkout {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    error "You have to override function 'checkout'"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
function compile {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
    error "You have to override function 'compile'"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
function runtests {
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
    info "No tests specified" "To do so, override function runtests"
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
}
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
40cdb9aa191d Add support for generating build scripts using M4 preprocessor
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
# ### END OF common.sh.in ############################################