10 # Uncomment when Travis upgraded "Ubuntu 12.04 LTS" to a newer version whose repo will have a more up-to-date libtorrent package
11 #- lt_branch=dist gui=true
12 #- lt_branch=dist gui=false
13 - lt_branch=RC_1_0 gui=true build_system=cmake
14 - lt_branch=RC_1_0 gui=false build_system=cmake
15 - lt_branch=RC_1_0 gui=true build_system=qmake
16 - lt_branch=RC_1_0 gui=false build_system=qmake
18 - secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
19 - coverity_branch: coverity_scan
23 - env: lt_branch=RC_1_0 gui=true build_system=cmake
24 - env: lt_branch=RC_1_0 gui=false build_system=cmake
28 - search_encoding_windows
39 - $HOME/hombebrew_cache
41 # opt-in Ubuntu Trusty
43 # container-based builds
49 name: "qbittorrent/qBittorrent"
50 description: "Build submitted via Travis CI"
51 build_command_prepend: "./bootstrap.sh && ./configure $qbtconf"
53 branch_pattern: $coverity_branch
54 notification_email: sledgehammer999@qbittorrent.org
57 # sources list: https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
58 - ubuntu-toolchain-r-test
60 - sourceline: 'ppa:qbittorrent-team/qbittorrent-stable'
61 - sourceline: 'ppa:beineri/opt-qt551-trusty'
62 - sourceline: 'ppa:adrozdoff/cmake'
64 # packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
65 - [autoconf, automake, colormake]
66 - [cmake, ninja-build]
68 - [libboost-dev, libboost-system-dev]
69 - libtorrent-rasterbar-dev
70 - [qt55base, qt55svg, qt55tools]
74 # only allow specific build for coverity scan, others will stop
75 - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ] && ! [ "$TRAVIS_OS_NAME" = "linux" -a "$lt_branch" = "RC_1_0" -a "$gui" = true -a "$build_system" = "qmake" ]; then exit ; fi
77 - shopt -s expand_aliases
78 - alias make="colormake -j3" # Using nprocs/2 sometimes may fail (gcc is killed by system)
79 - qbt_path="$HOME/qbt_install"
81 if [ "$TRAVIS_OS_NAME" = "linux" ]; then
82 qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH=/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
84 qbtconf="$qbtconf --prefix="$qbt_path""
87 # options for specific branches
88 - if [ "$gui" = false ]; then qbtconf="$qbtconf --disable-gui" ; fi
90 if [ "$TRAVIS_OS_NAME" = "linux" ]; then
91 # setup virtual display for after_success target
92 if [ "$gui" = true ]; then export "DISPLAY=:99.0" && /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 ; fi ;
95 PATH=/opt/qt55/bin:${PATH}
97 if [ "$build_system" = "cmake" ]; then
99 export CXX="${CXX}-${COMPILER_VERSION}" CC="${CC}-${COMPILER_VERSION}"
112 #if [ "$TRAVIS_OS_NAME" = "linux" ]; then
113 # build libtorrent from source
114 #if [ "$lt_branch" != "dist" ]; then
115 #cd "$HOME" && pwd && git clone --depth 1 https://github.com/arvidn/libtorrent.git --branch $lt_branch
116 #cd libtorrent && ./autotool.sh && ./configure $ltconf && make install
120 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
122 brew update > /dev/null
123 brew outdated "pkg-config" || brew upgrade "pkg-config"
124 brew install colormake ccache zlib qt
125 PATH="/usr/local/opt/ccache/libexec:$PATH"
126 brew link --force zlib qt
128 wget https://builds.shiki.hu/homebrew/version
129 if ! cmp --quiet "version" "$HOME/hombebrew_cache/version" ; then
130 echo "Cached files are different from server. Downloading new ones."
131 # First delete old files
132 rm -r "$HOME/hombebrew_cache"
133 mkdir "$HOME/hombebrew_cache"
134 cp "version" $HOME/hombebrew_cache
135 cd "$HOME/hombebrew_cache"
136 wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar.rb
137 wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.1.7+git20180422.3ede0b9c20+patched-configure.el_capitan.bottle.tar.gz
140 # Copy custom libtorrent bottle to homebrew's cache so it can find and install it
141 # Also install our custom libtorrent formula by passing the local path to it
142 # These 2 files are restored from Travis' cache.
143 cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.1.7+git20180422.3ede0b9c20+patched-configure.el_capitan.bottle.tar.gz" "$(brew --cache)"
144 brew install "$HOME/hombebrew_cache/libtorrent-rasterbar.rb"
146 if [ "$build_system" = "cmake" ]; then
147 brew outdated cmake || brew upgrade cmake
150 ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
151 ln -s /usr/local/opt/qt/plugins /usr/local/plugins
154 MY_CMAKE_OPENSSL_HINT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/"
157 if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
158 export use_ccache=true
159 ccache -V && ccache --show-stats && ccache --zero-stats
163 - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
165 cd "$TRAVIS_BUILD_DIR"
166 if [ "$build_system" = "cmake" ]; then
169 if [ "$gui" = "false" ]; then
170 DISABLE_GUI_OPTION="-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
172 cmake $DISABLE_GUI_OPTION -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
173 -G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
176 if [ "$build_system" = "qmake" ]; then
177 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
178 # For some reason for RC_1_1 we need to also specify the OpenSSL compiler/linker flags
179 # Homebrew doesn't symlink OpenSSL for security reasons
180 ./bootstrap.sh && ./configure $qbtconf CXXFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --cflags openssl)" LDFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --libs openssl)"
181 sed -i "" -e "s/^\(CC.*&&\).*$/\1 $CC/" src/Makefile # workaround for Qt & ccache: https://bugreports.qt.io/browse/QTBUG-31034
182 sed -i "" -e "s/^\(CXX.*&&\).*$/\1 $CXX/" src/Makefile
183 sed -i "" -e 's/^\(CXXFLAGS.*\)$/\1 -Wno-unused-local-typedefs -Wno-inconsistent-missing-override/' src/Makefile
185 ./bootstrap.sh && ./configure $qbtconf
189 - $BUILD_TOOL && $BUILD_TOOL install
192 - if [ "$gui" = true ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
193 - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
195 if [ "$TRAVIS_OS_NAME" = "osx" ]; then
196 if [ "$build_system" = "qmake" ]; then
197 macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
198 cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
200 cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
203 - ./$qbt_exe --version
206 - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi