source: trunk/bin/get_sacado.sh @ 2888

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

get_sacado.sh: another attemp to determine proper cmake version for jenkins.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1#! /bin/bash -e
2# $Id: get_sacado.sh 2888 2013-08-07 15:44:21Z 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# $begin get_sacado.sh$$ $newlinech #$$
14# $spell
15#       Sacado
16#       CppAD
17# $$
18#
19# $section Download and Install Sacado in Build Directory$$
20# $index sacado, download and install$$
21# $index download, install sacado$$
22# $index install, sacado$$
23#
24# $head Syntax$$
25# $code bin/get_sacado.sh$$
26#
27# $head Purpose$$
28# If you are using Unix, this command will download and install
29# $href%http://trilinos.sandia.gov/packages/sacado%Sacado%$$ in the
30# CppAD $code build$$ directory.
31#
32# $head Distribution Directory$$
33# This command must be executed in the
34# $cref/distribution directory/download/Distribution Directory/$$.
35#
36# $head External Directory$$
37# The Sacado source code is downloaded into the sub-directory
38# $code build/external$$ below the distribution directory.
39#
40# $head Prefix Directory$$
41# The Sacado libraries and include files are installed in the sub-directory
42# $code build/prefix$$ below the distribution directory.
43#
44# $end
45# -----------------------------------------------------------------------------
46if [ $0 != "bin/get_sacado.sh" ]
47then
48        echo "bin/get_sacado.sh: must be executed from its parent directory"
49        exit 1
50fi
51# -----------------------------------------------------------------------------
52# bash function that echos and executes a command
53echo_eval() {
54        echo $*
55        eval $*
56}
57# -----------------------------------------------------------------------------
58echo 'Download sacado to build/external and install it to build/prefix'
59version="trilinos-10.8.3-Source"
60web_page="http://trilinos.sandia.gov/download/files"
61prefix=`pwd`'/build/prefix'
62# -----------------------------------------------------------------------------
63# determine which version of cmake to use
64cmake --version |  sed \
65                -e 's|[^0-9.]*||g' \
66                -e 's|\([0-9]*\)\.\([0-9]*\)\..*|\1 * 10 + \2|' \
67        | bc > get_sacado.$$
68cmake_version=`cat get_sacado.$$`
69rm get_sacado.$$
70echo "cmake_version=$cmake_version"
71#
72cmake_program=''
73if [ "$cmake_version" -ge '27' ]
74then
75        cmake_program='cmake'
76else
77        for cmake_version in 27 28 29
78        do
79                if which cmake$cmake_version >& /dev/null
80                then
81                        cmake_program="cmake$cmake_version"
82                fi
83        done
84fi
85if [ "$cmake_program" == '' ]
86then
87        echo 'cannot find a verison of cmake that is 2.7 or higher'
88        exit 1
89fi
90# -----------------------------------------------------------------------------
91if [ -e /usr/lib64 ]
92then
93        libdir='lib64'
94else
95        libdir='lib'
96fi
97# -----------------------------------------------------------------------------
98if [ ! -d external ]
99then
100        echo_eval mkdir -p build/external
101fi
102echo_eval cd build/external
103# -----------------------------------------------------------------------------
104if [ ! -e "$version.tar.gz" ]
105then
106        echo_eval wget $web_page/$version.tar.gz
107fi
108for package in Sacado Teuchos Trilinois
109do
110        echo_eval rm -rf $prefix/include/$package*
111done
112if [ ! -e "$version" ]
113then
114        echo_eval tar -xzf $version.tar.gz
115fi
116#
117echo_eval cd $version
118if [ ! -e build ]
119then
120        echo_eval mkdir build
121fi
122echo_eval cd build
123if [ -e CMakeCache.txt ]
124then
125        echo_eval rm CMakeCache.txt
126fi
127echo_eval $cmake_program \
128        -D CMAKE_BUILD_TYPE:STRING=RELEASE \
129        -D Trilinos_ENABLE_Sacado:BOOL=ON \
130        -D Sacado_ENABLE_TESTS:BOOL=OFF \
131        -D CMAKE_INSTALL_PREFIX:PATH=$prefix \
132        -D Trilinos_INSTALL_LIB_DIR=$prefix/$libdir \
133        ../
134echo_eval make install
135#
136echo "get_sacado.sh: OK"
Note: See TracBrowser for help on using the repository browser.