source: trunk/bin/get_fadbad.sh @ 2914

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

Fix check if build/external already exists.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1#! /bin/bash -e
2# $Id: get_fadbad.sh 2914 2013-10-10 01:08:40Z 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_fadbad.sh$$ $newlinech #$$
14# $spell
15#       Fadbad
16#       CppAD
17# $$
18#
19# $section Download and Install Fadbad in Build Directory$$
20# $index fadbad, download and install$$
21# $index download, install fadbad$$
22# $index install, fadbad$$
23#
24# $head Syntax$$
25# $code bin/get_fadbad.sh$$
26#
27# $head Purpose$$
28# If you are using Unix, this command will download and install
29# $href%http://www.fadbad.com%Fadbad%$$ 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 Fadbad source code is downloaded into the sub-directory
38# $code build/external$$ below the distribution directory.
39#
40# $head Prefix Directory$$
41# The Fadbad include files are installed in the sub-directory
42# $code build/prefix/include/FADBAD++$$ below the distribution directory.
43#
44# $end
45# -----------------------------------------------------------------------------
46if [ $0 != "bin/get_fadbad.sh" ]
47then
48        echo "bin/get_fadbad.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 fadbad to build/external and install it to build/prefix'
59version='2.1'
60web_page='http://www.fadbad.com/download'
61prefix=`pwd`'/build/prefix'
62# -----------------------------------------------------------------------------
63if [ ! -d build/external ]
64then
65        echo_eval mkdir -p build/external
66fi
67echo_eval cd build/external
68# -----------------------------------------------------------------------------
69if [ ! -e "FADBAD++-$version.tar.gz" ]
70then
71        echo_eval wget $web_page/FADBAD++-$version.tar.gz
72fi
73if [ -e "FADBAD++" ]
74then
75        echo_eval rm -r FADBAD++
76fi
77echo_eval tar -xzf FADBAD++-$version.tar.gz
78if [ ! -e "$prefix/include" ]
79then
80        echo_eval mkdir -p "$prefix/include"
81fi
82if [ -e "$prefix/include/FADBAD++" ]
83then
84        echo_eval rm -r "$prefix/include/FADBAD++"
85fi
86echo_eval cp -r FADBAD++ "$prefix/include/FADBAD++"
87#
88echo "get_fadbad.sh: OK"
Note: See TracBrowser for help on using the repository browser.