[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) |
---|
[4925] | 19 | [ - |
---|
| 20 | CC compiler ] C compiler to use |
---|
[4405] | 21 | (default: $c_compiler) |
---|
| 22 | [ -FC compiler ] Fortran compiler to use |
---|
| 23 | (default: $f_compiler) |
---|
| 24 | [ -CXX compiler ] C++ compiler to use |
---|
| 25 | (default: $cxx_compiler) |
---|
| 26 | [ -MPI path ] top directory of the MPI library |
---|
| 27 | (default: $mpi_home) |
---|
| 28 | ........fin |
---|
| 29 | exit ;; |
---|
| 30 | "-prefix") install_dir=$2 ; shift ; shift ;; |
---|
| 31 | "-CC") c_compiler=$2 ; shift ; shift ;; |
---|
| 32 | "-FC") f_compiler=$2 ; shift ; shift ;; |
---|
| 33 | "-CXX") cxx_compiler=$2 ; shift ; shift ;; |
---|
| 34 | "-MPI") mpi_home=$2 ; shift ; shift ;; |
---|
| 35 | *) echo "Error, bad argument $1" ; $0 -h ; exit |
---|
| 36 | esac |
---|
| 37 | done |
---|
| 38 | |
---|
| 39 | # Install directory (get full path) |
---|
| 40 | mkdir -p $install_dir |
---|
| 41 | install_dir=$(cd $install_dir ; pwd -P ) |
---|
| 42 | |
---|
| 43 | # Install location for packages |
---|
| 44 | mkdir -p $install_dir/src |
---|
| 45 | |
---|
[4925] | 46 | allow_arg_mismatch="" |
---|
| 47 | if [[ ${f_compiler} == "gfortran" ]] ; then |
---|
| 48 | if [ `gfortran -dumpversion | cut -d. -f1` -ge 10 ] ; then |
---|
| 49 | allow_arg_mismatch="-fallow-argument-mismatch" |
---|
| 50 | fi |
---|
| 51 | export FFLAGS=" -O2 -fPIC $allow_arg_mismatch" |
---|
| 52 | export FCFLAGS="-O2 -ffree-form -fPIC $allow_arg_mismatch" |
---|
| 53 | export CPPFLAGS="-I${install_dir}/include" |
---|
| 54 | export CFLAGS="-O2 -fPIC" |
---|
| 55 | export CXXFLAGS="-O2 -fPIC" |
---|
| 56 | elif [[ ${f_compiler} == "ifort" ]] ; then |
---|
| 57 | export CPP="icc -E" |
---|
| 58 | export FFLAGS="-O2 -ip -fpic" |
---|
| 59 | export FCFLAGS="-O2 -ip -fpic" |
---|
| 60 | export CPPFLAGS="-I${install_dir}/include" |
---|
| 61 | export CFLAGS="-O2 -ip -fpic" |
---|
| 62 | export CXXFLAGS="-O2 -ip -fpic" |
---|
| 63 | else |
---|
| 64 | echo "unknown compiler $f_compiler" |
---|
| 65 | echo "might as well stop here" |
---|
| 66 | exit |
---|
| 67 | fi |
---|
| 68 | |
---|
[4405] | 69 | # CURL |
---|
| 70 | APP=curl-7.26.0 |
---|
| 71 | CURL_PATH=$install_dir/$APP |
---|
| 72 | rm -rf $CURL_PATH |
---|
| 73 | cd $install_dir/src |
---|
| 74 | rm -rf curl-7.26.0* |
---|
[4417] | 75 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/curl-7.26.0.tar.gz |
---|
[4405] | 76 | tar xvf curl-7.26.0.tar.gz ; cd curl-7.26.0 |
---|
| 77 | export CC=$c_compiler |
---|
| 78 | ./configure \ |
---|
| 79 | --prefix=$install_dir | tee $APP.config.log |
---|
| 80 | make 2>&1 | tee $APP.make.log |
---|
| 81 | make install 2>&1 | tee $APP.install.log |
---|
| 82 | |
---|
| 83 | # ZLIB |
---|
| 84 | APP=zlib-1.2.8 |
---|
| 85 | ZLIB_PATH=$install_dir/$APP |
---|
| 86 | rm -rf $ZLIB_PATH |
---|
| 87 | cd $install_dir/src |
---|
| 88 | rm -rf zlib-1.2.8* |
---|
[4417] | 89 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/zlib-1.2.8.tar.gz |
---|
[4405] | 90 | tar zxf zlib-1.2.8.tar.gz ; cd zlib-1.2.8 |
---|
| 91 | export CC=$c_compiler |
---|
| 92 | export FC=$f_compiler |
---|
| 93 | export CXX=$cxx_compiler |
---|
| 94 | ./configure \ |
---|
| 95 | --prefix=$install_dir | tee $APP.config.log |
---|
| 96 | make 2>&1 | tee $APP.make.log |
---|
| 97 | make check 2>&1 | tee $APP.make_check.log |
---|
| 98 | make install 2>&1 | tee $APP.install.log |
---|
| 99 | |
---|
| 100 | # HDF5 |
---|
| 101 | APP=hdf5-1.10.7 |
---|
| 102 | HDF5_PATH=$install_dir/$APP |
---|
| 103 | rm -rf $HDF5_PATH |
---|
| 104 | cd $install_dir/src |
---|
| 105 | rm -rf ${APP}* |
---|
[4417] | 106 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/$APP.tar.gz |
---|
[4405] | 107 | tar xzf $APP.tar.gz ; cd $APP |
---|
| 108 | export PATH=$mpi_home/bin:$PATH |
---|
| 109 | if [[ ${LD_LIBRARY_PATH} == '' ]] |
---|
| 110 | then |
---|
| 111 | export LD_LIBRARY_PATH=$mpi_home/lib |
---|
| 112 | else |
---|
| 113 | export LD_LIBRARY_PATH=$mpi_home/lib:${LD_LIBRARY_PATH} |
---|
| 114 | fi |
---|
| 115 | export CFLAGS="-I$mpi_home/include -m64" |
---|
| 116 | export LDFLAGS="-L$mpi_home/lib -lmpi" |
---|
| 117 | export MPI_BIN=$mpi_home/bin |
---|
| 118 | export MPI_SYSCONFIG=$mpi_home/etc |
---|
| 119 | export MPI_FORTRAN_MOD_DIR=$mpi_home/lib |
---|
| 120 | export MPI_INCLUDE=$mpi_home/include |
---|
| 121 | export MPI_LIB=$mpi_home/lib |
---|
| 122 | export MPI_HOME=$mpi_home |
---|
| 123 | export CC=mpicc |
---|
| 124 | export FC=mpif90 |
---|
| 125 | export CXX=mpiCC |
---|
| 126 | ./configure \ |
---|
| 127 | --prefix=$install_dir \ |
---|
| 128 | --enable-fortran \ |
---|
| 129 | --enable-parallel \ |
---|
| 130 | --with-zlib=$install_dir \ |
---|
| 131 | --with-pic 2>&1 | tee $APP.config.log |
---|
| 132 | make 2>&1 | tee $APP.make.log |
---|
| 133 | #make check 2>&1 | tee $APP.make_check.log |
---|
| 134 | make install 2>&1 | tee $APP.install.log |
---|
| 135 | |
---|
| 136 | # NetCDF4 |
---|
| 137 | APP=netcdf-4.3.3.1 |
---|
| 138 | NETCDF4_PATH=$install_dir/$APP |
---|
| 139 | rm -rf $NETCDF4_PATH |
---|
| 140 | cd $install_dir/src |
---|
| 141 | rm -rf netcdf-4.3.3.1* |
---|
[4417] | 142 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-4.3.3.1.tar.gz |
---|
[4405] | 143 | tar xzf netcdf-4.3.3.1.tar.gz ; cd netcdf-4.3.3.1 |
---|
| 144 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 145 | export CFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 146 | export LD_LIBRARY_PATH="${install_dir}/lib:${LD_LIBRARY_PATH}" |
---|
| 147 | CC=mpicc ./configure \ |
---|
| 148 | --prefix=${install_dir} \ |
---|
| 149 | --enable-static \ |
---|
| 150 | --enable-shared \ |
---|
| 151 | --enable-netcdf4 \ |
---|
| 152 | --enable-dap \ |
---|
| 153 | --with-pic 2>&1 | tee $APP.config.log |
---|
| 154 | make 2>&1 | tee $APP.make.log |
---|
| 155 | make check 2>&1 | tee $APP.make_check.log |
---|
| 156 | make install 2>&1 | tee $APP.install.log |
---|
| 157 | |
---|
| 158 | # NetCDF4-Fortran |
---|
| 159 | APP=netcdf-fortran-4.4.2 |
---|
| 160 | NETCDF4_FORTRAN_PATH=${install_dir}/$APP |
---|
| 161 | rm -rf $NETCDF4_FORTRAN_PATH |
---|
| 162 | cd ${install_dir}/src |
---|
| 163 | rm -rf netcdf-fortran-4.4.2* |
---|
[4417] | 164 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-fortran-4.4.2.tar.gz |
---|
[4405] | 165 | tar xzf netcdf-fortran-4.4.2.tar.gz ; cd netcdf-fortran-4.4.2 |
---|
| 166 | #export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH} |
---|
| 167 | export LDFLAGS="-L${install_dir}/lib -L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 168 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 169 | export CC=mpicc |
---|
| 170 | export FC=mpif90 |
---|
| 171 | export F77=mpif77 |
---|
| 172 | export LDFLAGS=-L${install_dir}/lib |
---|
| 173 | ./configure \ |
---|
| 174 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 175 | make 2>&1 | tee $APP.make.log |
---|
| 176 | make check 2>&1 | tee $APP.make_check.log |
---|
| 177 | make install 2>&1 | tee $APP.install.log |
---|
| 178 | |
---|
| 179 | # NetCDF4-C++ |
---|
| 180 | APP=netcdf-cxx4-4.2.1 |
---|
| 181 | NETCDF4_CXX_PATH=${install_dir}/$APP |
---|
| 182 | rm -rf $NETCDF4_CXX_PATH |
---|
| 183 | cd ${install_dir}/src |
---|
| 184 | rm -rf netcdf-cxx4-4.2.1* |
---|
[4417] | 185 | wget -nv --no-check-certificate http://lmdz.lmd.jussieu.fr/pub/src_archives/netcdf/netcdf-cxx4-4.2.1.tar.gz |
---|
[4405] | 186 | tar xzf netcdf-cxx4-4.2.1.tar.gz ; cd netcdf-cxx4-4.2.1 |
---|
| 187 | #export LD_LIBRARY_PATH=${install_dir}/lib:${LD_LIBRARY_PATH} |
---|
| 188 | export LDFLAGS="-L${install_dir}/lib -L${mpi_home}/lib -lmpi" |
---|
| 189 | export CPPFLAGS="-I${install_dir}/include/curl -I${install_dir}/include" |
---|
| 190 | export CC=mpicc |
---|
| 191 | export CXX=mpiCC |
---|
| 192 | export LDFLAGS=-L${install_dir}/lib |
---|
| 193 | ./configure \ |
---|
| 194 | --prefix=${install_dir} 2>&1 | tee $APP.config.log |
---|
| 195 | make 2>&1 | tee $APP.make.log |
---|
| 196 | make check 2>&1 | tee $APP.make_check.log |
---|
| 197 | make install 2>&1 | tee $APP.install.log |
---|