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 | while ((${#} > 0)) ; do |
---|
18 | case ${1} in |
---|
19 | "-h"|"--help"|"-help") |
---|
20 | echo "make_mosaix - installs MOSAIX on your architecture" |
---|
21 | echo "make_xios [options]" |
---|
22 | echo "options :" |
---|
23 | echo " [--xios path] : path to XIOS. Default is ../XIOS" |
---|
24 | echo " [--full] : to generate dependencies and recompile from scratch" |
---|
25 | echo "Example : ./make_mosaix --xios ../XIOS" |
---|
26 | exit |
---|
27 | ;; |
---|
28 | "--xios") xios_dir=$(realpath ${2}) ; xios_path_defined="TRUE"; shift ; shift ;; |
---|
29 | "--full") compil_full="true" ; shift ;; |
---|
30 | esac |
---|
31 | done |
---|
32 | |
---|
33 | |
---|
34 | # Definition of the root directory of the build |
---|
35 | install_dir=${PWD} |
---|
36 | |
---|
37 | rm -f ${PWD}/bld_dir.cfg |
---|
38 | |
---|
39 | echo "inc ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg |
---|
40 | echo "inc ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg |
---|
41 | echo "dir::root ${install_dir}" >> ${PWD}/bld_dir.cfg |
---|
42 | |
---|
43 | # Use the arch files used to compile XIOS |
---|
44 | ln -fs ${xios_dir}/arch.fcm . |
---|
45 | ln -fs ${xios_dir}/arch.env . |
---|
46 | ln -fs ${xios_dir}/arch.path . |
---|
47 | |
---|
48 | rm -f .void_file |
---|
49 | echo > .void_file |
---|
50 | rm -rf .void_dir |
---|
51 | mkdir .void_dir |
---|
52 | |
---|
53 | |
---|
54 | XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
55 | XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
56 | XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
57 | |
---|
58 | # Use config.fcm from XIOS |
---|
59 | rm -f ${install_dir}/config.fcm |
---|
60 | #cp ${xios_dir}/config.fcm ${install_dir} |
---|
61 | echo "%XIOS_DIR ${xios_dir} " > ${install_dir}/config.fcm |
---|
62 | cat ${xios_dir}/config.fcm >> ${install_dir}/config.fcm |
---|
63 | |
---|
64 | make_dir=${PWD} |
---|
65 | |
---|
66 | export PATH=${xios_dir}/tools/FCM/bin:${PATH} |
---|
67 | |
---|
68 | source ${install_dir}/arch.env |
---|
69 | source ${install_dir}/arch.path |
---|
70 | |
---|
71 | if [[ "${compil_full}" == "true" ]] |
---|
72 | then |
---|
73 | fcm build --clean --ignore-lock |
---|
74 | fcm build -f --ignore-lock |
---|
75 | else |
---|
76 | fcm build --ignore-lock |
---|
77 | fi |
---|
78 | |
---|
79 | build_exit_status=${?} |
---|
80 | |
---|
81 | if [[ ${build_exit_status} == 0 ]] |
---|
82 | then |
---|
83 | set nothing |
---|
84 | fi |
---|
85 | |
---|
86 | echo PATH : ${PATH} |
---|
87 | echo fcm : $(which fcm) |
---|
88 | |
---|
89 | exit ${build_exit_status} |
---|
90 | |
---|
91 | |
---|
92 | |
---|