1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
|
#!/bin/sh
#
#set -x
#
startdir=$PWD
# ---------------------------------------------------------
#
# set 'versionname' to overwrite generated one based on 'ver'
#
versionname=Kst-2.0.8
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
echo ---------------------------------------------------------
echo ---------- Building $versionname
echo ---------------------------------------------------------
if [ -f "/usr/local/bin/ninja" ]; then
generator=-GNinja
buildcmd=ninja
buildcmd_parallel=ninja
export NINJA_STATUS="[%f/%t %o/s, %es] "
else
buildcmd=make
buildcmd_parallel="make -j6"
fi
# ---------------------------------------------------------
#
# print some info about the system
#
echo
echo Build system:
echo
uname -a
lsb_release -a
processors=`grep -c processor /proc/cpuinfo`
echo number of processors: $processors
dpkg --get-selections | grep mingw
iam=`whoami`
travis=travis
if [ "$iam" = "$travis" ]; then
sudo rm -rf /usr/lib/jvm
df -h
fi
echo ---------------------------------------------------------
echo
if [ "$iam" = "$travis" ]; then
deploybinary=1
else
deploybinary=0
fi
# ---------------------------------------------------------
#
# helper function to check return code
#
checkExitCode() {
exitcode=$?
if [ $exitcode -ne 0 ]; then
echo Command failed
exit 1
fi
}
# ---------------------------------------------------------
#
# checkout kstbinary
#
if [ $deploybinary -eq 1 ]; then
if [ "$iam" = "$travis" ]; then
cd ~
tar xf $startdir/cmake/kstdeploy.tar.gz
checkExitCode
fi
cd $startdir
kstbinary=kst-build
rm -rf $kstbinary
mkdir $kstbinary
cd $kstbinary
git init --quiet
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
# ---------------------------------------------------------
#
# get sha1 when git is used
#
sha1=`git rev-parse master`
exitcode=$?
if [ $exitcode -eq 0 ]; then
rev="-Dkst_revision=$sha1"
fi
# ---------------------------------------------------------
#
# make build directory
#
cd ..
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
fi
mkdir $build
builddir=$PWD/$build
cd $builddir
# ---------------------------------------------------------
#
# get actual cmake
#
cmakever=cmake-2.8.12.2-Linux-i386
if [ "$iam" = "$travis" ]; then
if [ ! -d /opt/$cmakever ]; then
cmakebin=x
if [ ! -d /opt/$cmakever ]; then
wget http://www.cmake.org/files/v2.8/$cmakever.tar.gz
checkExitCode
cd /opt
sudo tar xf $builddir/$cmakever.tar.gz
checkExitCode
cd $builddir
fi
fi
cmakebin=/opt/$cmakever/bin/cmake
else
cmakebin=cmake
fi
$cmakebin --version
checkExitCode
gccver=4.7.2
if [ "$2" = "x64" ]; then
win=win64
mingw=x86_64-w64-mingw32
exc=-seh
mingwdir=mingw64$exc
branch=Kst-64bit-no-3rdparty-plugins-Qt5
extlib=
useext=
else
win=win32
mingw=i686-w64-mingw32
exc=-dw2
mingwdir=mingw32$exc
branch=Kst-32bit-3rdparty-plugins-Qt5
extlib=kst-3rdparty-win32-gcc$exc-4.7.2
useext="-Dkst_3rdparty=1 -Dkst_3rdparty_dir=/opt/"$extlib
fi
if [ "$1" = "qt5" ]; then
qtver=5.0.1
tarver=
else
qtver=4.8.4
tarver=
branch=Kst-32bit-3rdparty-plugins-Qt4
fi
qtver=Qt-$qtver-$win-g++-$mingw$exc-$gccver
mingwver=$mingw-gcc$exc-$gccver
server=http://sourceforge.net/projects/kst/files/3rdparty
# ---------------------------------------------------------
#
# download and install mingw
#
if [ ! -d /opt/$mingwdir ]; then
mingwtar=$mingwver-Ubuntu64-12.04.tar
wget $server/$mingwtar.xz
checkExitCode
xz -d $mingwtar.xz
cd /opt
sudo tar xf $builddir/$mingwtar
checkExitCode
cd $builddir
fi
# when cross-compiler is in path cmake assumes it is a native compiler and passes "-rdynamic" which mingw doesn't support
#export PATH=/opt/mingw32/bin:$PATH
echo Checking mingw installation ...
/opt/$mingwdir/bin/$mingw-gcc -dumpversion
checkExitCode
# ---------------------------------------------------------
#
# download and install Qt
#
if [ ! -d /opt/$qtver ]; then
qttar=$qtver-Ubuntu64-12.04$tarver.tar
wget $server/$qttar.xz
checkExitCode
xz -d $qttar.xz
cd /opt
sudo tar xf $builddir/$qttar
checkExitCode
cd $builddir
fi
export PATH=/opt/$qtver/bin:$PATH
echo Checking Qt installation ...
which qmake
checkExitCode
# ---------------------------------------------------------
#
# download 3rdparty
#
if [ ! -d /opt/$extlib ]; then
wget $server/$extlib.zip
checkExitCode
cd /opt
sudo unzip -q $builddir/$extlib.zip
checkExitCode
cd $builddir
sudo cp /opt/$extlib/include/matio_pubConf.h /opt/$extlib/include/matio_pubconf.h
fi
# ---------------------------------------------------------
#
# checkout translations
#
cd $startdir
./l10n-fetch-po-files.py
# only ship listed tranlations
mkdir po_all
mv po/* po_all
for tr in ca ca@valencia de en_GB fr nl pl pt pt_BR sv uk
do
file=kst_common_$tr.po
echo "using translation $tr"
cp po_all/$file po
done
cd $builddir
# ---------------------------------------------------------
#
# build Kst
#
cd $builddir
if [ "$1" = "qt5" ]; then
qtopt="-Dkst_qt5=1"
else
qtopt="-Dkst_qt4=/opt/$qtver"
fi
if [ $buildinstaller -eq 1 ]; then
console=-Dkst_console=0
else
console=-Dkst_console=1
noinstaller=-Dkst_noinstaller=1
fi
$cmakebin ../kst \
-Dkst_release=1 \
-Dkst_version_string=$versionname \
-Dkst_install_prefix=./$versionname \
-Dkst_cross=/opt/$mingwdir/bin/$mingw \
$rev $qtopt $useext $console $noinstaller $generator
checkExitCode
$buildcmd_parallel
checkExitCode
# ---------------------------------------------------------
#
# deploy
#
$buildcmd package
checkExitCode
deploy() {
if [ ! -e $1 ]; then
exit 1
fi
cd $startdir/$kstbinary
git checkout master
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 origin HEAD -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
cd $startdir
|