source: BOL/script_install_amaury/install_netcdf4_hdf5.bash @ 4870

Last change on this file since 4870 was 4417, checked in by fhourdin, 22 months ago

Poursuite nettoyage ~lmdz/pub

  • Property svn:executable set to *
File size: 5.6 KB
Line 
1#!/bin/bash
2#########################################################################
3# Defaults
4#########################################################################
5install_dir=$(pwd)
6c_compiler=gcc
7f_compiler=gfortran
8cxx_compiler=g++
9mpi_home="/usr/lib64/openmpi"
10#########################################################################
11#  Options
12#########################################################################
13while (($# > 0))
14   do
15   case $1 in
16     "-h") cat <<........fin
17    $0 [ -prefix path ]       where (path) to install
18                              (default: $install_dir)
19       [ -CC compiler ]       C compiler to use
20                              (default: $c_compiler)
21       [ -FC compiler ]       Fortran compiler to use
22                              (default: $f_compiler)
23       [ -CXX compiler ]      C++ compiler to use
24                              (default: $cxx_compiler)
25       [ -MPI path ]          top directory of the MPI library
26                              (default: $mpi_home)
27........fin
28     exit ;;
29     "-prefix") install_dir=$2 ; shift ; shift ;;
30     "-CC") c_compiler=$2 ; shift ; shift ;;
31     "-FC") f_compiler=$2 ; shift ; shift ;;
32     "-CXX") cxx_compiler=$2 ; shift ; shift ;;
33     "-MPI") mpi_home=$2 ; shift ; shift ;;
34     *) echo "Error, bad argument $1" ; $0 -h ; exit
35   esac
36done
37
38# Install directory (get full path)
39mkdir -p $install_dir
40install_dir=$(cd $install_dir ; pwd -P )
41
42# Install location for packages
43mkdir -p $install_dir/src
44
45# CURL
46APP=curl-7.26.0
47CURL_PATH=$install_dir/$APP
48rm -rf $CURL_PATH 
49cd $install_dir/src
50rm -rf curl-7.26.0*
51wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/curl-7.26.0.tar.gz
52tar xvf curl-7.26.0.tar.gz ; cd curl-7.26.0
53export CC=$c_compiler
54./configure \
55--prefix=$install_dir | tee $APP.config.log
56make 2>&1 | tee $APP.make.log
57make install 2>&1 | tee $APP.install.log
58
59# ZLIB
60APP=zlib-1.2.8
61ZLIB_PATH=$install_dir/$APP 
62rm -rf $ZLIB_PATH 
63cd $install_dir/src
64rm -rf zlib-1.2.8*
65wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/zlib-1.2.8.tar.gz
66tar zxf zlib-1.2.8.tar.gz ; cd zlib-1.2.8
67export CC=$c_compiler
68export FC=$f_compiler
69export CXX=$cxx_compiler 
70./configure \
71--prefix=$install_dir | tee $APP.config.log
72make 2>&1 | tee $APP.make.log
73make check 2>&1 | tee $APP.make_check.log
74make install 2>&1 | tee $APP.install.log
75
76# HDF5
77APP=hdf5-1.10.7
78HDF5_PATH=$install_dir/$APP 
79rm -rf $HDF5_PATH 
80cd $install_dir/src
81rm -rf ${APP}*
82wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/$APP.tar.gz
83tar xzf $APP.tar.gz ; cd $APP
84export PATH=$mpi_home/bin:$PATH
85if [[ ${LD_LIBRARY_PATH} == '' ]]
86then
87  export LD_LIBRARY_PATH=$mpi_home/lib
88else
89  export LD_LIBRARY_PATH=$mpi_home/lib:${LD_LIBRARY_PATH}
90fi
91export CFLAGS="-I$mpi_home/include -m64"
92export LDFLAGS="-L$mpi_home/lib -lmpi"
93export MPI_BIN=$mpi_home/bin
94export MPI_SYSCONFIG=$mpi_home/etc
95export MPI_FORTRAN_MOD_DIR=$mpi_home/lib
96export MPI_INCLUDE=$mpi_home/include
97export MPI_LIB=$mpi_home/lib
98export MPI_HOME=$mpi_home
99export CC=mpicc
100export FC=mpif90
101export CXX=mpiCC
102./configure \
103--prefix=$install_dir \
104--enable-fortran \
105--enable-parallel \
106--with-zlib=$install_dir  \
107--with-pic 2>&1 | tee $APP.config.log
108make 2>&1 | tee $APP.make.log
109#make check 2>&1 | tee $APP.make_check.log
110make install 2>&1 | tee $APP.install.log
111
112# NetCDF4
113APP=netcdf-4.3.3.1
114NETCDF4_PATH=$install_dir/$APP
115rm -rf $NETCDF4_PATH 
116cd $install_dir/src
117rm -rf netcdf-4.3.3.1*
118wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-4.3.3.1.tar.gz
119tar xzf netcdf-4.3.3.1.tar.gz ; cd netcdf-4.3.3.1
120export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi"
121export CFLAGS="-I${install_dir}/include/curl -I${install_dir}/include"
122export LD_LIBRARY_PATH="${install_dir}/lib:${LD_LIBRARY_PATH}"
123CC=mpicc ./configure \
124--prefix=${install_dir} \
125--enable-static \
126--enable-shared \
127--enable-netcdf4 \
128--enable-dap \
129--with-pic 2>&1 | tee $APP.config.log
130make 2>&1 | tee $APP.make.log
131make check 2>&1 | tee $APP.make_check.log
132make install 2>&1 | tee $APP.install.log
133
134# NetCDF4-Fortran
135APP=netcdf-fortran-4.4.2
136NETCDF4_FORTRAN_PATH=${install_dir}/$APP
137rm -rf $NETCDF4_FORTRAN_PATH
138cd ${install_dir}/src
139rm -rf netcdf-fortran-4.4.2*
140wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-fortran-4.4.2.tar.gz
141tar xzf netcdf-fortran-4.4.2.tar.gz ; cd netcdf-fortran-4.4.2
142#export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH}
143export LDFLAGS="-L${install_dir}/lib -L${install_dir}/lib -L${mpi_home}/lib -lmpi"
144export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include"
145export CC=mpicc
146export FC=mpif90
147export F77=mpif77
148export LDFLAGS=-L${install_dir}/lib
149./configure \
150--prefix=${install_dir} 2>&1 | tee $APP.config.log
151make 2>&1 | tee $APP.make.log
152make check 2>&1 | tee $APP.make_check.log
153make install 2>&1 | tee $APP.install.log
154
155# NetCDF4-C++
156APP=netcdf-cxx4-4.2.1
157NETCDF4_CXX_PATH=${install_dir}/$APP
158rm -rf $NETCDF4_CXX_PATH
159cd ${install_dir}/src
160rm -rf netcdf-cxx4-4.2.1*
161wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-cxx4-4.2.1.tar.gz
162tar xzf netcdf-cxx4-4.2.1.tar.gz ; cd netcdf-cxx4-4.2.1
163#export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH}
164export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi"
165export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include"
166export CC=mpicc
167export CXX=mpiCC
168export LDFLAGS=-L${install_dir}/lib
169./configure \
170--prefix=${install_dir} 2>&1 | tee $APP.config.log
171make 2>&1 | tee $APP.make.log
172make check 2>&1 | tee $APP.make_check.log
173make install 2>&1 | tee $APP.install.log
Note: See TracBrowser for help on using the repository browser.