[4405] | 1 | #!/bin/bash |
---|
| 2 | ######################################################################### |
---|
| 3 | # Defaults |
---|
| 4 | ######################################################################### |
---|
| 5 | install_dir=$(pwd) |
---|
| 6 | c_compiler=gcc |
---|
| 7 | f_compiler=gfortran |
---|
| 8 | cxx_compiler=g++ |
---|
| 9 | mpi_home="/usr/lib64/openmpi" |
---|
| 10 | ######################################################################### |
---|
| 11 | # Options |
---|
| 12 | ######################################################################### |
---|
| 13 | while (($# > 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 |
---|
| 36 | done |
---|
| 37 | |
---|
| 38 | # Install directory (get full path) |
---|
| 39 | mkdir -p $install_dir |
---|
| 40 | install_dir=$(cd $install_dir ; pwd -P ) |
---|
| 41 | |
---|
| 42 | # Install location for packages |
---|
| 43 | mkdir -p $install_dir/src |
---|
| 44 | |
---|
| 45 | # CURL |
---|
| 46 | APP=curl-7.26.0 |
---|
| 47 | CURL_PATH=$install_dir/$APP |
---|
| 48 | rm -rf $CURL_PATH |
---|
| 49 | cd $install_dir/src |
---|
| 50 | rm -rf curl-7.26.0* |
---|
| 51 | #wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/curl-7.26.0.tar.gz |
---|
| 52 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/curl-7.26.0.tar.gz |
---|
| 53 | tar xvf curl-7.26.0.tar.gz ; cd curl-7.26.0 |
---|
| 54 | export CC=$c_compiler |
---|
| 55 | ./configure \ |
---|
| 56 | --prefix=$install_dir | tee $APP.config.log |
---|
| 57 | make 2>&1 | tee $APP.make.log |
---|
| 58 | make install 2>&1 | tee $APP.install.log |
---|
| 59 | |
---|
| 60 | # ZLIB |
---|
| 61 | APP=zlib-1.2.8 |
---|
| 62 | ZLIB_PATH=$install_dir/$APP |
---|
| 63 | rm -rf $ZLIB_PATH |
---|
| 64 | cd $install_dir/src |
---|
| 65 | rm -rf zlib-1.2.8* |
---|
| 66 | #wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/zlib-1.2.8.tar.gz |
---|
| 67 | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/Distrib/zlib-1.2.8.tar.gz |
---|
| 68 | tar zxf zlib-1.2.8.tar.gz ; cd zlib-1.2.8 |
---|
| 69 | export CC=$c_compiler |
---|
| 70 | export FC=$f_compiler |
---|
| 71 | export CXX=$cxx_compiler |
---|
| 72 | ./configure \ |
---|
| 73 | --prefix=$install_dir | tee $APP.config.log |
---|
| 74 | make 2>&1 | tee $APP.make.log |
---|
| 75 | make check 2>&1 | tee $APP.make_check.log |
---|
| 76 | make install 2>&1 | tee $APP.install.log |
---|
| 77 | |
---|
| 78 | # HDF5 |
---|
| 79 | APP=hdf5-1.10.7 |
---|
| 80 | HDF5_PATH=$install_dir/$APP |
---|
| 81 | rm -rf $HDF5_PATH |
---|
| 82 | cd $install_dir/src |
---|
| 83 | rm -rf ${APP}* |
---|
| 84 | #wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/hdf5-1.8.13.tar.gz |
---|
| 85 | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/Distrib/$APP.tar.gz |
---|
| 86 | tar xzf $APP.tar.gz ; cd $APP |
---|
| 87 | export PATH=$mpi_home/bin:$PATH |
---|
| 88 | if [[ ${LD_LIBRARY_PATH} == '' ]] |
---|
| 89 | then |
---|
| 90 | export LD_LIBRARY_PATH=$mpi_home/lib |
---|
| 91 | else |
---|
| 92 | export LD_LIBRARY_PATH=$mpi_home/lib:${LD_LIBRARY_PATH} |
---|
| 93 | fi |
---|
| 94 | export CFLAGS="-I$mpi_home/include -m64" |
---|
| 95 | export LDFLAGS="-L$mpi_home/lib -lmpi" |
---|
| 96 | export MPI_BIN=$mpi_home/bin |
---|
| 97 | export MPI_SYSCONFIG=$mpi_home/etc |
---|
| 98 | export MPI_FORTRAN_MOD_DIR=$mpi_home/lib |
---|
| 99 | export MPI_INCLUDE=$mpi_home/include |
---|
| 100 | export MPI_LIB=$mpi_home/lib |
---|
| 101 | export MPI_HOME=$mpi_home |
---|
| 102 | export CC=mpicc |
---|
| 103 | export FC=mpif90 |
---|
| 104 | export CXX=mpiCC |
---|
| 105 | ./configure \ |
---|
| 106 | --prefix=$install_dir \ |
---|
| 107 | --enable-fortran \ |
---|
| 108 | --enable-parallel \ |
---|
| 109 | --with-zlib=$install_dir \ |
---|
| 110 | --with-pic 2>&1 | tee $APP.config.log |
---|
| 111 | make 2>&1 | tee $APP.make.log |
---|
| 112 | #make check 2>&1 | tee $APP.make_check.log |
---|
| 113 | make install 2>&1 | tee $APP.install.log |
---|
| 114 | |
---|
| 115 | # NetCDF4 |
---|
| 116 | APP=netcdf-4.3.3.1 |
---|
| 117 | NETCDF4_PATH=$install_dir/$APP |
---|
| 118 | rm -rf $NETCDF4_PATH |
---|
| 119 | cd $install_dir/src |
---|
| 120 | rm -rf netcdf-4.3.3.1* |
---|
| 121 | #wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.3.3.1.tar.gz |
---|
| 122 | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.3.3.1.tar.gz |
---|
| 123 | tar xzf netcdf-4.3.3.1.tar.gz ; cd netcdf-4.3.3.1 |
---|
| 124 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 125 | export CFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 126 | export LD_LIBRARY_PATH="${install_dir}/lib:${LD_LIBRARY_PATH}" |
---|
| 127 | CC=mpicc ./configure \ |
---|
| 128 | --prefix=${install_dir} \ |
---|
| 129 | --enable-static \ |
---|
| 130 | --enable-shared \ |
---|
| 131 | --enable-netcdf4 \ |
---|
| 132 | --enable-dap \ |
---|
| 133 | --with-pic 2>&1 | tee $APP.config.log |
---|
| 134 | make 2>&1 | tee $APP.make.log |
---|
| 135 | make check 2>&1 | tee $APP.make_check.log |
---|
| 136 | make install 2>&1 | tee $APP.install.log |
---|
| 137 | |
---|
| 138 | # NetCDF4-Fortran |
---|
| 139 | APP=netcdf-fortran-4.4.2 |
---|
| 140 | NETCDF4_FORTRAN_PATH=${install_dir}/$APP |
---|
| 141 | rm -rf $NETCDF4_FORTRAN_PATH |
---|
| 142 | cd ${install_dir}/src |
---|
| 143 | rm -rf netcdf-fortran-4.4.2* |
---|
| 144 | #wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.4.2.tar.gz |
---|
| 145 | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-fortran-4.4.2.tar.gz |
---|
| 146 | tar xzf netcdf-fortran-4.4.2.tar.gz ; cd netcdf-fortran-4.4.2 |
---|
| 147 | #export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH} |
---|
| 148 | export LDFLAGS="-L${install_dir}/lib -L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 149 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 150 | export CC=mpicc |
---|
| 151 | export FC=mpif90 |
---|
| 152 | export F77=mpif77 |
---|
| 153 | export LDFLAGS=-L${install_dir}/lib |
---|
| 154 | ./configure \ |
---|
| 155 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 156 | make 2>&1 | tee $APP.make.log |
---|
| 157 | make check 2>&1 | tee $APP.make_check.log |
---|
| 158 | make install 2>&1 | tee $APP.install.log |
---|
| 159 | |
---|
| 160 | # NetCDF4-C++ |
---|
| 161 | APP=netcdf-cxx4-4.2.1 |
---|
| 162 | NETCDF4_CXX_PATH=${install_dir}/$APP |
---|
| 163 | rm -rf $NETCDF4_CXX_PATH |
---|
| 164 | cd ${install_dir}/src |
---|
| 165 | rm -rf netcdf-cxx4-4.2.1* |
---|
| 166 | #wget https://github.com/Unidata/netcdf-cxx4/archive/v4.2.1.tar.gz |
---|
| 167 | #mv v4.2.1.tar.gz netcdf-cxx4-4.2.1.tar.gz |
---|
| 168 | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-cxx4-4.2.1.tar.gz |
---|
| 169 | tar xzf netcdf-cxx4-4.2.1.tar.gz ; cd netcdf-cxx4-4.2.1 |
---|
| 170 | #export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH} |
---|
| 171 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 172 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 173 | export CC=mpicc |
---|
| 174 | export CXX=mpiCC |
---|
| 175 | export LDFLAGS=-L${install_dir}/lib |
---|
| 176 | ./configure \ |
---|
| 177 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 178 | make 2>&1 | tee $APP.make.log |
---|
| 179 | make check 2>&1 | tee $APP.make_check.log |
---|
| 180 | make install 2>&1 | tee $APP.install.log |
---|