[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* |
---|
[4417] | 51 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/curl-7.26.0.tar.gz |
---|
[4405] | 52 | tar xvf curl-7.26.0.tar.gz ; cd curl-7.26.0 |
---|
| 53 | export CC=$c_compiler |
---|
| 54 | ./configure \ |
---|
| 55 | --prefix=$install_dir | tee $APP.config.log |
---|
| 56 | make 2>&1 | tee $APP.make.log |
---|
| 57 | make install 2>&1 | tee $APP.install.log |
---|
| 58 | |
---|
| 59 | # ZLIB |
---|
| 60 | APP=zlib-1.2.8 |
---|
| 61 | ZLIB_PATH=$install_dir/$APP |
---|
| 62 | rm -rf $ZLIB_PATH |
---|
| 63 | cd $install_dir/src |
---|
| 64 | rm -rf zlib-1.2.8* |
---|
[4417] | 65 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/zlib-1.2.8.tar.gz |
---|
[4405] | 66 | tar zxf zlib-1.2.8.tar.gz ; cd zlib-1.2.8 |
---|
| 67 | export CC=$c_compiler |
---|
| 68 | export FC=$f_compiler |
---|
| 69 | export CXX=$cxx_compiler |
---|
| 70 | ./configure \ |
---|
| 71 | --prefix=$install_dir | tee $APP.config.log |
---|
| 72 | make 2>&1 | tee $APP.make.log |
---|
| 73 | make check 2>&1 | tee $APP.make_check.log |
---|
| 74 | make install 2>&1 | tee $APP.install.log |
---|
| 75 | |
---|
| 76 | # HDF5 |
---|
| 77 | APP=hdf5-1.10.7 |
---|
| 78 | HDF5_PATH=$install_dir/$APP |
---|
| 79 | rm -rf $HDF5_PATH |
---|
| 80 | cd $install_dir/src |
---|
| 81 | rm -rf ${APP}* |
---|
[4417] | 82 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/$APP.tar.gz |
---|
[4405] | 83 | tar xzf $APP.tar.gz ; cd $APP |
---|
| 84 | export PATH=$mpi_home/bin:$PATH |
---|
| 85 | if [[ ${LD_LIBRARY_PATH} == '' ]] |
---|
| 86 | then |
---|
| 87 | export LD_LIBRARY_PATH=$mpi_home/lib |
---|
| 88 | else |
---|
| 89 | export LD_LIBRARY_PATH=$mpi_home/lib:${LD_LIBRARY_PATH} |
---|
| 90 | fi |
---|
| 91 | export CFLAGS="-I$mpi_home/include -m64" |
---|
| 92 | export LDFLAGS="-L$mpi_home/lib -lmpi" |
---|
| 93 | export MPI_BIN=$mpi_home/bin |
---|
| 94 | export MPI_SYSCONFIG=$mpi_home/etc |
---|
| 95 | export MPI_FORTRAN_MOD_DIR=$mpi_home/lib |
---|
| 96 | export MPI_INCLUDE=$mpi_home/include |
---|
| 97 | export MPI_LIB=$mpi_home/lib |
---|
| 98 | export MPI_HOME=$mpi_home |
---|
| 99 | export CC=mpicc |
---|
| 100 | export FC=mpif90 |
---|
| 101 | export 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 |
---|
| 108 | make 2>&1 | tee $APP.make.log |
---|
| 109 | #make check 2>&1 | tee $APP.make_check.log |
---|
| 110 | make install 2>&1 | tee $APP.install.log |
---|
| 111 | |
---|
| 112 | # NetCDF4 |
---|
| 113 | APP=netcdf-4.3.3.1 |
---|
| 114 | NETCDF4_PATH=$install_dir/$APP |
---|
| 115 | rm -rf $NETCDF4_PATH |
---|
| 116 | cd $install_dir/src |
---|
| 117 | rm -rf netcdf-4.3.3.1* |
---|
[4417] | 118 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-4.3.3.1.tar.gz |
---|
[4405] | 119 | tar xzf netcdf-4.3.3.1.tar.gz ; cd netcdf-4.3.3.1 |
---|
| 120 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 121 | export CFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 122 | export LD_LIBRARY_PATH="${install_dir}/lib:${LD_LIBRARY_PATH}" |
---|
| 123 | CC=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 |
---|
| 130 | make 2>&1 | tee $APP.make.log |
---|
| 131 | make check 2>&1 | tee $APP.make_check.log |
---|
| 132 | make install 2>&1 | tee $APP.install.log |
---|
| 133 | |
---|
| 134 | # NetCDF4-Fortran |
---|
| 135 | APP=netcdf-fortran-4.4.2 |
---|
| 136 | NETCDF4_FORTRAN_PATH=${install_dir}/$APP |
---|
| 137 | rm -rf $NETCDF4_FORTRAN_PATH |
---|
| 138 | cd ${install_dir}/src |
---|
| 139 | rm -rf netcdf-fortran-4.4.2* |
---|
[4417] | 140 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-fortran-4.4.2.tar.gz |
---|
[4405] | 141 | tar 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} |
---|
| 143 | export LDFLAGS="-L${install_dir}/lib -L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 144 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 145 | export CC=mpicc |
---|
| 146 | export FC=mpif90 |
---|
| 147 | export F77=mpif77 |
---|
| 148 | export LDFLAGS=-L${install_dir}/lib |
---|
| 149 | ./configure \ |
---|
| 150 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 151 | make 2>&1 | tee $APP.make.log |
---|
| 152 | make check 2>&1 | tee $APP.make_check.log |
---|
| 153 | make install 2>&1 | tee $APP.install.log |
---|
| 154 | |
---|
| 155 | # NetCDF4-C++ |
---|
| 156 | APP=netcdf-cxx4-4.2.1 |
---|
| 157 | NETCDF4_CXX_PATH=${install_dir}/$APP |
---|
| 158 | rm -rf $NETCDF4_CXX_PATH |
---|
| 159 | cd ${install_dir}/src |
---|
| 160 | rm -rf netcdf-cxx4-4.2.1* |
---|
[4417] | 161 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-cxx4-4.2.1.tar.gz |
---|
[4405] | 162 | tar 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} |
---|
| 164 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 165 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 166 | export CC=mpicc |
---|
| 167 | export CXX=mpiCC |
---|
| 168 | export LDFLAGS=-L${install_dir}/lib |
---|
| 169 | ./configure \ |
---|
| 170 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 171 | make 2>&1 | tee $APP.make.log |
---|
| 172 | make check 2>&1 | tee $APP.make_check.log |
---|
| 173 | make install 2>&1 | tee $APP.install.log |
---|