#!/bin/bash # Script to build Khaganat # Copyright : GNU/AGPLv3 # # Created : 1 AUG 2017 # Created by : AleaJactaEst declare DIRBUILD="/opt/code/build/" if [[ -n "$1" ]] then DIRBUILD="$1" fi declare LOGFILE="${DIRBUILD}/build.log" function chrashed() { echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD FAILED (code:$?)" >> $LOGFILE exit 2 } trap chrashed EXIT mkdir -p ${DIRBUILD}/ || exit 2 if [[ -f ${DIRBUILD}/envi.sh ]] then echo "$(date "+%Y/%m/%d %H:%M:%S") LOAD ENVI" >> $LOGFILE source ${DIRBUILD}/envi.sh fi echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD START" >> $LOGFILE cd ${DIRBUILD}; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON ${CMAKEOPTS} ../.. 1>>$LOGFILE 2>&1 || exit 2 cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2 echo "$(date "+%Y/%m/%d %H:%M:%S") PACKAGE" > $LOGFILE cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2 trap '' EXIT echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD END" >> $LOGFILE