File indexing completed on 2024-04-21 05:44:07

0001 #!/bin/sh
0002 set -e
0003 set -x
0004 
0005 
0006 
0007 #SCRIPTDIR=$(dirname $(readlink -f "$0"))
0008 
0009 case "$(uname -s)" in
0010 
0011    Darwin)
0012      echo 'Mac OS X'
0013      readlinkf(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";}
0014      SCRIPTDIR=$(dirname $(readlinkf "$0"))
0015      ;;
0016 
0017    # taken from: https://en.wikipedia.org/wiki/Uname
0018    Linux|*BSD)
0019      echo 'Linux'
0020      SCRIPTDIR=$(dirname $(readlink -f "$0"))
0021      ;;
0022 
0023    CYGWIN*|MINGW32*|MSYS*)
0024      echo 'MS Windows'
0025      SCRIPTDIR=$(dirname $(readlink -f "$0")) # untested
0026      ;;
0027 
0028    # Add here more strings to compare
0029    #
0030 
0031    *)
0032      echo 'other OS, please notify the developers'
0033      SCRIPTDIR=$(dirname $(readlink -f "$0")) # untested
0034      ;;
0035 esac
0036 
0037 LOGFILE="$SCRIPTDIR/build-simple.log"
0038 
0039 log_cmd() {
0040     "$@" 2>&1  | tee -a "$LOGFILE"
0041 }
0042 
0043 log_cmd echo "== starting build at $( date ) == "
0044 
0045 (
0046     mkdir -p "$SCRIPTDIR/build-simple/"
0047     cd "$SCRIPTDIR/build-simple/"
0048 
0049     if [ -f "$SCRIPTDIR/build-simple/Makefile" ] ; then
0050         echo "buildsystem generated, using it"
0051     else
0052         echo "buildsystem being generated"
0053 
0054         log_cmd cmake -DCMAKE_INSTALL_PREFIX="$SCRIPTDIR/inst-simple/" "$SCRIPTDIR"
0055     fi
0056 
0057 #     # bug in buildsystem: generated header files are not always built; work it around
0058 # 
0059 #     UI_HEADERS_TO_GENERATE="
0060 #         ./src/gui/ui_contexthelpwidget.h
0061 #         ./src/gui/ui_generaloptionswidget.h
0062 #         ./src/gui/ui_linkeroptionswidget.h
0063 #         ./src/gui/ui_processingoptionswidget.h
0064 #         ./src/gui/ui_programmerwidget.h
0065 #         ./src/gui/ui_gpasmsettingswidget.h
0066 #         ./src/gui/ui_newprojectwidget.h
0067 #         ./src/gui/ui_newfilewidget.h
0068 #         ./src/gui/ui_outputmethodwidget.h
0069 #         ./src/gui/ui_scopescreenwidget.h
0070 #         ./src/gui/ui_createsubprojectwidget.h
0071 #         ./src/gui/ui_asmformattingwidget.h
0072 #         ./src/gui/ui_oscilloscopewidget.h
0073 #         ./src/gui/ui_microsettingswidget.h
0074 #         ./src/gui/ui_newpinmappingwidget.h
0075 #         ./src/gui/ui_logicwidget.h
0076 #         ./src/gui/ui_sdccoptionswidget.h
0077 #         ./src/gui/ui_picprogrammerconfigwidget.h
0078 #         ./src/gui/ui_gplinksettingswidget.h
0079 #         "
0080 #     for HEADER in $UI_HEADERS_TO_GENERATE ; do
0081 #         make -f src/gui/CMakeFiles/gui.dir/build.make "$HEADER"
0082 #     done
0083 # 
0084 #     # work around the bug: core directory has to be built first
0085 #     # ./src/core/ktlconfig.h
0086 #     log_cmd make -C "$SCRIPTDIR/build-simple/src/core"
0087 
0088     log_cmd make install -j2
0089 )