1#!/bin/sh 2set -e 3set -x 4 5 6 7#SCRIPTDIR=$(dirname $(readlink -f "$0")) 8 9case "$(uname -s)" in 10 11 Darwin) 12 echo 'Mac OS X' 13 readlinkf(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";} 14 SCRIPTDIR=$(dirname $(readlinkf "$0")) 15 ;; 16 17 # taken from: https://en.wikipedia.org/wiki/Uname 18 Linux|*BSD) 19 echo 'Linux' 20 SCRIPTDIR=$(dirname $(readlink -f "$0")) 21 ;; 22 23 CYGWIN*|MINGW32*|MSYS*) 24 echo 'MS Windows' 25 SCRIPTDIR=$(dirname $(readlink -f "$0")) # untested 26 ;; 27 28 # Add here more strings to compare 29 # 30 31 *) 32 echo 'other OS, please notify the developers' 33 SCRIPTDIR=$(dirname $(readlink -f "$0")) # untested 34 ;; 35esac 36 37LOGFILE="$SCRIPTDIR/build-simple.log" 38 39log_cmd() { 40 "$@" 2>&1 | tee -a "$LOGFILE" 41} 42 43log_cmd echo "== starting build at $( date ) == " 44 45( 46 mkdir -p "$SCRIPTDIR/build-simple/" 47 cd "$SCRIPTDIR/build-simple/" 48 49 if [ -f "$SCRIPTDIR/build-simple/Makefile" ] ; then 50 echo "buildsystem generated, using it" 51 else 52 echo "buildsystem being generated" 53 54 log_cmd cmake -DCMAKE_INSTALL_PREFIX="$SCRIPTDIR/inst-simple/" "$SCRIPTDIR" 55 fi 56 57# # bug in buildsystem: generated header files are not always built; work it around 58# 59# UI_HEADERS_TO_GENERATE=" 60# ./src/gui/ui_contexthelpwidget.h 61# ./src/gui/ui_generaloptionswidget.h 62# ./src/gui/ui_linkeroptionswidget.h 63# ./src/gui/ui_processingoptionswidget.h 64# ./src/gui/ui_programmerwidget.h 65# ./src/gui/ui_gpasmsettingswidget.h 66# ./src/gui/ui_newprojectwidget.h 67# ./src/gui/ui_newfilewidget.h 68# ./src/gui/ui_outputmethodwidget.h 69# ./src/gui/ui_scopescreenwidget.h 70# ./src/gui/ui_createsubprojectwidget.h 71# ./src/gui/ui_asmformattingwidget.h 72# ./src/gui/ui_oscilloscopewidget.h 73# ./src/gui/ui_microsettingswidget.h 74# ./src/gui/ui_newpinmappingwidget.h 75# ./src/gui/ui_logicwidget.h 76# ./src/gui/ui_sdccoptionswidget.h 77# ./src/gui/ui_picprogrammerconfigwidget.h 78# ./src/gui/ui_gplinksettingswidget.h 79# " 80# for HEADER in $UI_HEADERS_TO_GENERATE ; do 81# make -f src/gui/CMakeFiles/gui.dir/build.make "$HEADER" 82# done 83# 84# # work around the bug: core directory has to be built first 85# # ./src/core/ktlconfig.h 86# log_cmd make -C "$SCRIPTDIR/build-simple/src/core" 87 88 log_cmd make install -j2 89) 90