khanat-code-old/dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh
2017-09-11 21:53:03 +02:00

53 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# Script to build Khaganat binary (executed in docker)
#
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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