[4102] | 1 | #!/bin/bash |
---|
| 2 | # -- |
---|
| 3 | ## SVN information |
---|
[6065] | 4 | # $Author$ |
---|
| 5 | # $Date$ |
---|
| 6 | # $Revision$ |
---|
| 7 | # $Id$ |
---|
| 8 | # $HeadURL$ |
---|
[4102] | 9 | # |
---|
[6190] | 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 | ## |
---|
[4102] | 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 |
---|
[6043] | 37 | fcm_version=OLD |
---|
[6065] | 38 | |
---|
[6235] | 39 | while (( ${#} > 0 )) ; do |
---|
[4102] | 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 :" |
---|
[4259] | 45 | echo " [--xios path] : path to XIOS. Default is ${xios_dir}" |
---|
[4102] | 46 | echo " [--full] : to generate dependencies and recompile from scratch" |
---|
[6043] | 47 | echo " [--fcm] : fcm version compatibility : 'new'/'old'/'OLD'/'NEW'" |
---|
[4102] | 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 ;; |
---|
[6043] | 53 | "--fcm") fcm_version=${2^^} ; shift ; shift ;; |
---|
[4102] | 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 |
---|
[5926] | 68 | ln -fs ${xios_dir}/arch.fcm . |
---|
[4102] | 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 |
---|
[4259] | 84 | |
---|
[4102] | 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 | |
---|
[6235] | 90 | if [[ -d ${xios_dir}/tools/FCM ]] ; then |
---|
| 91 | export PATH=${xios_dir}/tools/FCM/bin:${PATH} |
---|
| 92 | else |
---|
| 93 | export PATH=${xios_dir}/tools/FCM_${fcm_version}/bin:${PATH} |
---|
| 94 | fi |
---|
[4102] | 95 | |
---|
| 96 | source ${install_dir}/arch.env |
---|
| 97 | source ${install_dir}/arch.path |
---|
| 98 | |
---|
| 99 | if [[ "${compil_full}" == "true" ]] |
---|
| 100 | then |
---|
| 101 | fcm build --clean --ignore-lock |
---|
| 102 | fcm build -f --ignore-lock |
---|
| 103 | else |
---|
| 104 | fcm build --ignore-lock |
---|
| 105 | fi |
---|
| 106 | |
---|
| 107 | build_exit_status=${?} |
---|
| 108 | |
---|
| 109 | if [[ ${build_exit_status} == 0 ]] |
---|
| 110 | then |
---|
| 111 | set nothing |
---|
| 112 | fi |
---|
| 113 | |
---|
| 114 | echo PATH : ${PATH} |
---|
| 115 | echo fcm : $(which fcm) |
---|
| 116 | |
---|
| 117 | exit ${build_exit_status} |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|