[2052] | 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="/cm/shared/apps/netcdf/gcc/64/4.1.1" |
---|
| 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 | netcdf_include="$NETCDFINCLUDE" |
---|
| 15 | netcdf_lib="$NETCDFDIR" |
---|
| 16 | echo $netcdf_include |
---|
| 17 | echo $netcdf_lib |
---|
| 18 | |
---|
| 19 | whereami=`pwd -P` |
---|
| 20 | |
---|
| 21 | # 1. Get IOIPSL (via modipsl) |
---|
| 22 | svn co http://forge.ipsl.jussieu.fr/igcmg/svn/modipsl/trunk modipsl |
---|
| 23 | cd modipsl/util |
---|
| 24 | |
---|
[2190] | 25 | # make all refs to ksh become refs to bash |
---|
| 26 | for i in ins_m_prec model script_diff_model script_log_analyse script_recup_model |
---|
| 27 | do |
---|
| 28 | sed -i -e s:'#!/bin/ksh':'#!/bin/bash':1 $i |
---|
| 29 | done |
---|
[2052] | 30 | ./model IOIPSL_PLUS |
---|
| 31 | |
---|
| 32 | # 2. Set correct settings: |
---|
| 33 | # modify path to netcdf in 'AA_make.gdef' |
---|
| 34 | cp AA_make.gdef AA_make.gdef.old |
---|
| 35 | sed -e s:"gfortran NCDF_INC = /usr/local/include":"gfortran NCDF_INC = ${netcdf_include}":1 \ |
---|
| 36 | -e s:"gfortran NCDF_LIB = -L/usr/local/lib -lnetcdf":"gfortran NCDF_LIB = -L${netcdf_lib} -lnetcdf -lnetcdff":1 \ |
---|
| 37 | AA_make.gdef.old > AA_make.gdef |
---|
| 38 | |
---|
| 39 | # set default working precision for IOIPSL: |
---|
| 40 | ./ins_make -t gfortran -p I4R8 |
---|
| 41 | |
---|
| 42 | ## 3. build ioipsl: |
---|
| 43 | cd ../modeles/IOIPSL/src |
---|
[2190] | 44 | # make all refs to ksh become refs to bash |
---|
| 45 | for i in AA_make.ldef Makefile |
---|
| 46 | do |
---|
| 47 | sed -i -e s:'/bin/ksh':'/bin/bash':1 $i |
---|
| 48 | done |
---|
[2052] | 49 | make |
---|
| 50 | ## Compile the rebuild tool: |
---|
| 51 | cd ../tools |
---|
[2190] | 52 | for i in AA_make.ldef Makefile rebuild |
---|
| 53 | do |
---|
| 54 | sed -i -e s:'/bin/ksh':'/bin/bash':1 $i |
---|
| 55 | done |
---|
[2052] | 56 | make |
---|
| 57 | |
---|
| 58 | if [[ -f ${whereami}/modipsl/lib/libioipsl.a ]] |
---|
| 59 | then |
---|
| 60 | echo "OK: ioipsl library is in ${whereami}/modipsl/lib" |
---|
| 61 | else |
---|
| 62 | echo "Something went wrong..." |
---|
| 63 | fi |
---|
| 64 | |
---|