| 1 | #!/bin/bash |
|---|
| 2 | # script to download and install the latest version of IOIPSL |
|---|
| 3 | # using gfortran |
|---|
| 4 | # You'll probably have to change paths to NetCDF library 'lib' and 'include' |
|---|
| 5 | # below to adapt this script to your computer. |
|---|
| 6 | |
|---|
| 7 | setfolder="/planeto/emlmd/netcdf64-4.0.1_gfortran4.4.7" |
|---|
| 8 | #setfolder="/donnees/emlmd/netcdf64-4.0.1_gfortran/" |
|---|
| 9 | |
|---|
| 10 | #0. Preliminary stuff |
|---|
| 11 | # netcdf include and lib dirs: |
|---|
| 12 | netcdf_include=$setfolder"/include" |
|---|
| 13 | netcdf_lib=$setfolder"/lib" |
|---|
| 14 | |
|---|
| 15 | whereami=`pwd -P` |
|---|
| 16 | |
|---|
| 17 | # 1. Get IOIPSL (via modipsl) |
|---|
| 18 | svn co http://forge.ipsl.jussieu.fr/igcmg/svn/modipsl/trunk modipsl |
|---|
| 19 | cd modipsl/util |
|---|
| 20 | |
|---|
| 21 | # make all refs to ksh become refs to bash |
|---|
| 22 | for i in ins_m_prec model script_diff_model script_log_analyse script_recup_model |
|---|
| 23 | do |
|---|
| 24 | sed -e s:'#!/bin/ksh':'#!/bin/bash':1 $i > tmp |
|---|
| 25 | mv -f tmp $i |
|---|
| 26 | done |
|---|
| 27 | chmod u=rwx model |
|---|
| 28 | chmod u=rwx ins_m_prec |
|---|
| 29 | ./model IOIPSL_PLUS |
|---|
| 30 | |
|---|
| 31 | # 2. Set correct settings: |
|---|
| 32 | # modify path to netcdf in 'AA_make.gdef' |
|---|
| 33 | cp AA_make.gdef AA_make.gdef.old |
|---|
| 34 | sed -e s:"gfortran NCDF_INC = /usr/local/include":"gfortran NCDF_INC = ${netcdf_include}":1 \ |
|---|
| 35 | -e s:"gfortran NCDF_LIB = -L/usr/local/lib":"gfortran NCDF_LIB = -L${netcdf_lib}":1 \ |
|---|
| 36 | AA_make.gdef.old > AA_make.gdef |
|---|
| 37 | |
|---|
| 38 | # set default working precision for IOIPSL: |
|---|
| 39 | ./ins_make -t gfortran -p I4R8 |
|---|
| 40 | |
|---|
| 41 | ## 3. build ioipsl: |
|---|
| 42 | cd ../modeles/IOIPSL/src |
|---|
| 43 | # make all refs to ksh become refs to bash |
|---|
| 44 | for i in AA_make.ldef Makefile |
|---|
| 45 | do |
|---|
| 46 | sed -e s:'/bin/ksh':'/bin/bash':1 $i > tmp |
|---|
| 47 | mv -f tmp $i |
|---|
| 48 | done |
|---|
| 49 | make |
|---|
| 50 | ## Compile the rebuild tool: |
|---|
| 51 | cd ../tools |
|---|
| 52 | # make all refs to ksh become refs to bash |
|---|
| 53 | for i in AA_make.ldef Makefile rebuild |
|---|
| 54 | do |
|---|
| 55 | sed -e s:'/bin/ksh':'/bin/bash':1 $i > tmp |
|---|
| 56 | mv -f tmp $i |
|---|
| 57 | done |
|---|
| 58 | chmod u=rwx rebuild |
|---|
| 59 | make |
|---|
| 60 | |
|---|
| 61 | if [[ -f ${whereami}/modipsl/lib/libioipsl.a ]] |
|---|
| 62 | then |
|---|
| 63 | echo "OK: ioipsl library is in ${whereami}/modipsl/lib" |
|---|
| 64 | else |
|---|
| 65 | echo "Something went wrong..." |
|---|
| 66 | fi |
|---|
| 67 | |
|---|