1 | #!/bin/bash |
---|
2 | # -- |
---|
3 | ## SVN information |
---|
4 | # $Author$ |
---|
5 | # $Date$ |
---|
6 | # $Revision$ |
---|
7 | # $Id$ |
---|
8 | # $HeadURL$ |
---|
9 | # |
---|
10 | ## MOSAIX s under CeCILL_V2 licence. See "Licence_CeCILL_V2-en.txt" |
---|
11 | ## file for an english version of the licence and |
---|
12 | ## "Licence_CeCILL_V2-fr.txt" for a french version. |
---|
13 | ## |
---|
14 | ## Permission is hereby granted, free of charge, to any person or |
---|
15 | ## organization obtaining a copy of the software and accompanying |
---|
16 | ## documentation covered by this license (the "Software") to use, |
---|
17 | ## reproduce, display, distribute, execute, and transmit the |
---|
18 | ## Software, and to prepare derivative works of the Software, and to |
---|
19 | ## permit third-parties to whom the Software is furnished to do so, |
---|
20 | ## all subject to the following: |
---|
21 | ## |
---|
22 | ## Warning, to install, configure, run, use any of MOSAIX software or |
---|
23 | ## to read the associated documentation you'll need at least one (1) |
---|
24 | ## brain in a reasonably working order. Lack of this implement will |
---|
25 | ## void any warranties (either express or implied). Authors assumes |
---|
26 | ## no responsability for errors, omissions, data loss, or any other |
---|
27 | ## consequences caused directly or indirectly by the usage of his |
---|
28 | ## software by incorrectly or partially configured |
---|
29 | ## |
---|
30 | |
---|
31 | # Default values for command line parameters |
---|
32 | install_dir=${PWD} |
---|
33 | xios_dir="$(realpath ../XIOS)" |
---|
34 | compil_full=false |
---|
35 | |
---|
36 | # Traitement de la ligne de commande |
---|
37 | fcm_version=OLD |
---|
38 | |
---|
39 | while ((${#} > 0)) ; do |
---|
40 | case ${1} in |
---|
41 | "-h"|"--help"|"-help") |
---|
42 | echo "make_mosaix - installs MOSAIX on your architecture" |
---|
43 | echo "make_xios [options]" |
---|
44 | echo "options :" |
---|
45 | echo " [--xios path] : path to XIOS. Default is ${xios_dir}" |
---|
46 | echo " [--full] : to generate dependencies and recompile from scratch" |
---|
47 | echo " [--fcm] : fcm version compatibility : 'new'/'old'/'OLD'/'NEW'" |
---|
48 | echo "Example : ./make_mosaix --xios ../XIOS" |
---|
49 | exit |
---|
50 | ;; |
---|
51 | "--xios") xios_dir=$(realpath ${2}) ; xios_path_defined="TRUE"; shift ; shift ;; |
---|
52 | "--full") compil_full="true" ; shift ;; |
---|
53 | "--fcm") fcm_version=${2^^} ; shift ; shift ;; |
---|
54 | esac |
---|
55 | done |
---|
56 | |
---|
57 | |
---|
58 | # Definition of the root directory of the build |
---|
59 | install_dir=${PWD} |
---|
60 | |
---|
61 | rm -f ${PWD}/bld_dir.cfg |
---|
62 | |
---|
63 | echo "inc ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg |
---|
64 | echo "inc ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg |
---|
65 | echo "dir::root ${install_dir}" >> ${PWD}/bld_dir.cfg |
---|
66 | |
---|
67 | # Use the arch files used to compile XIOS |
---|
68 | ln -fs ${xios_dir}/arch.fcm . |
---|
69 | ln -fs ${xios_dir}/arch.env . |
---|
70 | ln -fs ${xios_dir}/arch.path . |
---|
71 | |
---|
72 | rm -f .void_file |
---|
73 | echo > .void_file |
---|
74 | rm -rf .void_dir |
---|
75 | mkdir .void_dir |
---|
76 | |
---|
77 | |
---|
78 | XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
79 | XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR" |
---|
80 | XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
81 | |
---|
82 | # Use config.fcm from XIOS |
---|
83 | rm -f ${install_dir}/config.fcm |
---|
84 | |
---|
85 | echo "%XIOS_DIR ${xios_dir} " > ${install_dir}/config.fcm |
---|
86 | cat ${xios_dir}/config.fcm >> ${install_dir}/config.fcm |
---|
87 | |
---|
88 | make_dir=${PWD} |
---|
89 | |
---|
90 | export PATH=${xios_dir}/tools/FCM_${fcm_version}/bin:${PATH} |
---|
91 | |
---|
92 | source ${install_dir}/arch.env |
---|
93 | source ${install_dir}/arch.path |
---|
94 | |
---|
95 | if [[ "${compil_full}" == "true" ]] |
---|
96 | then |
---|
97 | fcm build --clean --ignore-lock |
---|
98 | fcm build -f --ignore-lock |
---|
99 | else |
---|
100 | fcm build --ignore-lock |
---|
101 | fi |
---|
102 | |
---|
103 | build_exit_status=${?} |
---|
104 | |
---|
105 | if [[ ${build_exit_status} == 0 ]] |
---|
106 | then |
---|
107 | set nothing |
---|
108 | fi |
---|
109 | |
---|
110 | echo PATH : ${PATH} |
---|
111 | echo fcm : $(which fcm) |
---|
112 | |
---|
113 | exit ${build_exit_status} |
---|
114 | |
---|
115 | |
---|
116 | |
---|