source: trunk/bin/get_sacado.sh @ 3730

Last change on this file since 3730 was 3730, checked in by bradbell, 4 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 5a9084e28d2147cf1b7101d41aa72c2eefd60f1d
end hash code: 6b89ca25800449853e79c16bb1f7e755cf29675d

commit 6b89ca25800449853e79c16bb1f7e755cf29675d
Author: Brad Bell <bradbell@…>
Date: Wed Sep 23 08:54:20 2015 -0700

Remove invisible white space.

commit 1e2449cb036f2b468d6b5cbee32004dd974fed77
Author: Brad Bell <bradbell@…>
Date: Wed Sep 23 08:52:21 2015 -0700

  1. Change bin/get_* to check if requested version has already been installed.
  2. Put NumberOp? entry at end of NumArgTable? and NumResTable? in op_code.hpp.


op_code.hpp: use white space to align comments.
jenkins.sh: call all bin/get_* routines and let them descide if install is necessary.
configure: automatic changes corresponding to configure.ac.
configure.ac: define have_ar before its first use and improve its messaging.

commit 39a713028e11e2935098b2dd80d1fdd907e32371
Author: Brad Bell <bradbell@…>
Date: Wed Sep 23 05:54:15 2015 -0700

  1. minor white space edit
  2. put some operator cases in alphabetical order.
  3. remove invisible white space.
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 6.1 KB
Line 
1#! /bin/bash -e
2# $Id: get_sacado.sh 3730 2015-09-23 15:56:53Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 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#       trilinos
16#       gz
17#       Sacado
18#       CppAD
19# $$
20#
21# $section Download and Install Sacado in Build Directory$$
22# $index sacado, download and install$$
23# $index download, install sacado$$
24# $index install, sacado$$
25#
26# $head Syntax$$
27# $code bin/get_sacado.sh$$
28#
29# $head Purpose$$
30# If you are using Unix, this command will download and install
31# $href%http://trilinos.sandia.gov/packages/sacado%Sacado%$$ in the
32# CppAD $code build$$ directory.
33#
34# $head Distribution Directory$$
35# This command must be executed in the
36# $cref/distribution directory/download/Distribution Directory/$$.
37#
38# $head External Directory$$
39# The Sacado source code is downloaded into the sub-directory
40# $code build/external$$ below the distribution directory.
41#
42# $head Prefix Directory$$
43# The Sacado libraries and include files are installed in the sub-directory
44# $code build/prefix$$ below the distribution directory.
45#
46# $head Reuse$$
47# The file $codei%build/external/trilinos-%version%-Source.tar.gz%$$
48# and the directory $codei%build/external/trilinos-%version%-Source%$$
49# will be reused if they exist. Delete this file and directory
50# to get a complete rebuild.
51#
52# $end
53# -----------------------------------------------------------------------------
54if [ $0 != "bin/get_sacado.sh" ]
55then
56        echo "bin/get_sacado.sh: must be executed from its parent directory"
57        exit 1
58fi
59# -----------------------------------------------------------------------------
60# bash function that echos and executes a command
61echo_eval() {
62        echo $*
63        eval $*
64}
65# -----------------------------------------------------------------------------
66echo 'Download sacado to build/external and install it to build/prefix'
67version="11.12.1"
68trilinos_dir="trilinos-$version-Source"
69web_page="http://trilinos.org/oldsite/download/files"
70cppad_dir=`pwd`
71prefix="$cppad_dir/build/prefix"
72installed_flag="build/external/trilinos-${version}.installed"
73if [ -e "$installed_flag" ]
74then
75        echo "$installed_flag exists: Skipping get_sacado.sh"
76        exit 0
77fi
78# -----------------------------------------------------------------------------
79# determine which version of cmake to use
80cmake --version |  sed -n \
81                -e 's|[^0-9]*|.|g ' \
82                -e 's|\.\([0-9]*\)\.\([0-9]*\).*|\1 * 10 + \2|' \
83                -e '1,1p' \
84        | bc > get_sacado.$$
85cmake_version=`cat get_sacado.$$`
86rm get_sacado.$$
87echo "cmake_version=$cmake_version"
88#
89cmake_program=''
90if [ "$cmake_version" -ge '27' ]
91then
92        cmake_program='cmake'
93else
94        for cmake_version in 27 28 29
95        do
96                if which cmake$cmake_version >& /dev/null
97                then
98                        cmake_program="cmake$cmake_version"
99                fi
100        done
101fi
102if [ "$cmake_program" == '' ]
103then
104        echo 'cannot find a verison of cmake that is 2.7 or higher'
105        exit 1
106fi
107# -----------------------------------------------------------------------------
108# libdir
109if [ -e /usr/lib64 ]
110then
111        libdir='lib64'
112else
113        libdir='lib'
114fi
115# -----------------------------------------------------------------------------
116# check if we have a local copy of coin lapack and blas libraries installed
117coin_lapack_blas='no'
118if [ -e build/prefix/$libdir/libcoinlapack.a ]
119then
120        if [ -e build/prefix/$libdir/libcoinblas.a ]
121        then
122                coin_lapack_blas='yes'
123        fi
124fi
125echo "coin_lapack_blas=$coin_lapack_blas"
126# -----------------------------------------------------------------------------
127# change into build/external directory
128if [ ! -d build/external ]
129then
130        echo_eval mkdir -p build/external
131fi
132echo_eval cd build/external
133# -----------------------------------------------------------------------------
134# create the trilions source directory and change into it
135if [ ! -e "$trilinos_dir.tar.gz" ]
136then
137        echo_eval wget --no-check-certificate $web_page/$trilinos_dir.tar.gz
138fi
139for package in Sacado Teuchos Trilinois
140do
141        echo_eval rm -rf $prefix/include/$package*
142done
143if [ ! -e "$trilinos_dir" ]
144then
145        echo_eval tar -xzf $trilinos_dir.tar.gz
146        # ------------------------------------------------------------------------
147        # patch the cmake/tribits/modules/FindPythonInterp.cmake file
148        file="$trilinos_dir/cmake/tribits/modules/FindPythonInterp.cmake"
149        line='[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\2.8\\\\'
150        line="${line}InstallPath]"
151        if [ -e "$file" ]
152        then
153                echo "patch $file"
154                sed \
155                        -e 's|NAMES \(python2.7 python2.6\)|NAMES python2.8 \1|' \
156                        -e "s|^\( *\)\[HKEY_LOCAL_MACHINE.*2\.7.*|\1$line\n&|" \
157                        -i $file
158        fi
159        # ------------------------------------------------------------------------
160fi
161echo_eval cd $trilinos_dir
162# -----------------------------------------------------------------------------
163# change into build sub-directory
164if [ ! -e build ]
165then
166        echo_eval mkdir build
167fi
168echo_eval cd build
169# -----------------------------------------------------------------------------
170# cmake command and install
171if [ "$coin_lapack_blas" == 'yes' ]
172then
173        echo_eval $cmake_program \
174                -D CMAKE_BUILD_TYPE:STRING=RELEASE \
175                -D Trilinos_ENABLE_Sacado:BOOL=ON \
176                -D Sacado_ENABLE_TESTS:BOOL=OFF \
177                -D CMAKE_INSTALL_PREFIX:PATH=$prefix \
178                -D Trilinos_INSTALL_LIB_DIR=$prefix/$libdir \
179                -D LAPACK_LIBRARY_NAMES:STRING=coinlapack \
180                -D BLAS_LIBRARY_NAMES:STRING=coinblas \
181                -D LAPACK_LIBRARY_DIRS:STRING=../prefix/$libdir \
182                -D BLAS_LIBRARY_DIRS:STRING=../prefix/$libdir \
183                ../
184else
185        echo_eval $cmake_program \
186                -D CMAKE_BUILD_TYPE:STRING=RELEASE \
187                -D Trilinos_ENABLE_Sacado:BOOL=ON \
188                -D Sacado_ENABLE_TESTS:BOOL=OFF \
189                -D CMAKE_INSTALL_PREFIX:PATH=$prefix \
190                -D Trilinos_INSTALL_LIB_DIR=$prefix/$libdir \
191                ../
192fi
193echo_eval make install
194# -----------------------------------------------------------------------------
195echo_eval touch $cppad_dir/$installed_flag
196echo "get_sacado.sh: OK"
Note: See TracBrowser for help on using the repository browser.