From 56abc19dab1978f6dea2682d353b18c1eb0800bd Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 04:59:40 -0400 Subject: [PATCH 1/6] chore(windows): bump Qt 5.9 version to the latest (5.9.5) --- windows/cross-compile/build.sh | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index 943ea02f6..d7383c0a8 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -262,10 +262,10 @@ fi QT_PREFIX_DIR="$DEP_DIR/libqt5" QT_MAJOR=5 QT_MINOR=9 -QT_PATCH=4 +QT_PATCH=5 QT_VERSION=$QT_MAJOR.$QT_MINOR.$QT_PATCH -# hash from https://download.qt.io/archive/qt/5.9/5.9.4/single/qt-everywhere-opensource-src-5.9.4.tar.xz.mirrorlist -QT_HASH="e3acd9cbeafba3aed9f14592f4d70bf0b255e0203943e8d2b4235002268274d5" +# hash from https://download.qt.io/archive/qt/5.9/5.9.5/single/qt-everywhere-opensource-src-5.9.5.tar.xz.mirrorlist +QT_HASH="a75b87f46240a374fde93fb60038d63e3b570457785268c766c639b5dc18ccf6" if [ ! -f "$QT_PREFIX_DIR/done" ] then rm -rf "$QT_PREFIX_DIR" @@ -280,18 +280,6 @@ then export PKG_CONFIG_PATH="$OPENSSL_PREFIX_DIR/lib/pkgconfig" export OPENSSL_LIBS="$(pkg-config --libs openssl)" - # Fix https://bugreports.qt.io/browse/QTBUG-66123 present in Qt 5.9.4 - cd qtbase - wget https://github.com/qt/qtbase/commit/40e87491886957696486b87dc2dedec2adaf6e1a.patch -O "QTBUG-66123.patch" - check_sha256 "15c4e6f0eba90a67fee3faabd86ca670a3021ac49d19fd9b311e16615bce87a6" "QTBUG-66123.patch" - patch -p1 < "QTBUG-66123.patch" - rm "QTBUG-66123.patch" - cd .. - - # 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 terminates a build if it generates more than 4mb of stdout output # which happens when building Qt CONFIGURE_EXTRA="" From a690e4e6b7c46ec29b2e9fadd0f9b1e5b3deb988 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 05:03:01 -0400 Subject: [PATCH 2/6] chore: typos --- windows/cross-compile/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index d7383c0a8..2c122e202 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -977,11 +977,11 @@ then # We want to use NSIS 3, instead of NSIS 2, because it added Windows 8 and 10 # support, as well as unicode support. NSIS 3 is not packaged in Debian Stretch - # and building it manually appears to be quite a challenge. Luckly it's - # packaged in Debian Unstable, so we can backport it to our Debian version + # and building it manually appears to be quite a challenge. Luckily it's + # packaged in Debian Unstable, so we can backport it to our Debian version # with little effort, utilizing maintainer's build script. - # Kepp the indentation of the next echo command as it is, as apt seems to + # Keep the indentation of the next echo command as it is, as apt seems to # ignore preferences starting with whitespace. echo " Package: * From 17d7c80d56f4dd03910c0eeb6ce2df0e3952e021 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 05:06:08 -0400 Subject: [PATCH 3/6] chore(windows): the installer does get built now --- windows/cross-compile/README.md | 3 +-- windows/cross-compile/build.sh | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/windows/cross-compile/README.md b/windows/cross-compile/README.md index 7ed64ab02..8fa64d413 100644 --- a/windows/cross-compile/README.md +++ b/windows/cross-compile/README.md @@ -6,8 +6,7 @@ Following these instructions will show you how to cross-compile qTox for Windows This script can be used by qTox users and devs to compile qTox for windows themselves. -Please note that the compilation script doesn't build the updater and doesn't produce -an installer. +Please note that the compilation script doesn't build the updater. ## Usage diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index 2c122e202..48e351eef 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -27,11 +27,6 @@ # 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 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. Further research needed. From 4f22640b9f54a3151a64fdaf4a765a23334b499d Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 06:09:46 -0400 Subject: [PATCH 4/6] refactor(docs): re-format Windows cross-compilation instructions --- windows/cross-compile/README.md | 171 +++++++++++++++++--------------- 1 file changed, 92 insertions(+), 79 deletions(-) diff --git a/windows/cross-compile/README.md b/windows/cross-compile/README.md index 8fa64d413..98dc34770 100644 --- a/windows/cross-compile/README.md +++ b/windows/cross-compile/README.md @@ -2,126 +2,139 @@ ## Intro -Following these instructions will show you how to cross-compile qTox for Windows. +Following these instructions you will be able to cross-compile qTox for +Windows. -This script can be used by qTox users and devs to compile qTox for windows themselves. +This script can be used by qTox users and devs to compile qTox for Windows +themselves. Please note that the compilation script doesn't build the updater. ## Usage +[Install Docker](https://docs.docker.com/install). -#### 1. [Install Docker](https://docs.docker.com/install). -*** - - -#### 2. Create 3 directories for storing the files needed for cross-compiling. -*** +Create 3 directories: * `workspace` -- a directory that will contain a cache of qTox dependencies and the final qTox cross-compilation build. You should create this directory. - * `script` -- a directory that contains the `build.sh` script. - Copy the `build.sh` script to this folder. + * `qtox` -- the root directory of a qTox repository. This directory must + contain the qTox source code that will be cross-compiled. - * `qtox` -- the root directory of a qTox repository. This directory must contain - the qTox source code that will be cross-compiled. You can use an existing qTox - directory you've been using for development or check one out using - `git clone https://github.com/qTox/qTox.git folder-name` + * `script` -- a directory that contains the `build.sh` script. You could + create this directory and copy the `build.sh` script in it, or you + could just use the `qtox/windows/cross-compile` directory for this. -These directories will be mounted inside a Docker container at`/workspace`, -`/script`and`/qtox`. +These directories will be mounted inside a Docker container at `/workspace`, +`/qtox` and `/script`. -The contents of `qtox` and `script` directories are not modified during compilation. The -`build.sh` script makes a temporary copy of the `qtox` directory for compilation. +The contents of `qtox` and `script` directories are not modified during +compilation. The `build.sh` script makes a temporary copy of the `qtox` +directory for compilation. +Once you sort out the directories, you are ready to run the `build.sh` script +in a Docker container. -#### 3. Create the docker container and run the build script. -*** -> Note that the`build.sh`script takes 2 arguments: architecture and build type. -> Valid values for the architecture are `i686` for 32-bit and `x86_64` for -> 64-bit. Valid values for the build type are `release` and `debug`. All case -> sensitive. You can modify the scripts below to fit your use case. -> To create the docker container and start cross-compiling run +> Note: +> The`build.sh` script takes 2 arguments: architecture and build type. +> Valid values for the architecture are `i686` for 32-bit and `x86_64` for +> 64-bit. Valid values for the build type are `release` and `debug`. All +> case sensitive. +To start cross-compiling for 32-bit release version of qTox run: ```sh 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 \ -debian:stretch-slim \ -/bin/bash /script/build.sh i686 release + -v /absolute/path/to/your/workspace:/workspace \ + -v /absolute/path/to/your/script:/script \ + -v /absolute/path/to/your/qtox:/qtox \ + debian:stretch-slim \ + /bin/bash /script/build.sh i686 release ``` - -If you are a qTox developer, you might want to enable tty and leave stdin open by running the following script instead. +If you want to debug some compilation issue, you might want to instead run: ```sh +# 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 \ -debian:stretch-slim \ -/bin/bash /script/build.sh i686 release + --rm \ + -v /absolute/path/to/your/workspace:/workspace \ + -v /absolute/path/to/your/script:/script \ + -v /absolute/path/to/your/qtox:/qtox \ + debian:stretch-slim \ + /bin/bash +# Run the script +bash /script/build.sh i686 release ``` + These will cross-compile all of the qTox dependencies and qTox itself, storing them in the `workspace` directory. The first time you run it for each architecture, it will take a long time for the cross-compilation to finish, as -qTox has a lot of dependencies that need to be cross-compiled. +qTox has a lot of dependencies that need to be cross-compiled. But once you do +it once for each architecture, the dependencies will get cached inside the +`workspace` directory, and the next time you build qTox, the `build.sh` script +will skip recompiling them, going straight to compiling qTox, which is a lot +faster. +> Note: +> On a certain Intel Core i7 processor, a fresh build takes about 125 +> minutes on a single core, and about 30 minutes using all 8 hyperthreads. +> Once built, however, it takes about 8 minutes on a single core and 2 +> minutes using 8 hyperthreads to rebuild using the cached dependencies. -> Note that it takes my Intel Core i7 processor about 125 minutes on average for the cross-compilation -> to finish on a single core, and about 30 minutes using all 8 hyperthreads. Once you've compiled -> it, the dependencies will be cached inside the `workspace` directory. The next time -> you build qTox, the `build.sh` script will skip recompiling them -> which is a lot faster -- about 8 minutes on a single core and 2 minutes using 8 hyperthreads. +After cross-compiling has finished, you should find the comiled qTox in a +`workspace\i686\qtox` or `workspace\x86_64\qtox\` directory, depending on the +architecture. - -#### 4. After cross-compiling has finished -*** -The `workspace\i686\qtox` and `workspace\x86_64\qtox\`directories will contain the compiled binaries in their respective debug or release folder depending on the compilation settings you chose in Step 3. - -The `dep-cache` directory is where all the cross-compiled qTox dependencies will be -cached for the future builds. You can remove any directory inside the `deps` folder, which -will result in the `build.sh` re-compiling the removed dependency. +You will also find `workspace\dep-cache` directory, where all the +cross-compiled qTox dependencies will be cached for the future builds. You can +remove any directory inside the `dep-cache`, which will result in the +`build.sh` re-compiling the removed dependency only. _The `workspace` direcory structure for reference_ ``` -workspace +workspace/ ├── i686 -│ ├── dep-cache -│ │ ├── libffmpeg -│ │ ├── libfilteraudio -│ │ ├── libopenal -│ │ ├── libopenssl -│ │ ├── libopus -│ │ ├── libqrencode -│ │ ├── libqt5 -│ │ ├── libsodium -│ │ ├── libsqlcipher -│ │ ├── libtoxcore -│ │ └── libvpx -│ └── qtox -│ ├── debug -│ └── release +│   ├── dep-cache +│   │   ├── libexif +│   │   ├── libffmpeg +│   │   ├── libfilteraudio +│   │   ├── libopenal +│   │   ├── libopenssl +│   │   ├── libopus +│   │   ├── libqrencode +│   │   ├── libqt5 +│   │   ├── libsodium +│   │   ├── libsqlcipher +│   │   ├── libtoxcore +│   │   ├── libvpx +│   │   ├── mingw-w64-debug-scripts +│   │   ├── nsis +│   │   └── nsis_shellexecuteasuser +│   └── qtox +│   ├── debug +│   └── release └── x86_64 ├── dep-cache - │ ├── libffmpeg - │ ├── libfilteraudio - │ ├── libopenal - │ ├── libopenssl - │ ├── libopus - │ ├── libqrencode - │ ├── libqt5 - │ ├── libsodium - │ ├── libsqlcipher - │ ├── libtoxcore - │ └── libvpx + │   ├── libexif + │   ├── libffmpeg + │   ├── libfilteraudio + │   ├── libopenal + │   ├── libopenssl + │   ├── libopus + │   ├── libqrencode + │   ├── libqt5 + │   ├── libsodium + │   ├── libsqlcipher + │   ├── libtoxcore + │   ├── libvpx + │   ├── mingw-w64-debug-scripts + │   ├── nsis + │   └── nsis_shellexecuteasuser └── qtox ├── debug └── release From 3c1d02d2cb661c7d76ec014eb8292fbac0adaf42 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 06:11:20 -0400 Subject: [PATCH 5/6] refactor(windows): remove the unused SCRIPT_DIR variable --- windows/cross-compile/build.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index 48e351eef..12fdba540 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -38,7 +38,6 @@ set -euo pipefail # Common directory paths readonly WORKSPACE_DIR="/workspace" -readonly SCRIPT_DIR="/script" readonly QTOX_SRC_DIR="/qtox" @@ -49,9 +48,9 @@ then exit 1 fi -if [ ! -d "$WORKSPACE_DIR" ] || [ ! -d "$SCRIPT_DIR" ] || [ ! -d "$QTOX_SRC_DIR" ] +if [ ! -d "$WORKSPACE_DIR" ] || [ ! -d "$QTOX_SRC_DIR" ] then - echo "Error: At least one of $WORKSPACE_DIR, $SCRIPT_DIR or $QTOX_SRC_DIR directories is missing." + echo "Error: At least one of $WORKSPACE_DIR or $QTOX_SRC_DIR directories is missing." exit 1 fi From 5f7b9e67c19a8d10a44bd04a288c98889f464cac Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 7 May 2018 06:38:02 -0400 Subject: [PATCH 6/6] refactor(windows): remove the script directory requirement --- .travis/build-windows.sh | 3 +-- windows/cross-compile/README.md | 33 +++++++++++++-------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.travis/build-windows.sh b/.travis/build-windows.sh index 3af613b3d..49a7d9476 100755 --- a/.travis/build-windows.sh +++ b/.travis/build-windows.sh @@ -111,11 +111,10 @@ ls -lbh "$PWD" # 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" + /bin/bash /qtox/windows/cross-compile/build.sh "$ARCH" "$BUILD_TYPE" # Purely for debugging ls -lbh workspace/"$ARCH"/dep-cache/ diff --git a/windows/cross-compile/README.md b/windows/cross-compile/README.md index 98dc34770..a48d3a663 100644 --- a/windows/cross-compile/README.md +++ b/windows/cross-compile/README.md @@ -14,7 +14,7 @@ Please note that the compilation script doesn't build the updater. [Install Docker](https://docs.docker.com/install). -Create 3 directories: +Create 2 directories: * `workspace` -- a directory that will contain a cache of qTox dependencies and the final qTox cross-compilation build. You should create this directory. @@ -22,16 +22,13 @@ Create 3 directories: * `qtox` -- the root directory of a qTox repository. This directory must contain the qTox source code that will be cross-compiled. - * `script` -- a directory that contains the `build.sh` script. You could - create this directory and copy the `build.sh` script in it, or you - could just use the `qtox/windows/cross-compile` directory for this. +These directories will be mounted inside a Docker container at `/workspace` and +`/qtox`. -These directories will be mounted inside a Docker container at `/workspace`, -`/qtox` and `/script`. - -The contents of `qtox` and `script` directories are not modified during -compilation. The `build.sh` script makes a temporary copy of the `qtox` -directory for compilation. +> Note: +> The contents of `qtox` directory are not modified during compilation. The +> `build.sh` script makes a temporary copy of the `qtox` directory for the +> compilation. Once you sort out the directories, you are ready to run the `build.sh` script in a Docker container. @@ -44,14 +41,12 @@ in a Docker container. To start cross-compiling for 32-bit release version of qTox run: - ```sh 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 \ debian:stretch-slim \ - /bin/bash /script/build.sh i686 release + /bin/bash /qtox/windows/cross-compile/build.sh i686 release ``` If you want to debug some compilation issue, you might want to instead run: @@ -61,12 +56,11 @@ If you want to debug some compilation issue, you might want to instead run: 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 \ debian:stretch-slim \ /bin/bash # Run the script -bash /script/build.sh i686 release +bash /qtox/windows/cross-compile/build.sh i686 release ``` These will cross-compile all of the qTox dependencies and qTox itself, storing @@ -85,19 +79,18 @@ faster. > minutes using 8 hyperthreads to rebuild using the cached dependencies. After cross-compiling has finished, you should find the comiled qTox in a -`workspace\i686\qtox` or `workspace\x86_64\qtox\` directory, depending on the +`workspace/i686/qtox` or `workspace/x86_64/qtox` directory, depending on the architecture. -You will also find `workspace\dep-cache` directory, where all the +You will also find `workspace/dep-cache` directory, where all the cross-compiled qTox dependencies will be cached for the future builds. You can remove any directory inside the `dep-cache`, which will result in the `build.sh` re-compiling the removed dependency only. - -_The `workspace` direcory structure for reference_ +The `workspace` direcory structure for reference: ``` -workspace/ +workspace ├── i686 │   ├── dep-cache │   │   ├── libexif