#!/bin/bash

opt_make=
opt_make='CFLAGS_HARDENED="" EMBREE_BINDIST=0 AES_CFLAGS=""'

git clone https://gitlab.com/meso-star/star-build.git
cd star-build


echo 1. Compulation de stardis
echo =========================
make  $opt_make PREFIX=stardis  BUILD=src/therm-apps/stardis_0.12.sh > out.stardis.$$ 2>&1
if [ $? != 0 ] ; then
    echo echec
    echo resultats dans $PWD/out.stardis.$$
    exit
fi

echo 2. Compulation de star-meteo
echo ============================
make  $opt_make PREFIX=stardis  BUILD=src/therm-libs/star-meteo_0.0.sh  > out.starmeteo.$$ 2>&1
if [ $? != 0 ] ; then
    echo echec
    echo resultats dans $PWD/out.starmeteo.$$
    exit
fi

echo 3. Clone et installation de star-meteo
echo ======================================
git clone https://gitlab.com/meso-star/star-meteo.git
cd star-meteo
source ../stardis/etc/profile
if [ $? !=0 ] ; then
    echo echec git clone
    exit
fi

echo 4. Compilation de star-meteo
echo =========================
make $opt_make all > out.makeall.$$ 2>&1 &
if [ $? !=0 ] ; then
    echo echec compilation meteo-star, log in $PWD/out.makeall.$$
    exit
fi

echo 5. lancement du test
echo ====================
make $opt_make test
echo Resultats sur $PWD

exit

# man stardis
# man smeteo
# man 5 smeteo
# man 3 libstardis_smeteo

