#!/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 Affero 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # declare DIRBUILD="/opt/build/" if [[ -n "$1" ]] then DIRBUILD="$1" fi declare LOGFILE="${DIRBUILD}/build.log" function chrashed() { echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" >> $LOGFILE exit 2 } function msg_info() { echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" >> $LOGFILE } trap chrashed EXIT msg_info "CREATE BUILD DIRECTORY" mkdir -p ${DIRBUILD}/ || exit 2 if [[ -f ${DIRBUILD}/envi.sh ]] then msg_info "LOAD ENVIRONMENT" source ${DIRBUILD}/envi.sh fi msg_info "PREPARE BUILD" cd ${DIRBUILD}; cmake -DWITH_NEL=ON \ -DWITH_STATIC=ON \ -DWITH_STATIC_DRIVERS=ON \ -DWITH_STATIC_EXTERNAL=ON \ -DWITH_SYMBOLS=ON \ -DWITH_LUA52=ON \ -DWITH_RYZOM_PATCH=ON \ -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON \ ${CMAKEOPTS} \ /opt/code 1>>$LOGFILE 2>&1 || exit 2 msg_info "BUILD START" cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2 msg_info "GENERATE PACKAGE" cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2 trap '' EXIT msg_info "BUILD END"