Browse Source

Merge pull request #4736

Maxim Biro (3):
      feat(travis): Windows cross-compilation
      feat(build): hash everything in Windows cross-compilation
      feat(travis): run tests on Windows
reviewable/pr4585/r3
Diadlo 8 years ago
parent
commit
25ae6d091a
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 89
      .travis.yml
  2. 122
      .travis/build-windows.sh
  3. 8
      CMakeLists.txt
  4. 2
      cmake/Testing.cmake
  5. 8
      windows/cross-compile/README.md
  6. 452
      windows/cross-compile/build.sh

89
.travis.yml

@ -12,20 +12,99 @@ branches: @@ -12,20 +12,99 @@ branches:
matrix:
fast_finish: true
include:
- os: linux
- stage: Linux
os: linux
env: JOB=verify-commit-format
- os: linux
- stage: Linux
os: linux
env: JOB=build-docs DOXYGEN_CONFIG_FILE=doxygen.conf
- os: linux
- stage: Linux
os: linux
env: JOB=build-gitstats GITSTATS_DIR=gitstats
addons:
apt:
packages:
- gitstats
# the actual compilin'
- os: linux
- stage: Linux
os: linux
env: JOB=build-ubuntu-14-04
- os: osx
- stage: "Windows Stage 1: Dependencies (OpenSSL, Qt)"
os: linux
# Makes the cache this job creates avaiable only to jobs with WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=i686,
# making sure that i686 and x86_64 caches don't overwrite each other
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=i686
script: ./.travis/build-windows.sh i686 release /opt/build-windows/i686 stage1
services:
- docker
cache:
directories:
- /opt/build-windows/i686
- stage: "Windows Stage 1: Dependencies (OpenSSL, Qt)"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=x86_64
script: ./.travis/build-windows.sh x86_64 release /opt/build-windows/x86_64 stage1
services:
- docker
cache:
directories:
- /opt/build-windows/x86_64
- stage: "Windows Stage 2: Dependencies (other)"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=i686
script: ./.travis/build-windows.sh i686 release /opt/build-windows/i686 stage2
services:
- docker
cache:
directories:
- /opt/build-windows/i686
- stage: "Windows Stage 2: Dependencies (other)"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=x86_64
script: ./.travis/build-windows.sh x86_64 release /opt/build-windows/x86_64 stage2
services:
- docker
cache:
directories:
- /opt/build-windows/x86_64
- stage: "Windows Stage 3: qTox"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=i686
script: ./.travis/build-windows.sh i686 release /opt/build-windows/i686 stage3
services:
- docker
cache:
directories:
- /opt/build-windows/i686
- stage: "Windows Stage 3: qTox"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=x86_64
script: ./.travis/build-windows.sh x86_64 release /opt/build-windows/x86_64 stage3
services:
- docker
cache:
directories:
- /opt/build-windows/x86_64
- stage: "Windows Stage 3: qTox"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=i686
script: ./.travis/build-windows.sh i686 debug /opt/build-windows/i686 stage3
services:
- docker
cache:
directories:
- /opt/build-windows/i686
- stage: "Windows Stage 3: qTox"
os: linux
env: WINDOWS_BUILD_ARCH_CACHE_TRICK_VARIABLE=x86_64
script: ./.travis/build-windows.sh x86_64 debug /opt/build-windows/x86_64 stage3
services:
- docker
cache:
directories:
- /opt/build-windows/x86_64
- stage: macOS
os: osx
osx_image: xcode7.3
env: JOB=build-osx

122
.travis/build-windows.sh

@ -0,0 +1,122 @@ @@ -0,0 +1,122 @@
#!/usr/bin/env bash
# MIT License
#
# Copyright (c) 2017 Maxim Biro <nurupo.contributions@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Fail out on error
set -exuo pipefail
readonly ARCH="$1"
readonly BUILD_TYPE="$2"
readonly CACHE_DIR="$3"
readonly STAGE="$4"
if [ -z "$ARCH" ]
then
echo "Error: No architecture was specified. Please specify either 'i686' or 'x86_64', case sensitive, as the first argument to the script."
exit 1
fi
if [[ "$ARCH" != "i686" ]] && [[ "$ARCH" != "x86_64" ]]
then
echo "Error: Incorrect architecture was specified. Please specify either 'i686' or 'x86_64', case sensitive, as the first argument to the script."
exit 1
fi
if [ -z "$BUILD_TYPE" ]
then
echo "Error: No build type was specified. Please specify either 'release' or 'debug', case sensitive, as the second argument to the script."
exit 1
fi
if [[ "$BUILD_TYPE" != "release" ]] && [[ "$BUILD_TYPE" != "debug" ]]
then
echo "Error: Incorrect build type was specified. Please specify either 'release' or 'debug', case sensitive, as the second argument to the script."
exit 1
fi
if [ -z "$CACHE_DIR" ]
then
echo "Error: No cache directory path was specified. Please specify absolute path to the cache directory as the third argument to the script."
exit 1
fi
if [ -z "$STAGE" ]
then
echo "Error: No stage was specified. Please specify either 'stage1', 'stage2' or 'stage3' as the fourth argument to the script."
exit 1
fi
if [[ "$STAGE" != "stage1" ]] && [[ "$STAGE" != "stage2" ]] && [[ "$STAGE" != "stage3" ]]
then
echo "Error: Incorrect stage was specified. Please specify either 'stage1', 'stage2' or 'stage3', case sensitive, as the fourth argument to the script."
exit 1
fi
# Just make sure those exist, makes logic easier
mkdir -p "$CACHE_DIR"
touch "$CACHE_DIR"/hash
mkdir -p workspace/"$ARCH"/dep-cache
# If build.sh has changed, i.e. its hash doesn't match the previously stored one, and it's Stage 1
# Then we want to rebuild everything from scratch
if [ "`cat '$CACHE_DIR'/hash`" != "`sha256sum windows/cross-compile/build.sh`" ] && [ "$STAGE" == "stage1" ]
then
# Clear the cache, removing all the pre-built dependencies
rm -rf "$CACHE_DIR"/*
touch "$CACHE_DIR"/hash
else
# Copy over all pre-built dependencies
cp -a "$CACHE_DIR"/* workspace/"$ARCH"/dep-cache
fi
# Purely for debugging
ls -lbh "$CACHE_DIR"
# Build
sudo docker run --rm \
-v "$PWD/workspace":/workspace \
-v "$PWD/windows/cross-compile":/script \
-v "$PWD":/qtox \
-e TRAVIS_CI_STAGE="$STAGE" \
debian:stretch-slim \
/bin/bash /script/build.sh "$ARCH" "$BUILD_TYPE"
# If we were building deps and it's any of the dependency building stages (Stage 1 or 2), copy over all the built dependencies to Travis cache
if [ "`cat $CACHE_DIR/hash`" != "`sha256sum windows/cross-compile/build.sh`" ] && ( [ "$STAGE" == "stage1" ] || [ "$STAGE" == "stage2" ] )
then
# Clear out the cache
rm -rf "$CACHE_DIR"/*
touch "$CACHE_DIR"/hash
cp -a workspace/"$ARCH"/dep-cache/* "$CACHE_DIR"
fi
# Update the hash
if [ "`cat $CACHE_DIR/hash`" != "`sha256sum windows/cross-compile/build.sh`" ] && [ "$STAGE" == "stage2" ]
then
sha256sum windows/cross-compile/build.sh > "$CACHE_DIR"/hash
fi
# Purely for debugging
touch "$CACHE_DIR"/"$STAGE"
ls -lbh "$CACHE_DIR"

8
CMakeLists.txt

@ -561,6 +561,14 @@ if(${USE_FILTERAUDIO}) @@ -561,6 +561,14 @@ if(${USE_FILTERAUDIO})
endif()
endif()
if (MINGW)
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if (CMAKE_BUILD_TYPE_LOWER MATCHES debug)
# Allows wine to display source code file names and line numbers on crash in its backtrace
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-2")
endif()
endif()
# the compiler flags for compiling C sources
MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} )

2
cmake/Testing.cmake

@ -15,7 +15,7 @@ function(auto_test subsystem module) @@ -15,7 +15,7 @@ function(auto_test subsystem module)
Qt5::Test)
add_test(
NAME test_${module}
COMMAND test_${module})
COMMAND ${TEST_CROSSCOMPILING_EMULATOR} test_${module})
endfunction()
auto_test(core toxpk)

8
windows/cross-compile/README.md

@ -48,21 +48,21 @@ sudo docker run --rm \ @@ -48,21 +48,21 @@ sudo docker run --rm \
-v /absolute/path/to/your/workspace:/workspace \
-v /absolute/path/to/your/script:/script \
-v /absolute/path/to/your/qtox:/qtox \
ubuntu:16.04 \
debian:stretch-slim \
/bin/bash /script/build.sh i686 release
```
If you are a qTox developer, you might want to instead run
```sh
# Get shell inside Ubuntu 16.04 container so that you can poke around if needed
# Get shell inside Debian Stretch container so that you can poke around if needed
sudo docker run -it \
--rm \
-v /absolute/path/to/your/workspace:/workspace \
-v /absolute/path/to/your/script:/script \
-v /absolute/path/to/your/qtox:/qtox \
ubuntu:16.04 \
/bin/bash
debian:stretch-slim \
/bin/bash
# Run the script
bash /script/build.sh i686 release
```

452
windows/cross-compile/build.sh

@ -24,22 +24,17 @@ @@ -24,22 +24,17 @@
# Known issues:
# - Doesn't build qTox updater, because it wasn't ported to cmake yet and
# because it requires static Qt, which means we'd need to build Qt twice,
# and building Qt takes really long time.
# because it requires static Qt, which means we'd need to build Qt twice, and
# building Qt takes really long time.
#
# - Doesn't create an installer because there is no NSIS 3 in Ubuntu. We could
# switch to Debian instead and backport it from Experimental, which is what
# we do on Jenkins, but since we don't build an updater, we might as well
# just do the nightly qTox build: no updater, no installer.
#
# - Qt from 5.8.0 to 5.9.1 doesn't cross-compile to Windows due to
# https://bugreports.qt.io/browse/QTBUG-61740. Should be fixed in 5.9.2. You
# can easily patch it though, just one sed command, but I guess we will wait
# for 5.9.2.
# - Doesn't create an installer because there is no NSIS 3 in Debian Stable. We
# could backport it from Experimental, which is what we do on Jenkins, but
# since we don't build an updater, we might as well just do the nightly qTox
# build: no updater, no installer.
#
# - FFmpeg 3.3 doesn't cross-compile correctly, qTox build fails when linking
# against the 3.3 FFmpeg. They have removed `--enable-memalign-hack` switch,
# which might be what causes this.
# which might be what causes this. Further research needed.
set -euo pipefail
@ -53,29 +48,28 @@ readonly QTOX_SRC_DIR="/qtox" @@ -53,29 +48,28 @@ readonly QTOX_SRC_DIR="/qtox"
# Make sure we run in an expected environment
if ! grep -q 'buntu 16\.04' /etc/lsb-release
if [ ! -f /etc/os-release ] || ! cat /etc/os-release | grep -qi 'stretch'
then
echo "Error: This script should be run on Ubuntu 16.04."
exit 1
echo "Error: This script should be run on Debian Stretch."
exit 1
fi
if [ ! -d "$WORKSPACE_DIR" ] || [ ! -d "$SCRIPT_DIR" ] || [ ! -d "$QTOX_SRC_DIR" ]
then
echo "Error: At least one of $WORKSPACE_DIR, $SCRIPT_DIR or $QTOX_SRC_DIR directories is missing."
exit 1
echo "Error: At least one of $WORKSPACE_DIR, $SCRIPT_DIR or $QTOX_SRC_DIR directories is missing."
exit 1
fi
if [ ! -d "$QTOX_SRC_DIR/src" ]
then
echo "Error: $QTOX_SRC_DIR/src directory is missing, make sure $QTOX_SRC_DIR contains qTox source code."
exit 1
echo "Error: $QTOX_SRC_DIR/src directory is missing, make sure $QTOX_SRC_DIR contains qTox source code."
exit 1
fi
if [ "$(id -u)" != "0" ]
if [[ "$(id -u)" != "0" ]]
then
echo "Error: This script must be run as root."
exit 1
echo "Error: This script must be run as root."
exit 1
fi
@ -148,6 +142,17 @@ then @@ -148,6 +142,17 @@ then
fi
# Install wine to run qTox tests in
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
dpkg --add-architecture i386
apt-get update
apt-get install -y wine wine32 wine64
fi
set -u
# Create the expected directory structure
# Just make sure those exist
@ -168,6 +173,7 @@ export MAKEFLAGS @@ -168,6 +173,7 @@ export MAKEFLAGS
# Helper functions
# We check sha256 of all tarballs we download
check_sha256()
{
if ! ( echo "$1 $2" | sha256sum -c --status - )
@ -182,19 +188,45 @@ check_sha256() @@ -182,19 +188,45 @@ check_sha256()
fi
}
# If it's not a tarball but a git repo, let's check a hash of a file containing hashes of all files
check_sha256_git()
{
# There shoudl be .git directory
if [ ! -d ".git" ]
then
echo "Error: this function should be called in the root of a git repository."
exit 1
fi
# Create a file listing hashes of all the files except .git/*
find . -type f | grep -v "^./.git" | LC_COLLATE=C sort --stable --ignore-case | xargs sha256sum > /tmp/hashes.sha
check_sha256 "$1" "/tmp/hashes.sha"
}
# Strip binaries to reduce file size, we don't need this information anyway
strip_all()
{
set +e
for PREFIX_DIR in $DEP_DIR/*; do
strip --strip-unneeded $PREFIX_DIR/bin/*
$ARCH-w64-mingw32-strip --strip-unneeded $PREFIX_DIR/bin/*
$ARCH-w64-mingw32-strip --strip-unneeded $PREFIX_DIR/lib/*
done
set -e
}
# OpenSSL
OPENSSL_PREFIX_DIR="$DEP_DIR/libopenssl"
OPENSSL_VERSION=1.0.2l
OPENSSL_HASH="ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c"
if [ ! -f "$OPENSSL_PREFIX_DIR/done" ]
then
rm -rf "$OPENSSL_PREFIX_DIR"
mkdir -p "$OPENSSL_PREFIX_DIR"
OPENSSL_VERSION=1.0.2l
wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
check_sha256 "ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c" "openssl-$OPENSSL_VERSION.tar.gz"
check_sha256 "$OPENSSL_HASH" "openssl-$OPENSSL_VERSION.tar.gz"
bsdtar -xf openssl*.tar.gz
rm openssl*.tar.gz
cd openssl*
@ -211,18 +243,25 @@ then @@ -211,18 +243,25 @@ then
./Configure $CONFIGURE_OPTIONS
make
make install
touch $OPENSSL_PREFIX_DIR/done
echo -n $OPENSSL_VERSION > $OPENSSL_PREFIX_DIR/done
CONFIGURE_OPTIONS=""
cd ..
rm -rf ./openssl*
else
echo "Using cached build of OpenSSL `cat $OPENSSL_PREFIX_DIR/done`"
fi
# Qt
QT_PREFIX_DIR="$DEP_DIR/libqt5"
QT_MAJOR=5
QT_MINOR=9
QT_PATCH=2
QT_VERSION=$QT_MAJOR.$QT_MINOR.$QT_PATCH
QT_HASH="6c6171a4d1ea3fbd4212d6a04899650218583df3ec583a8a6a4a589fe18620ff"
if [ ! -f "$QT_PREFIX_DIR/done" ]
then
rm -rf "$QT_PREFIX_DIR"
@ -230,13 +269,8 @@ then @@ -230,13 +269,8 @@ then
QT_MIRROR=http://qt.mirror.constant.com
QT_MAJOR=5
QT_MINOR=6
QT_PATCH=3
QT_VERSION=$QT_MAJOR.$QT_MINOR.$QT_PATCH
wget $QT_MIRROR/official_releases/qt/$QT_MAJOR.$QT_MINOR/$QT_VERSION/single/qt-everywhere-opensource-src-$QT_VERSION.tar.xz
check_sha256 "2fa0cf2e5e8841b29a4be62062c1a65c4f6f2cf1beaf61a5fd661f520cd776d0" "qt-everywhere-opensource-src-$QT_VERSION.tar.xz"
check_sha256 "$QT_HASH" "qt-everywhere-opensource-src-$QT_VERSION.tar.xz"
bsdtar -xf qt*.tar.xz
rm qt*.tar.xz
cd qt*
@ -244,6 +278,20 @@ then @@ -244,6 +278,20 @@ then
export PKG_CONFIG_PATH="$OPENSSL_PREFIX_DIR/lib/pkgconfig"
export OPENSSL_LIBS="$(pkg-config --libs openssl)"
# Fix https://bugreports.qt.io/browse/QTBUG-63637 present in Qt 5.9.2
echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf
echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf
# So, apparently Travis CI terminate a build if it generates more than 4mb of output
# which happens when building Qt
CONFIGURE_EXTRA=""
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage1" ]]
then
CONFIGURE_EXTRA="-silent"
fi
set -u
./configure -prefix $QT_PREFIX_DIR \
-release \
-shared \
@ -256,22 +304,42 @@ then @@ -256,22 +304,42 @@ then
-nomake examples \
-nomake tools \
-nomake tests \
-skip translations \
-skip doc \
-skip qtdeclarative \
-skip 3d \
-skip activeqt \
-skip qtwebsockets \
-skip qtscript \
-skip qtquickcontrols \
-skip qtconnectivity \
-skip qtenginio \
-skip qtsensors \
-skip qtserialport \
-skip qtlocation \
-skip qtgraphicaleffects \
-skip qtimageformats \
-skip webchannel \
-skip androidextras \
-skip canvas3d \
-skip charts \
-skip connectivity \
-skip datavis3d \
-skip declarative \
-skip doc \
-skip enginio \
-skip gamepad \
-skip graphicaleffects \
-skip imageformats \
-skip location \
-skip macextras \
-skip multimedia \
-skip networkauth \
-skip purchasing \
-skip quickcontrols \
-skip quickcontrols2 \
-skip remoteobjects \
-skip script \
-skip scxml \
-skip sensors \
-skip serialbus \
-skip serialport \
-skip speech \
-skip translations \
-skip virtualkeyboard \
-skip wayland \
-skip webchannel \
-skip webengine \
-skip websockets \
-skip webview \
-skip x11extras \
-skip xmlpatterns \
-no-dbus \
-no-icu \
-no-qml-debug \
@ -279,34 +347,51 @@ then @@ -279,34 +347,51 @@ then
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-qt-pcre
-qt-pcre \
-opengl desktop $CONFIGURE_EXTRA
make
make install
touch $QT_PREFIX_DIR/done
echo -n $QT_VERSION > $QT_PREFIX_DIR/done
unset PKG_CONFIG_PATH
unset OPENSSL_LIBS
cd ..
rm -rf ./qt*
else
echo "Using cached build of Qt `cat $QT_PREFIX_DIR/done`"
fi
# Stop here if running the first stage on Travis CI
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage1" ]]
then
# Strip to reduce cache size
strip_all
# Chmod since everything is root:root
chmod 777 -R "$WORKSPACE_DIR"
exit 0
fi
set -u
# SQLCipher
SQLCIPHER_PREFIX_DIR="$DEP_DIR/libsqlcipher"
SQLCIPHER_VERSION=v3.4.1
SQLCIPHER_HASH="4172cc6e5a79d36e178d36bd5cc467a938e08368952659bcd95eccbaf0fa4ad4"
if [ ! -f "$SQLCIPHER_PREFIX_DIR/done" ]
then
rm -rf "$SQLCIPHER_PREFIX_DIR"
mkdir -p "$SQLCIPHER_PREFIX_DIR"
git clone \
--branch v3.4.1 \
--depth 1 \
https://github.com/sqlcipher/sqlcipher \
sqlcipher
cd sqlcipher
wget https://github.com/sqlcipher/sqlcipher/archive/$SQLCIPHER_VERSION.tar.gz -O sqlcipher.tar.gz
check_sha256 "$SQLCIPHER_HASH" "sqlcipher.tar.gz"
bsdtar -xf sqlcipher.tar.gz
rm sqlcipher.tar.gz
cd sqlcipher*
sed -i s/'LIBS="-lcrypto $LIBS"'/'LIBS="-lcrypto -lgdi32 $LIBS"'/g configure
sed -i s/'LIBS="-lcrypto $LIBS"'/'LIBS="-lcrypto -lgdi32 $LIBS"'/g configure
@ -342,24 +427,29 @@ EOF @@ -342,24 +427,29 @@ EOF
make
make install
touch $SQLCIPHER_PREFIX_DIR/done
echo -n $SQLCIPHER_VERSION > $SQLCIPHER_PREFIX_DIR/done
cd ..
rm -rf ./sqlcipher
rm -rf ./sqlcipher*
else
echo "Using cached build of SQLCipher `cat $SQLCIPHER_PREFIX_DIR/done`"
fi
# FFmpeg
FFMPEG_PREFIX_DIR="$DEP_DIR/libffmpeg"
FFMPEG_VERSION=3.2.8
FFMPEG_HASH="42e7362692318afc666f14378dd445effa9a1b09787504a6ab5811fe442674cd"
if [ ! -f "$FFMPEG_PREFIX_DIR/done" ]
then
rm -rf "$FFMPEG_PREFIX_DIR"
mkdir -p "$FFMPEG_PREFIX_DIR"
wget https://www.ffmpeg.org/releases/ffmpeg-3.2.6.tar.xz
check_sha256 "3751cebb5c71a861288267769114d12b966a7703a686a325d90a93707f3a6d9f" "ffmpeg-3.2.6.tar.xz"
wget https://www.ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.xz
check_sha256 "$FFMPEG_HASH" "ffmpeg-$FFMPEG_VERSION.tar.xz"
bsdtar -xf ffmpeg*.tar.xz
rm ffmpeg*.tar.xz
cd ffmpeg*
if [[ "$ARCH" == "x86_64"* ]]
@ -419,18 +509,22 @@ then @@ -419,18 +509,22 @@ then
--enable-memalign-hack
make
make install
touch $FFMPEG_PREFIX_DIR/done
echo -n $FFMPEG_VERSION > $FFMPEG_PREFIX_DIR/done
CONFIGURE_OPTIONS=""
cd ..
rm -rf ./ffmpeg*
else
echo "Using cached build of FFmpeg `cat $FFMPEG_PREFIX_DIR/done`"
fi
# Openal-soft (irungentoo's fork)
OPENAL_PREFIX_DIR="$DEP_DIR/libopenal"
OPENAL_VERSION=b80570bed017de60b67c6452264c634085c3b148
OPENAL_HASH="734ef00895a9c1eb1505c11d638030b73593376df75da66ac5db6aa3e2f76807"
if [ ! -f "$OPENAL_PREFIX_DIR/done" ]
then
rm -rf "$OPENAL_PREFIX_DIR"
@ -438,7 +532,11 @@ then @@ -438,7 +532,11 @@ then
git clone https://github.com/irungentoo/openal-soft-tox openal-soft-tox
cd openal*
git checkout b80570bed017de60b67c6452264c634085c3b148
git checkout $OPENAL_VERSION
check_sha256_git "$OPENAL_HASH"
mkdir -p build
cd build
echo "
SET(CMAKE_SYSTEM_NAME Windows)
@ -462,20 +560,27 @@ then @@ -462,20 +560,27 @@ then
-DALSOFT_EXAMPLES=OFF \
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DDSOUND_INCLUDE_DIR=/usr/$ARCH-w64-mingw32/include \
-DDSOUND_LIBRARY=/usr/$ARCH-w64-mingw32/lib/libdsound.a
-DDSOUND_LIBRARY=/usr/$ARCH-w64-mingw32/lib/libdsound.a \
..
make
make install
touch $OPENAL_PREFIX_DIR/done
echo -n $OPENAL_VERSION > $OPENAL_PREFIX_DIR/done
cd ..
cd ..
rm -rf ./openal*
else
echo "Using cached build of irungentoo's OpenAL-Soft fork `cat $OPENAL_PREFIX_DIR/done`"
fi
# Filteraudio
FILTERAUDIO_PREFIX_DIR="$DEP_DIR/libfilteraudio"
FILTERAUDIO_VERSION=ada2f4fdc04940cdeee47caffe43add4fa017096
FILTERAUDIO_HASH="cf481e87c860aaf28b50d125195d84556f36d0ebb529d7ebdac39f8cc497256a"
if [ ! -f "$FILTERAUDIO_PREFIX_DIR/done" ]
then
rm -rf "$FILTERAUDIO_PREFIX_DIR"
@ -483,7 +588,8 @@ then @@ -483,7 +588,8 @@ then
git clone https://github.com/irungentoo/filter_audio filter_audio
cd filter*
git checkout ada2f4fdc04940cdeee47caffe43add4fa017096
git checkout $FILTERAUDIO_VERSION
check_sha256_git "$FILTERAUDIO_HASH"
$ARCH-w64-mingw32-gcc -O2 -g0 -c \
aec/aec_core.c \
@ -591,23 +697,27 @@ then @@ -591,23 +697,27 @@ then
mkdir $FILTERAUDIO_PREFIX_DIR/lib
cp filter_audio.h $FILTERAUDIO_PREFIX_DIR/include
cp libfilteraudio.a $FILTERAUDIO_PREFIX_DIR/lib
touch $FILTERAUDIO_PREFIX_DIR/done
echo -n $FILTERAUDIO_VERSION > $FILTERAUDIO_PREFIX_DIR/done
cd ..
rm -rf ./filter*
else
echo "Using cached build of Filteraudio `cat $FILTERAUDIO_PREFIX_DIR/done`"
fi
# QREncode
QRENCODE_PREFIX_DIR="$DEP_DIR/libqrencode"
QRENCODE_VERSION=3.4.4
QRENCODE_HASH="efe5188b1ddbcbf98763b819b146be6a90481aac30cfc8d858ab78a19cde1fa5"
if [ ! -f "$QRENCODE_PREFIX_DIR/done" ]
then
rm -rf "$QRENCODE_PREFIX_DIR"
mkdir -p "$QRENCODE_PREFIX_DIR"
wget https://fukuchi.org/works/qrencode/qrencode-3.4.4.tar.bz2
check_sha256 "efe5188b1ddbcbf98763b819b146be6a90481aac30cfc8d858ab78a19cde1fa5" "qrencode-3.4.4.tar.bz2"
wget https://fukuchi.org/works/qrencode/qrencode-$QRENCODE_VERSION.tar.bz2
check_sha256 "$QRENCODE_HASH" "qrencode-$QRENCODE_VERSION.tar.bz2"
bsdtar -xf qrencode*.tar.bz2
rm qrencode*.tar.bz2
cd qrencode*
@ -621,23 +731,27 @@ then @@ -621,23 +731,27 @@ then
--without-debug
make
make install
touch $QRENCODE_PREFIX_DIR/done
echo -n $QRENCODE_VERSION > $QRENCODE_PREFIX_DIR/done
cd ..
rm -rf ./qrencode*
else
echo "Using cached build of QREncode `cat $QRENCODE_PREFIX_DIR/done`"
fi
# Exif
EXIF_PREFIX_DIR="$DEP_DIR/libexif"
EXIF_VERSION=0.6.21
EXIF_HASH="16cdaeb62eb3e6dfab2435f7d7bccd2f37438d21c5218ec4e58efa9157d4d41a"
if [ ! -f "$EXIF_PREFIX_DIR/done" ]
then
rm -rf "$EXIF_PREFIX_DIR"
mkdir -p "$EXIF_PREFIX_DIR"
wget https://sourceforge.net/projects/libexif/files/libexif/0.6.21/libexif-0.6.21.tar.bz2
check_sha256 "16cdaeb62eb3e6dfab2435f7d7bccd2f37438d21c5218ec4e58efa9157d4d41a" "libexif-0.6.21.tar.bz2"
wget https://sourceforge.net/projects/libexif/files/libexif/0.6.21/libexif-$EXIF_VERSION.tar.bz2
check_sha256 "$EXIF_HASH" "libexif-$EXIF_VERSION.tar.bz2"
bsdtar -xf libexif*.tar.bz2
rm libexif*.tar.bz2
cd libexif*
@ -650,29 +764,31 @@ then @@ -650,29 +764,31 @@ then
--disable-nls
make
make install
touch $EXIF_PREFIX_DIR/done
echo -n $EXIF_VERSION > $EXIF_PREFIX_DIR/done
cd ..
rm -rf ./libexif*
else
echo "Using cached build of Exif `cat $EXIF_PREFIX_DIR/done`"
fi
# Opus
OPUS_PREFIX_DIR="$DEP_DIR/libopus"
OPUS_VERSION=1.2.1
OPUS_HASH="cfafd339ccd9c5ef8d6ab15d7e1a412c054bf4cb4ecbbbcc78c12ef2def70732"
if [ ! -f "$OPUS_PREFIX_DIR/done" ]
then
rm -rf "$OPUS_PREFIX_DIR"
mkdir -p "$OPUS_PREFIX_DIR"
git clone \
--branch v1.2.1 \
--depth 1 \
git://git.opus-codec.org/opus.git \
opus
cd opus
wget https://archive.mozilla.org/pub/opus/opus-$OPUS_VERSION.tar.gz
check_sha256 "$OPUS_HASH" "opus-$OPUS_VERSION.tar.gz"
bsdtar -xf opus*.tar.gz
rm opus*.tar.gz
cd opus*
./autogen.sh
CFLAGS="-O2 -g0" ./configure --host="$ARCH-w64-mingw32" \
--prefix="$OPUS_PREFIX_DIR" \
--disable-shared \
@ -681,29 +797,31 @@ then @@ -681,29 +797,31 @@ then
--disable-doc
make
make install
touch $OPUS_PREFIX_DIR/done
echo -n $OPUS_VERSION > $OPUS_PREFIX_DIR/done
cd ..
rm -rf ./opus
rm -rf ./opus*
else
echo "Using cached build of Opus `cat $OPUS_PREFIX_DIR/done`"
fi
# Sodium
SODIUM_PREFIX_DIR="$DEP_DIR/libsodium"
SODIUM_VERSION=1.0.15
SODIUM_HASH="fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4"
if [ ! -f "$SODIUM_PREFIX_DIR/done" ]
then
rm -rf "$SODIUM_PREFIX_DIR"
mkdir -p "$SODIUM_PREFIX_DIR"
git clone \
--branch 1.0.13 \
--depth 1 \
https://github.com/jedisct1/libsodium \
libsodium
cd libsodium
wget https://download.libsodium.org/libsodium/releases/libsodium-$SODIUM_VERSION.tar.gz
check_sha256 "$SODIUM_HASH" "libsodium-$SODIUM_VERSION.tar.gz"
bsdtar -xf libsodium*.tar.gz
rm libsodium*.tar.gz
cd libsodium*
./autogen.sh
./configure --host="$ARCH-w64-mingw32" \
--prefix="$SODIUM_PREFIX_DIR" \
--disable-shared \
@ -711,27 +829,30 @@ then @@ -711,27 +829,30 @@ then
--with-pic
make
make install
touch $SODIUM_PREFIX_DIR/done
echo -n $SODIUM_VERSION > $SODIUM_PREFIX_DIR/done
cd ..
rm -rf ./libsodium
rm -rf ./libsodium*
else
echo "Using cached build of Sodium `cat $SODIUM_PREFIX_DIR/done`"
fi
# VPX
VPX_PREFIX_DIR="$DEP_DIR/libvpx"
VPX_VERSION=1.6.1
VPX_HASH="1c2c0c2a97fba9474943be34ee39337dee756780fc12870ba1dc68372586a819"
if [ ! -f "$VPX_PREFIX_DIR/done" ]
then
rm -rf "$VPX_PREFIX_DIR"
mkdir -p "$VPX_PREFIX_DIR"
git clone \
--branch v1.6.1 \
--depth 1 \
https://github.com/webmproject/libvpx \
libvpx
cd libvpx
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-$VPX_VERSION.tar.bz2
check_sha256 "$VPX_HASH" "libvpx-$VPX_VERSION.tar.bz2"
bsdtar -xf libvpx-*.tar.bz2
rm libvpx*.tar.bz2
cd libvpx*
if [[ "$ARCH" == "x86_64" ]]
then
@ -742,36 +863,42 @@ then @@ -742,36 +863,42 @@ then
fi
CROSS="$ARCH-w64-mingw32-" ./configure --target="$VPX_TARGET" \
--prefix="$VPX_PREFIX_DIR" \
--disable-shared \
--enable-static \
--disable-examples \
--disable-tools \
--disable-docs \
--disable-unit-tests
--prefix="$VPX_PREFIX_DIR" \
--disable-shared \
--enable-static \
--disable-examples \
--disable-tools \
--disable-docs \
--disable-unit-tests
make
make install
touch $VPX_PREFIX_DIR/done
echo -n $VPX_VERSION > $VPX_PREFIX_DIR/done
cd ..
rm -rf ./libvpx
rm -rf ./libvpx*
else
echo "Using cached build of VPX `cat $VPX_PREFIX_DIR/done`"
fi
# Toxcore
TOXCORE_PREFIX_DIR="$DEP_DIR/libtoxcore"
TOXCORE_VERSION=0.1.10
TOXCORE_HASH=4e9a2881dd0ea8e65a35fc9621644ccf500c1797a2d37983b0057ed3be971299
if [ ! -f "$TOXCORE_PREFIX_DIR/done" ]
then
rm -rf "$TOXCORE_PREFIX_DIR"
mkdir -p "$TOXCORE_PREFIX_DIR"
git clone \
--branch v0.1.10 \
--depth 1 \
https://github.com/TokTok/c-toxcore \
c-toxcore
cd c-toxcore
wget https://github.com/TokTok/c-toxcore/releases/download/v$TOXCORE_VERSION/c-toxcore-$TOXCORE_VERSION.tar.gz
check_sha256 "$TOXCORE_HASH" "c-toxcore-$TOXCORE_VERSION.tar.gz"
bsdtar -xf c-toxcore*.tar.gz
rm c-toxcore*.tar.gz
cd c-toxcore*
mkdir -p build
cd build
export PKG_CONFIG_PATH="$OPUS_PREFIX_DIR/lib/pkgconfig:$SODIUM_PREFIX_DIR/lib/pkgconfig:$VPX_PREFIX_DIR/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="/usr/$ARCH-w64-mingw32"
@ -787,34 +914,72 @@ then @@ -787,34 +914,72 @@ then
" > toolchain.cmake
cmake -DCMAKE_INSTALL_PREFIX=$TOXCORE_PREFIX_DIR \
-DBOOTSTRAP_DAEMON=OFF \
-DWARNINGS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_STATIC=ON \
-DENABLE_SHARED=OFF \
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake
-DBOOTSTRAP_DAEMON=OFF \
-DWARNINGS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_STATIC=ON \
-DENABLE_SHARED=OFF \
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
..
make
make install
touch $TOXCORE_PREFIX_DIR/done
echo -n $TOXCORE_VERSION > $TOXCORE_PREFIX_DIR/done
unset PKG_CONFIG_PATH
unset PKG_CONFIG_LIBDIR
cd ..
rm -rf ./c-toxcore
cd ..
rm -rf ./c-toxcore*
else
echo "Using cached build of Toxcore `cat $TOXCORE_PREFIX_DIR/done`"
fi
# Strip to reduce file size, we don't need this information anyway.
# mingw-w64-debug-scripts
set +e
for PREFIX_DIR in $DEP_DIR/*; do
strip --strip-unneeded $PREFIX_DIR/bin/*
$ARCH-w64-mingw32-strip --strip-unneeded $PREFIX_DIR/bin/*
$ARCH-w64-mingw32-strip --strip-unneeded $PREFIX_DIR/lib/*
done
set -e
MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR="$DEP_DIR/mingw-w64-debug-scripts"
MINGW_W64_DEBUG_SCRIPTS_VERSION=7341e1ffdea352e5557f3fcae51569f13e1ef270
MINGW_W64_DEBUG_SCRIPTS_HASH="a92883ddfe83780818347fda4ac07bce61df9226818df2f52fe4398fe733e204"
if [ ! -f "$MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/done" ]
then
rm -rf "$MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR"
mkdir -p "$MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR"
# Get dbg executable and the debug scripts
git clone https://github.com/nurupo/mingw-w64-debug-scripts mingw-w64-debug-scripts
cd mingw-w64-debug-scripts
git checkout $MINGW_W64_DEBUG_SCRIPTS_VERSION
check_sha256_git "$MINGW_W64_DEBUG_SCRIPTS_HASH"
make $ARCH EXE_NAME=qtox.exe
mkdir -p "$MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/bin"
mv output/$ARCH/* "$MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/bin/"
echo -n $MINGW_W64_DEBUG_SCRIPTS_VERSION > $MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/done
cd ..
rm -rf ./mingw-w64-debug-scripts
else
echo "Using cached build of mingw-w64-debug-scripts `cat $MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/done`"
fi
# Stop here if running the second stage on Travis CI
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage2" ]]
then
# Strip to reduce cache size
strip_all
# Chmod since everything is root:root
chmod 777 -R "$WORKSPACE_DIR"
exit 0
fi
set -u
strip_all
# qTox
@ -829,7 +994,7 @@ cd qtox @@ -829,7 +994,7 @@ cd qtox
cp -a $QTOX_SRC_DIR/. .
rm -rf ./build
mkdir build
mkdir -p build
cd build
PKG_CONFIG_PATH=""
@ -854,6 +1019,13 @@ echo " @@ -854,6 +1019,13 @@ echo "
SET(CMAKE_FIND_ROOT_PATH /usr/$ARCH-w64-mingw32 $CMAKE_FIND_ROOT_PATH)
" > toolchain.cmake
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
echo "SET(TEST_CROSSCOMPILING_EMULATOR /usr/bin/wine)" >> toolchain.cmake
fi
set -u
if [[ "$BUILD_TYPE" == "release" ]]
then
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake \
@ -888,6 +1060,25 @@ cp /usr/lib/gcc/$ARCH-w64-mingw32/*-posix/libgcc_s_*.dll $QTOX_PREFIX_DIR @@ -888,6 +1060,25 @@ cp /usr/lib/gcc/$ARCH-w64-mingw32/*-posix/libgcc_s_*.dll $QTOX_PREFIX_DIR
cp /usr/lib/gcc/$ARCH-w64-mingw32/*-posix/libstdc++-6.dll $QTOX_PREFIX_DIR
cp /usr/$ARCH-w64-mingw32/lib/libwinpthread-1.dll $QTOX_PREFIX_DIR
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
# Setup wine
if [[ "$ARCH" == "i686" ]]
then
export WINEARCH=win32
elif [[ "$ARCH" == "x86_64" ]]
then
export WINEARCH=win64
fi
winecfg
# Add libgcc_s_*.dll, libwinpthread-1.dll, QtTest.dll, etc. into PATH env var of wine
export WINEPATH=`cd $QTOX_PREFIX_DIR ; winepath -w $(pwd)`\;`winepath -w $QT_PREFIX_DIR/bin/`
export CTEST_OUTPUT_ON_FAILURE=1
make test
fi
set -u
cd ..
# Setup gdb
@ -898,12 +1089,7 @@ then @@ -898,12 +1089,7 @@ then
cp -r "$PWD/src" "$QTOX_PREFIX_DIR/$PWD"
# Get dbg executable and the debug scripts
git clone https://github.com/nurupo/mingw-w64-debug-scripts
cd mingw-w64-debug-scripts
git checkout 7341e1ffdea352e5557f3fcae51569f13e1ef270
make $ARCH EXE_NAME=qtox.exe
mv output/$ARCH/* "$QTOX_PREFIX_DIR/"
cd ..
cp -r $MINGW_W64_DEBUG_SCRIPTS_PREFIX_DIR/bin/* "$QTOX_PREFIX_DIR/"
fi
# Strip

Loading…
Cancel
Save