import jenkins.model.* import hudson.model.Result def REPO = 'ssh://gerrit1.techsat.net:29418/external/Qt' properties([ parameters([ gitParameter(branch: '', branchFilter: 'origin/(.*)', defaultValue: 'master', description: '', name: 'BRANCH', quickFilterEnabled: false, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_BRANCH_TAG') ]) ]) stage('Build') { parallel linux: { node('bslp02-centos6-64') { try { deleteDir() checkout([$class: 'GitSCM', branches: [[name: BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: REPO]]]) stage("Qt Build") { sh '''#!/bin/bash export PATH=$GCC_PATH/bin:$PATH make GCC_PATH=/master/DEV-Tools/gcc-suite/1.6.0/x86-linux64/gcc -f Makefile all ''' } stage("Qt-Creator Build") { sh '''#!/bin/bash export PATH=/master/DEV-Tools/gcc-suite/1.6.0/x86-linux64/gcc/bin:$PATH make ARCH=x86-linux64 GCC_PATH=/master/DEV-Tools/gcc-suite/1.6.0/x86-linux64/gcc/bin QTDIR=$WORKSPACE/install.x86-linux64/qt-5.14.2-shared -f Makefile.qtcreator all ''' } } catch (e) { echo 'Linux build failed' } finally { sh '''#!/bin/bash echo "Build failed" exit 1 ''' } } }, windows: { node('bslp05-win10-64') { try { deleteDir() checkout([$class: 'GitSCM', branches: [[name: BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: REPO]]]) stage ("MinGW Qt Build") { sh '''#!/bin/bash set -x echo "Cleanup prev. builds ..." WS=$(cygpath $WORKSPACE) cp -Rvf /c/dev-tools/gcc-suite/1.6.0/x86-mingw64/gcc $WS/ cp $WS/gcc/bin/make.exe $WS/gcc/bin/mingw32-make.exe export PATH=$WS/gcc/bin:/c/dev-tools/msys/x86/usr/bin:$PATH export PATH=/c/dev-tools/Python/2.7/x86-windows:$PATH export CC=$WS/gcc/bin/gcc export CXX=$WS/gcc/bin/g++ gcc -v mkdir -p /c/tmp make -f Makefile.mingw64 all ''' } stage ("MinGW Qt-Creator Build") { sh '''#!/bin/bash set -x echo "Cleanup prev. builds ..." WS=$(cygpath $WORKSPACE) cp -Rvf /c/dev-tools/gcc-suite/1.6.0/x86-mingw64/gcc $WS/ cp $WS/gcc/bin/make.exe $WS/gcc/bin/mingw32-make.exe export PATH=$WS/gcc/bin:/c/dev-tools/msys/x86/usr/bin:$PATH export PATH=/c/dev-tools/Python/2.7/x86-windows:$PATH export CC=$WS/gcc/bin/gcc export CXX=$WS/gcc/bin/g++ gcc -v make -f Makefile.qtcreator ARCH=x86-mingw64 GCC_PATH=$WS/gcc QTDIR=/c/tmp/qt all ''' } stage ("Windows 64 Bit MSVC Build") { sh '''#!/bin/bash set -x rm -f openssl-1.0.2r/NUL rm -Rf openssl-1.0.2r ''' bat '''@echo off set SDKDIR=C:\\VS2019BT\\ set NASMDIR=C:\\nasm\\2.12.01_64\\ set MSYSDIR=C:\\msys\\x86\\ set PERLDIR=C:\\perl\\x86_64-msvc\\ set PATH=%PATH%;C:\\dev-tools\\Python\\2.7\\x86-windows\\ buildqt64.bat ''' } stash name: "qtwin", includes: "qt-*-msvc.zip,*qt-*-x86-mingw64.tgz,qtcreator-*-x86-mingw64.zip" } catch (e) { echo 'Windows build failed' } finally { sh ''' export PATH=/c/msys/x86/usr/bin rm -Rf $(cygpath $WORKSPACE)/openssl-1.0.2r exit 1 ''' } } } } stage ("Post processing") { node('bslp02-centos6-64') { unstash name: 'qtwin' sh ''' QT_VER=5.14.2 # # cleanup temporary destination folder for final distribution ... # unpack Linux archives ... mkdir -p $WORKSPACE/INST/$QT_VER/x86-linux64-shared tar -xzf $WORKSPACE/qt-$QT_VER-shared-x86-linux64.tgz -C $WORKSPACE/INST/$QT_VER/x86-linux64-shared mkdir -p $WORKSPACE/INST/$QT_VER/x86-linux64-static tar -xzf $WORKSPACE/qt-$QT_VER-static-x86-linux64.tgz -C $WORKSPACE/INST/$QT_VER/x86-linux64-static mkdir -p $WORKSPACE/INST/$QT_VER/x86-mingw64 tar -xzf $WORKSPACE/qt-$QT_VER-x86-mingw64.tgz -C $WORKSPACE/INST/$QT_VER/x86-mingw64 mkdir -p $WORKSPACE/INST/$QT_VER/x86-mingw64/xbin-x86-linux64 cp -f $WORKSPACE/INST/$QT_VER/x86-linux64-shared/bin/* $WORKSPACE/INST/$QT_VER/x86-mingw64/xbin-x86-linux64 mkdir -p $WORKSPACE/INST/$QT_VER/x86_64-msvc unzip -o $WORKSPACE/qt-$QT_VER-x86_64-msvc.zip -d $WORKSPACE/INST/$QT_VER/x86_64-msvc # generate qt.conf for linux to windows cross builds ... rm -f $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "[Paths]" > $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "Prefix=.." >> $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "Libraries = lib" >> $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "Plugins = plugins" >> $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "HostBinaries=xbin" >> $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf echo "TargetSpec=win32-g++" >> $WORKSPACE/INST/$QT_VER/x86-mingw64-shared/bin/qt.conf # # finally recreate the whole mingw64-shared archive ... rm -f $WORKSPACE/qt-$QT_VER-x86-mingw64.tgz cd $WORKSPACE/INST/$QT_VER/x86-mingw64 cp -f $WORKSPACE/INST/$QT_VER/x86-mingw64/bin/qt.conf \ $WORKSPACE/INST/$QT_VER/x86-mingw64/xbin-x86-linux64/ tar -zcf $WORKSPACE/qt-$QT_VER-x86-mingw64.tgz . cd $WORKSPACE/ rm -Rf $WORKSPACE/INST ''' archiveArtifacts artifacts: '*.tgz, *.zip' } }