1 | #!/bin/bash |
---|
2 | # -- |
---|
3 | ## SVN information |
---|
4 | # $Author: $ |
---|
5 | # $Date: $ |
---|
6 | # $Revision: $ |
---|
7 | # $Id: $ |
---|
8 | # $HeadURL: $ |
---|
9 | # |
---|
10 | |
---|
11 | # Default values for command line parameters |
---|
12 | install_dir=${PWD} |
---|
13 | xios_dir="$(realpath ../XIOS)" |
---|
14 | compil_full=false |
---|
15 | |
---|
16 | # Traitement de la ligne de commande |
---|
17 | fcm_version=OLD |
---|
18 | while ((${#} > 0)) ; do |
---|
19 | case ${1} in |
---|
20 | "-h"|"--help"|"-help") |
---|
21 | echo "make_mosaix - installs MOSAIX on your architecture" |
---|
22 | echo "make_xios [options]" |
---|
23 | echo "options :" |
---|
24 | echo " [--xios path] : path to XIOS. Default is ${xios_dir}" |
---|
25 | echo " [--full] : to generate dependencies and recompile from scratch" |
---|
26 | echo " [--fcm] : fcm version compatibility : 'new'/'old'/'OLD'/'NEW'" |
---|
27 | echo "Example : ./make_mosaix --xios ../XIOS" |
---|
28 | exit |
---|
29 | ;; |
---|
30 | "--xios") xios_dir=$(realpath ${2}) ; xios_path_defined="TRUE"; shift ; shift ;; |
---|
31 | "--full") compil_full="true" ; shift ;; |
---|
32 | "--fcm") fcm_version=${2^^} ; shift ; shift ;; |
---|
33 | esac |
---|
34 | done |
---|
35 | |
---|
36 | |
---|
37 | # Definition of the root directory of the build |
---|
38 | install_dir=${PWD} |
---|
39 | |
---|
40 | rm -f ${PWD}/bld_dir.cfg |
---|
41 | |
---|
42 | echo "inc ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg |
---|
43 | echo "inc ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg |
---|
44 | echo "dir::root ${install_dir}" >> ${PWD}/bld_dir.cfg |
---|
45 | |
---|
46 | # Use the arch files used to compile XIOS |
---|
47 | ln -fs ${xios_dir}/arch.fcm . |
---|
48 | ln -fs ${xios_dir}/arch.env . |
---|
49 | ln -fs ${xios_dir}/arch.path . |
---|
50 | |
---|
51 | rm -f .void_file |
---|
52 | echo > .void_file |
---|
53 | rm -rf .void_dir |
---|
54 | mkdir .void_dir |
---|
55 | |
---|
56 | |
---|
57 | XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
58 | XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
59 | XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
60 | |
---|
61 | # Use config.fcm from XIOS |
---|
62 | rm -f ${install_dir}/config.fcm |
---|
63 | |
---|
64 | echo "%XIOS_DIR ${xios_dir} " > ${install_dir}/config.fcm |
---|
65 | cat ${xios_dir}/config.fcm >> ${install_dir}/config.fcm |
---|
66 | |
---|
67 | make_dir=${PWD} |
---|
68 | |
---|
69 | export PATH=${xios_dir}/tools/FCM_${fcm_version}/bin:${PATH} |
---|
70 | |
---|
71 | source ${install_dir}/arch.env |
---|
72 | source ${install_dir}/arch.path |
---|
73 | |
---|
74 | if [[ "${compil_full}" == "true" ]] |
---|
75 | then |
---|
76 | fcm build --clean --ignore-lock |
---|
77 | fcm build -f --ignore-lock |
---|
78 | else |
---|
79 | fcm build --ignore-lock |
---|
80 | fi |
---|
81 | |
---|
82 | build_exit_status=${?} |
---|
83 | |
---|
84 | if [[ ${build_exit_status} == 0 ]] |
---|
85 | then |
---|
86 | set nothing |
---|
87 | fi |
---|
88 | |
---|
89 | echo PATH : ${PATH} |
---|
90 | echo fcm : $(which fcm) |
---|
91 | |
---|
92 | exit ${build_exit_status} |
---|
93 | |
---|
94 | |
---|
95 | |
---|