Commit ed9e4239 authored by Linus Jahn's avatar Linus Jahn Committed by Jonah Brüchert

travis-ci: Restructure build scripts and clean up

This also adds caching for /var/cache/apt/archives, which will really speed up
the build, because then the slow launchpad servers aren't used anymore.
parent 052ed070
language: cpp
compiler: gcc
cache: ccache
cache:
ccache: true
directories:
- /var/cache/apt/archives
sudo: required
dist: trusty
install:
- ./utils/travis-dependencies.sh
- ./utils/travis/dependencies.sh
script:
- cd utils
- source /opt/qt*/bin/qt*-env.sh
- ./travis-build.sh
- . utils/travis/common.sh
- env_setup
- ./utils/travis/build.sh
matrix:
include:
- env: BUILD_SYSTEM=qmake
......
#!/bin/bash
echo "*****************************************"
echo "Fetching dependencies"
echo "Using build system: ${BUILD_SYSTEM}"
echo "*****************************************"
sudo apt-get update
sudo apt-get install software-properties-common dirmngr gnupg ca-certificates wget -y
# Trusty backports
sudo bash -c "echo deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse >> /etc/apt/sources.list"
# Qt 5.9 repository
sudo add-apt-repository ppa:beineri/opt-qt593-trusty -y
sudo apt-get update
sudo apt-get install cmake \
build-essential \
ninja-build \
zlib1g-dev \
qt59base \
qt59script \
qt59declarative \
qt59tools \
qt59x11extras \
qt59svg \
qt59quickcontrols2 \
-y -t trusty-backports
# KF5 (only needed for cmake)
if [ $BUILD_SYSTEM == "cmake" ]; then
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/kf5.40-gcc6-linux64-release.tar.xz"
tar xf kf5.40-gcc6-linux64-release.tar.xz
sudo cp -rf kf5-release/* /opt/qt*/
fi
# Gloox
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/libgloox17_1.0.20-1_amd64.deb"
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/libgloox-dev_1.0.20-1_amd64.deb"
sudo dpkg -i libgloox*.deb
rm libgloox*.deb
sudo apt install -f -y
#!/bin/bash
#!/bin/bash -e
. utils/travis/common.sh
echo "*****************************************"
echo "Building Kaidan binary"
echo "Building Kaidan"
echo "Using build system: ${BUILD_SYSTEM}"
echo "Number of CPUs used: $(nproc)"
echo "*****************************************"
mkdir ../build; cd ../build/
#env_setup
mkdir -p ${TRAVIS_BUILD_DIR}/build
cd ${TRAVIS_BUILD_DIR}/build
if [[ ${BUILD_SYSTEM} == "cmake" ]]; then
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DI18N=1 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
if [ $BUILD_SYSTEM == "cmake" ]; then
cmake .. -GNinja -DI18N=1 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build .
elif [ $BUILD_SYSTEM == "qmake" ]; then
elif [[ ${BUILD_SYSTEM} == "qmake" ]]; then
# generate binary translations (qm files)
lrelease ../Kaidan.pro
qmake "QMAKE_CXX=ccache g++" ..
qmake ../Kaidan.pro \
"QMAKE_CXX=ccache g++" \
"CONFIG+=debug"
make -j$(nproc)
else
echo "Unknown build system \"${BUILD_SYSTEM}\""
exit 1
fi
#!/bin/bash -e
export CPUS_USED=2
if command -v nproc >/dev/null; then
export CPUS_USED=$(nproc)
fi
add_apt_repos() {
sudo apt-get install dirmngr
# trusty backports
sudo bash -c "echo deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse >> /etc/apt/sources.list"
# Qt 5.9 repository
sudo add-apt-repository ppa:beineri/opt-qt593-trusty -y
}
install_kf5() {
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/kf5.40-gcc6-linux64-release.tar.xz"
tar xf kf5.40-gcc6-linux64-release.tar.xz
sudo cp -rf kf5-release/* /opt/qt*/
}
install_gloox() {
# download
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/libgloox17_1.0.20-1_amd64.deb"
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/libgloox-dev_1.0.20-1_amd64.deb"
# install debs and install possible missing dependencies
sudo dpkg -i libgloox*.deb || sudo apt-get -f -y install
# clean up
rm libgloox*.deb
}
install_linux_deps() {
add_apt_repos
sudo apt-get update
sudo apt-get install -y -t trusty-backports \
cmake \
build-essential \
ninja-build \
zlib1g-dev \
qt59base \
qt59script \
qt59declarative \
qt59tools \
qt59x11extras \
qt59svg \
qt59quickcontrols2
# KF5 (only for cmake; qmake compiles kirigami from submodule)
if [[ $BUILD_SYSTEM == "cmake" ]]; then
install_kf5
fi
install_gloox
}
env_setup() {
if [ -f /opt/qt5*/bin/qt5*-env.sh ]; then
echo "Setting up custom Qt 5.9 installation..."
source /opt/qt59/bin/qt59-env.sh
fi
}
#!/bin/bash -e
. utils/travis/common.sh
echo "*****************************************"
echo "Fetching dependencies"
echo "Using build system: ${BUILD_SYSTEM}"
echo "*****************************************"
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
install_linux_deps
else
echo "Can't build on \"${TRAVIS_OS_NAME}\""
exit 1
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment