Updated build script for enhanced deployment automation.

This commit is contained in:
klayoutmatthias 2017-08-06 22:56:38 +02:00
parent e6642f41f6
commit 592fe08921
7 changed files with 122 additions and 30 deletions

View File

@ -414,6 +414,9 @@ fi
mkdir -p $BUILD
# source the version script
. $(dirname $(which $0))/version.sh
# qmake needs absolute paths, so we get them now:
BUILD=`readlink -f $BUILD`
BIN=`readlink -f $BIN`

View File

@ -1,5 +1,57 @@
#!/bin/sh -e
# Specify the Python interpreter to use.
# This is the command executed for the Python interpreter that is going
# to be included in KLayout.
python="python3.5m"
# Specify the Ruby interpreter to use.
# This is the command executed for the Ruby interpreter that is going
# to be included in KLayout.
ruby="ruby"
# Specify the path to the NSIS compiler
makensis=/c/Program\ Files\ \(x86\)/NSIS/makensis.exe
# ---------------------------------------------------
# General initialization
if ! [ -e ./build.sh ]; then
echo "ERROR: build script not found (not in the main directory?)"
exit 1
fi
# source the versions
. ./version.sh
pwd=$(pwd)
# ---------------------------------------------------
# Bootstrap script
# This branch will fork to the actual builds for win32 and win64
if [ "$KLAYOUT_BUILD_IN_PROGRESS" == "" ]; then
self=$(which $0)
export KLAYOUT_BUILD_IN_PROGRESS=1
# Run ourself in MINGW32 system for the win32 build
MSYSTEM=MINGW32 bash --login -c "cd $pwd ; $self"
# Run ourself in MINGW64 system for the win64 build
MSYSTEM=MINGW64 bash --login -c "cd $pwd ; $self"
exit 0
fi
# ---------------------------------------------------
# Actual build branch
if [ "$MSYSTEM" == "MINGW32" ]; then
arch=win32
mingw_inst=/mingw32
@ -10,20 +62,24 @@ else
echo "ERROR: not in mingw32 or mingw64 system."
fi
pwd=$(pwd)
target=$pwd/bin-release-$arch
build=$pwd/build-release-$arch
src=$pwd/src
scripts=$pwd/scripts
python="python3.5m"
ruby="ruby"
makensis=/c/Program\ Files\ \(x86\)/NSIS/makensis.exe
echo "------------------------------------------------------------------"
echo "Running build for architecture $arch .."
echo ""
echo " target = $target"
echo " build = $build"
echo " version = $KLAYOUT_VERSION"
echo " date = $KLAYOUT_VERSION_DATE"
echo " rev = $KLAYOUT_VERSION_REV"
echo ""
version=$(cat $src/klayout_main/version.h | grep prg_version | sed 's/.*"\(.*\)".*/\1/')
echo "Version is $version"
# Force a minimum rebuild for the version update
touch src/klayout_main/version.h
echo "Running build .."
rm -rf $target
./build.sh -python $python -ruby $ruby -bin $target -build $build -j2
@ -126,5 +182,5 @@ echo ']' >>$target/.python-paths.txt
# longer require the copy
cp $scripts/klayout-inst.nsis $target
cd $target
NSIS_VERSION=$version NSIS_ARCH=$arch "$makensis" klayout-inst.nsis
NSIS_VERSION=$KLAYOUT_VERSION NSIS_ARCH=$arch "$makensis" klayout-inst.nsis

View File

@ -1,13 +0,0 @@
#!/bin/sh -e
inst_dir=$(dirname $(which $0))
if ! [ -e ./build.sh ]; then
echo "ERROR: build script not found (not in the main directory?)"
exit 1
fi
pwd=$(pwd)
MSYSTEM=MINGW32 bash --login -c "cd $pwd ; $inst_dir/deploy-win-mingw.sh"
MSYSTEM=MINGW64 bash --login -c "cd $pwd ; $inst_dir/deploy-win-mingw.sh"

View File

@ -182,8 +182,21 @@ klayout_main_cont (int argc, char **argv)
lay::Version::set_exe_name (prg_exe_name);
lay::Version::set_name (prg_name);
lay::Version::set_version (prg_version);
lay::Version::set_subversion (prg_subversion);
lay::Version::set_about_text (prg_about_text);
std::string subversion (prg_date);
subversion += " r";
subversion += prg_rev;
lay::Version::set_subversion (subversion.c_str ());
std::string about_text (prg_author);
about_text += "\n";
about_text += prg_date;
about_text += " r";
about_text += prg_rev;
about_text += "\n";
about_text += "\n";
about_text += prg_about_text;
lay::Version::set_about_text (about_text.c_str ());
#if QT_VERSION >= 0x050000
qInstallMessageHandler (myMessageOutput);

View File

@ -16,6 +16,11 @@ SOURCES = \
RESOURCES = \
DEFINES += \
KLAYOUT_VERSION=$$KLAYOUT_VERSION \
KLAYOUT_VERSION_REV=$$KLAYOUT_VERSION_REV \
KLAYOUT_VERSION_DATE=$$KLAYOUT_VERSION_DATE \
INCLUDEPATH += ../tl ../gsi ../db ../rdb ../laybasic ../lay ../ext ../img ../ant ../lib
DEPENDPATH += ../tl ../gsi ../db ../rdb ../laybasic ../lay ../ext ../img ../ant ../lib
LIBS += $$PYTHONLIBFILE $$RUBYLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_laybasic -lklayout_lay -lklayout_ant -lklayout_img -lklayout_edt -lklayout_ext -lklayout_lib

View File

@ -20,19 +20,35 @@
*/
#define STRINGIFY(s) _STRINGIFY(s)
#define _STRINGIFY(s) #s
const char *prg_exe_name = "klayout";
const char *prg_name = "KLayout";
const char *prg_version = "0.25";
const char *prg_subversion =
"2015-12-28 r3123" // UPDATE_HERE
#if defined(KLAYOUT_VERSION)
const char *prg_version = STRINGIFY(KLAYOUT_VERSION);
#else
const char *prg_version = "x.xx";
#endif
#if defined(KLAYOUT_VERSION_DATE)
const char *prg_date = STRINGIFY(KLAYOUT_VERSION_DATE);
#else
const char *prg_date = "xxxx-xx-xx";
#endif
#if defined(KLAYOUT_VERSION_REV)
const char *prg_rev = STRINGIFY(KLAYOUT_VERSION_REV);
#else
const char *prg_rev = "xxxxxxxx";
#endif
const char *prg_author =
"By Matthias K\303\266fferlein, Munich"
;
const char *prg_about_text =
"By Matthias K\303\266fferlein, Munich\n"
"2015-12-28 r3123" // UPDATE_HERE
"\n\n"
"For feedback and bug reports mail to: contact@klayout.de\n"
"\n"
"\n"

12
version.sh Normal file
View File

@ -0,0 +1,12 @@
# This script is sourced to define the main version parameters
# The main version
KLAYOUT_VERSION="0.25"
# The build date
KLAYOUT_VERSION_DATE=$(date --iso-8601)
# The short SHA hash of the commit
KLAYOUT_VERSION_REV=$(git rev-parse --short HEAD)