source: trunk/bin/get_ipopt.sh @ 2878

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

check_jenkins.sh: Local version of jenkins remote test.
get_ipopt.sh: Remote address of netlib source changed.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#! /bin/bash -e
2# $Id: get_ipopt.sh 2878 2013-07-29 17:42:41Z 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_ipopt.sh$$ $newlinech #$$
14# $spell
15#       Ipopt
16#       CppAD
17# $$
18#
19# $section Download and Install Ipopt in Build Directory$$
20# $index ipopt, download and install$$
21# $index download, install ipopt$$
22# $index install, ipopt$$
23#
24# $head Syntax$$
25# $code bin/get_ipopt.sh$$
26#
27# $head Purpose$$
28# If you are using Unix, this command will download and install
29# $href%http://www.coin-or.org/projects/Ipopt.xml%Ipopt%$$ 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 Ipopt source code is downloaded and compiled in the sub-directory
38# $code build/external$$ below the distribution directory.
39#
40# $head Prefix Directory$$
41# The Ipopt 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_ipopt.sh" ]
47then
48        echo "bin/get_ipopt.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 ipopt to build/external and install it to build/prefix'
59version='3.10'
60repository='https://projects.coin-or.org/svn/Ipopt'
61prefix=`pwd`'/build/prefix'
62# -----------------------------------------------------------------------------
63if [ ! -d external ]
64then
65        echo_eval mkdir -p build/external
66fi
67echo_eval cd build/external
68# -----------------------------------------------------------------------------
69if [ ! -e "Ipopt-$version" ]
70then
71        echo_eval svn checkout "$repository/stable/$version Ipopt-$version"
72        ipopt_up_to_date='yes'
73else
74        if svn update "Ipopt-$version"
75        then
76                ipopt_up_to_date='yes'
77        else
78                ipopt_up_to_date='no'
79        fi
80fi
81echo_eval cd "Ipopt-$version"
82# -----------------------------------------------------------------------------
83file='Ipopt/src/Algorithm/IpIpoptAlg.cpp'
84comment='// Suppress printing startup message'
85if ! grep "$comment" $file > /dev/null
86then
87        match='static bool copyright_message_printed'
88        echo "Patch $file"
89        echo "so it does not print message with every run."
90        sed -e "s|^  $match = false;|$comment\n//&\n  $match = true;|" -i $file
91fi
92for file in ThirdParty/Blas/get.Blas ThirdParty/Lapack/get.Lapack
93do
94        sed -e 's|ftp:\(\/\/www.netlib.org\/\)|http:\1|' \
95                -i $file
96done
97# -----------------------------------------------------------------------------
98if [ -e ThirdParty/HSL ]
99then
100        echo_eval rm -rf ThirdParty/HSL
101fi
102for package in Blas Lapack Metis Mumps
103do
104        if [ ! -e "ThirdParty/$package/get.$package.done" ]
105        then
106                echo_eval cd ThirdParty/$package
107                echo_eval "./get.$package"
108                echo_eval touch "get.$package.done" 
109                echo_eval cd ../..
110        fi
111done
112# -----------------------------------------------------------------------------
113if [ -e /usr/lib64 ]
114then
115        libdir='lib64'
116else
117        libdir='lib'
118fi
119export PKG_CONFIG_PATH="$prefix/$libdir/pkgconfig"
120echo_eval ./configure \
121        --enable-debug \
122        --prefix="$prefix" \
123        --libdir="$prefix/$libdir" 
124# -----------------------------------------------------------------------------
125echo_eval make install
126#
127if [ "$ipopt_up_to_date" == 'no' ]
128then
129        echo "get_ipopt.sh: OK except could not update Ipopt"
130else
131        echo "get_ipopt.sh: OK"
132fi
Note: See TracBrowser for help on using the repository browser.