source: trunk/bin/jenkins.sh @ 2944

Last change on this file since 2944 was 2944, checked in by bradbell, 7 years ago

jenkins.sh: fix use of has_autoconf.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1#! /bin/bash -e
2# $Id: jenkins.sh 2944 2013-10-15 06:19:14Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13# distribution directory corresponding to this version of CppAD
14trunk_dir=`pwd`
15# -----------------------------------------------------------------------------
16# bash function that echos and executes a command
17echo_eval() {
18        echo $*
19        eval $*
20}
21# bash function that echos and executes a command
22for ext in log err
23do
24        if [ -e "../jenkins.$ext" ]
25        then
26                echo_eval rm ../jenkins.$ext
27        fi
28done
29log_eval() {
30        echo "------------------------------------------------" >> ../jenkins.log
31        echo "------------------------------------------------" >> ../jenkins.err
32        echo $*  >> ../jenkins.log
33        echo $*  >> ../jenkins.err
34        echo $* "1>> ../jenkins.log 2>> ../jenkins.err"
35        if ! eval $*  1>> ../jenkins.log 2>> ../jenkins.err
36        then
37                echo_eval cat ../jenkins.log
38                echo_eval cat ../jenkins.err
39                exit 1
40        fi
41}
42for ext in log err
43do
44        if [ -e "../jenkins.$ext" ]
45        then
46                echo_eval rm ../jenkins.$ext
47        fi
48done
49# -----------------------------------------------
50if [ $0 != "bin/jenkins.sh" ]
51then
52        echo "bin/jenkins.sh: must be executed from its parent directory"
53        exit 1
54fi
55# --------------------------------------------------------------------------
56if [ -e /usr/lib64 ]
57then
58        libdir='lib64'
59else
60        libdir='lib'
61fi
62if which autoconf >& /dev/null
63then
64        has_autoconf='yes'
65else
66        has_autoconf='no'
67fi
68# -----------------------------------------------------------------------
69# The following test can be used to skip install of other packages
70skip='false'
71if [ "$skip" != 'true' ]
72then
73        # -------------------------------------------------------------------
74        # Running bin/get_fadbad.sh will install include files in
75        #       $trunk_dir/build/prefix/include/FADBAD++
76        log_eval bin/get_fadbad.sh
77        # -------------------------------------------------------------------
78        # Running bin/get_eigen.sh will install include files in
79        #       $trunk_dir/build/prefix/include/Eigen
80        log_eval bin/get_eigen.sh
81        # -------------------------------------------------------------------
82        # Running bin/get_ipopt.sh will install include files in
83        #       $trunk_dir/build/prefix/include/coin
84        # and library files in
85        #       $trunk_dir/build/prefix/$libdir
86        # where $libdir is 'lib64' if /usr/lib64 exists and 'lib' otherwise.
87        log_eval bin/get_ipopt.sh
88        # -------------------------------------------------------------------
89        # Running bin/get_sacado.sh will install include files in
90        #       $trunk_dir/build/prefix/include
91        # and library files in
92        #       $trunk_dir/build/prefix/$libdir
93        log_eval bin/get_sacado.sh
94        # -------------------------------------------------------------------
95        # Running bin/get_acolc.sh will install include files in
96        #       $trunk_dir/build/prefix/include/adolc
97        # and library files in
98        #       $trunk_dir/build/prefix/$libdir
99        if [ $has_autoconf == 'yes' ]
100        then
101                log_eval bin/get_colpack.sh
102                log_eval bin/get_adolc.sh
103        fi
104        # -------------------------------------------------------------------
105fi
106# -----------------------------------------------------------------------
107system_name=`uname | sed -e 's|\(......\).*|\1|'`
108if [ "$system_name" == 'CYGWIN' ]
109then
110        export PATH="$trunk_dir/build/prefix/bin:$PATH"
111else
112        export LD_LIBRARY_PATH="$trunk_dir/build/prefix/$libdir"
113fi
114# -----------------------------------------------------------------------
115# Use trunk_dir/../build to build and test CppAD (no reuse)
116echo_eval cd ..
117echo_eval rm -rf build
118echo_eval mkdir build
119echo_eval cd build
120#
121# configure cppad to use all the packages above
122if which rmp >& /dev/null
123then
124        build_type=`rpm --eval %{_host}`
125        build_type="--build=$build_type"
126else
127        build_type=''
128fi
129if has_autoconf
130then
131        adolc_dir="ADOLC_DIR=$trunk_dir/build/prefix"
132else
133        adolc_dir=''
134fi
135#
136cat << EOF
137$trunk_dir/configure \\
138        $build_type \\
139        $adolc_dir  \\
140        SACADO_DIR="$trunk_dir/build/prefix" \\
141        EIGEN_DIR="$trunk_dir/build/prefix" \\
142        IPOPT_DIR="$trunk_dir/build/prefix" \\
143        FADBAD_DIR="$trunk_dir/build/prefix"  \\
144        OPENMP_FLAGS=-fopenmp
145EOF
146if ! $trunk_dir/configure $build_type \
147        $adolc_dir \
148        SACADO_DIR="$trunk_dir/build/prefix" \
149        EIGEN_DIR="$trunk_dir/build/prefix" \
150        IPOPT_DIR="$trunk_dir/build/prefix" \
151        FADBAD_DIR="$trunk_dir/build/prefix" \
152        OPENMP_FLAGS=-fopenmp
153then
154        echo "Error during configure command. Here is config.log file:"
155        echo "--------------------------------------------------------"
156        cat config.log
157        exit 1
158fi
159#
160# compile the tests
161log_eval make check
162#
163# run the tests
164log_eval make test
165#
166# print the test results on the console
167echo 'copy make test output to console'
168sed -n -e '/^make test$/,$p' ../jenkins.log
169#
170# make it here without an error exit
171echo "jenkins.sh: OK"
Note: See TracBrowser for help on using the repository browser.