Skip to content

Commit

Permalink
build installer when a version name is set
Browse files Browse the repository at this point in the history
  • Loading branch information
syntheticpp committed Mar 15, 2014
1 parent 5be7abc commit 0af0b82
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 37 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -7,11 +7,9 @@ language: cpp


install:
- sudo apt-get update -qq
- sudo apt-get remove cmake mingw32-binutils mingw32-runtime mingw32 libqt4-dev qt4-qmake mingw-w64 g++-mingw-w64 gcc-mingw-w64
- sudo apt-get install m4 bison flex
- sudo apt-get install m4 bison flex nsis-common nsis
- sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 # cmake is 32bit
- sudo apt-get autoremove

script:
- ./cmake/travis.sh qt4
Expand Down
14 changes: 9 additions & 5 deletions cmake/CMakeLists.txt
Expand Up @@ -47,6 +47,7 @@ kst_option(bool ON all opengl "Use OpenGL")
kst_option(bool OFF all clang "Use Clang compiler")
kst_option(bool OFF all sanitize "Use Clang's sanitizers")
kst_option(bool OFF all dbgsym "Build with debug symbols enabled")
kst_option(bool OFF win noinstaller "Don't build installer")

message(STATUS)

Expand Down Expand Up @@ -75,11 +76,13 @@ endif()
set(kst_version_major 2)
if(kst_version_string)
set(kst_version ${kst_version_string})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${kst_version}")
else()
set(kst_version_minor 0)
set(kst_version_patch x)
set(kst_version ${kst_version_major}.${kst_version_minor}.${kst_version_patch})
set(kst_version_string ${kst_version})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
endif()

if(MINGW)
Expand Down Expand Up @@ -364,12 +367,12 @@ endif()
# http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack

if(WIN32)
if(kst_cross)
if(kst_noinstaller)
set(CPACK_GENERATOR ZIP)
set(CPACK_BINARY_ZIP 1)
else()
set(CPACK_GENERATOR ZIP NSIS)
set(CPACK_GENERATOR NSIS)
endif()
set(CPACK_BINARY_ZIP 1)
endif()

#adapted from [trojita.git] / CMakeLists.txt
Expand Down Expand Up @@ -425,7 +428,6 @@ set(CPACK_PACKAGE_VERSION_PATCH ${kst_version_patch})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Kst 2")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${kst_dir}/README)
set(CPACK_PACKAGE_CONTACT "http://bugs.kde.org}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
set(CPACK_STRIP_FILES 1)


Expand All @@ -445,7 +447,9 @@ endif()


# rpm
set(CPACK_SET_DESTDIR "ON")
if(UNIX)
set(CPACK_SET_DESTDIR "ON")
endif()
FILE(READ ${CPACK_RESOURCE_FILE_LICENSE} CPACK_RPM_PACKAGE_LICENSE)
set(CPACK_RPM_PACKAGE_GROUP "Applications/Science")
set(CPACK_RPM_PACKAGE_VENDOR ${CPACK_PACKAGE_VENDOR})
Expand Down
92 changes: 63 additions & 29 deletions cmake/travis.sh
Expand Up @@ -15,11 +15,17 @@ startdir=$PWD
ver=2.0.x
date=`date --utc '+%Y.%m.%d-%H.%M'`
if [ -z $versionname ]; then
buildinstaller=0
versionname=Kst-$ver-$date
else
buildinstaller=1
fi
if [ "$1" = "qt5" ]; then
versionname=$versionname-Qt5
fi

#if [ "$1" = "qt5" ]; then
# versionname=$versionname-Qt5
#fi


echo ---------------------------------------------------------
echo ---------- Building $versionname
echo ---------------------------------------------------------
Expand Down Expand Up @@ -47,7 +53,12 @@ fi
echo ---------------------------------------------------------
echo


if [ "$iam" = "$travis" ]; then
deploybinary=1
else
deploybinary=0
fi
deploybinary=1

# ---------------------------------------------------------
#
Expand All @@ -67,25 +78,27 @@ checkExitCode() {
#
# checkout kstbinary
#
if [ "$iam" = "$travis" ]; then
cd ~
tar xf $startdir/cmake/kstdeploy.tar.gz
checkExitCode
if [ $deploybinary -eq 1 ]; then
if [ "$iam" = "$travis" ]; then
cd ~
tar xf $startdir/cmake/kstdeploy.tar.gz
checkExitCode
fi

cd $startdir
git config --global push.default matching
git config --global user.name "travis"
git config --global user.email travis@noreply.org
kstbinary=kst-build
git clone --quiet git@github.com:Kst-plot/$kstbinary.git
exitcode=$?
if [ $exitcode -ne 0 ]; then
rm -rf $kstbinary
git clone --quiet git@github.com:Kst-plot/$kstbinary.git
fi
rm -rf $kstbinary
mkdir $kstbinary
cd $kstbinary
git init --quiet
git config push.default matching
git config user.name "travis"
git config user.email travis@noreply.org
git remote add origin git@github.com:Kst-plot/$kstbinary.git
git fetch origin master --quiet
checkExitCode
fi

cd $startdir


# ---------------------------------------------------------
Expand All @@ -106,7 +119,11 @@ fi
# make build directory
#
cd ..
build=_b
if [ "$2" = "x64" ]; then
build=_b_x64
else
build=_b_x86
fi
if [ -d "$build" ]; then
echo Removing old build directory $build
rm -rf $build
Expand All @@ -121,7 +138,7 @@ cd $builddir
#
# get actual cmake
#
cmakever=cmake-2.8.10.2-Linux-i386
cmakever=cmake-2.8.12.2-Linux-i386

if [ "$iam" = "$travis" ]; then
if [ ! -d /opt/$cmakever ]; then
Expand Down Expand Up @@ -245,17 +262,24 @@ else
qtopt="-Dkst_qt4=/opt/$qtver -Dkst_opengl=0"
fi


if [ $buildinstaller -eq 1 ]; then
console=-Dkst_console=0
else
console=-Dkst_console=1
noinstaller=-Dkst_noinstaller=1
fi

$cmakebin ../kst/cmake/ \
-Dkst_console=1 \
-Dkst_release=1 \
-Dkst_version_string=$versionname \
-Dkst_install_prefix=./$versionname \
-Dkst_cross=/opt/$mingwdir/bin/$mingw \
$rev $qtopt $useext
$rev $qtopt $useext $console $noinstaller

checkExitCode

processors=4 # /proc reports 32
processors=6 # /proc reports 32
make -j $processors
checkExitCode

Expand All @@ -272,20 +296,30 @@ if [ ! -e $versionname-$win.zip ]; then
exit 1
fi

if [ "$iam" = "$travis" ]; then
deploy() {
cd $startdir/$kstbinary
git checkout master
git branch -D $branch
git checkout -b $branch
cp -f $builddir/$versionname-$win.zip .
git add $versionname-$win.zip
git branch -D $2
git checkout -b $2
cp -f $builddir/$1 .
checkExitCode

git add $1
checkExitCode

git commit --quiet -m"Update $win binary to version $versionname"
checkExitCode

git push --quiet -f
checkExitCode
}


if [ $deploybinary -eq 1 ]; then
if [ $buildinstaller -eq 1 ]; then
deploy $versionname-$win.exe Installer-$branch
else
deploy $versionname-$win.zip $branch
fi
fi


Expand Down

0 comments on commit 0af0b82

Please sign in to comment.