From 95548c6a5fcce7a31ffcaafcaec8650fd6f4c968 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Thu, 21 Sep 2017 21:12:32 -0400 Subject: [PATCH 1/3] fix(build): Add libexif to the Windows cross-compilation --- windows/cross-compile/build.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index 599669077..efaed04e1 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -310,6 +310,8 @@ then sed -i s/'LIBS="-lcrypto $LIBS"'/'LIBS="-lcrypto -lgdi32 $LIBS"'/g configure sed -i s/'if test "$TARGET_EXEEXT" = ".exe"'/'if test ".exe" = ".exe"'/g configure +# Do not remove trailing whitespace and dont replace tabs with spaces in the patch below, +# otherwise the patch will fail to apply > Makefile.in-patch cat << "EOF" --- Makefile.in 2017-07-24 04:33:46.944080013 +0000 +++ Makefile.in-patch 2017-07-24 04:50:47.340596990 +0000 @@ -622,6 +624,34 @@ then fi +# Exif + +EXIF_PREFIX_DIR="$DEP_DIR/libexif" +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 + bsdtar -xf libexif*.tar.bz2 + rm libexif*.tar.bz2 + cd libexif* + + CFLAGS="-O2 -g0" ./configure --host="$ARCH-w64-mingw32" \ + --prefix="$EXIF_PREFIX_DIR" \ + --disable-shared \ + --enable-static \ + --disable-docs \ + --disable-nls + make + make install + touch $EXIF_PREFIX_DIR/done + + cd .. + rm -rf ./libexif* +fi + + # Opus OPUS_PREFIX_DIR="$DEP_DIR/libopus" @@ -629,7 +659,7 @@ 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 \ From 7f6f8a4513bfa07356f7ac6a88da346d8c325e7a Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Thu, 21 Sep 2017 21:30:55 -0400 Subject: [PATCH 2/3] feat(build): Check sha256 of tarballs for Windows cross-compilation --- windows/cross-compile/build.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index efaed04e1..da3579ef9 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -172,6 +172,23 @@ MAKEFLAGS=j$(nproc) export MAKEFLAGS +# Helper functions + +check_sha256() +{ + if ! ( echo "$1 $2" | sha256sum -c --status - ) + then + echo "Error: sha256 of $2 doesn't match the known one." + echo "Expected: $1 $2" + echo -n "Got: " + sha256sum "$2" + exit 1 + else + echo "sha256 matches the expected one: $1" + fi +} + + # OpenSSL OPENSSL_PREFIX_DIR="$DEP_DIR/libopenssl" @@ -181,18 +198,9 @@ then mkdir -p "$OPENSSL_PREFIX_DIR" OPENSSL_VERSION=1.0.2l - OPENSSL_SHA256_HASH=ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz - - if ! ( echo "$OPENSSL_SHA256_HASH openssl-$OPENSSL_VERSION.tar.gz" | sha256sum -c --status - ) - then - echo "Error: sha256 of openssl-$OPENSSL_VERSION.tar.gz doesn't match the known one." - exit 1 - else - echo "sha256 matches the expected one: $OPENSSL_SHA256_HASH" - fi - + check_sha256 "ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c" "openssl-$OPENSSL_VERSION.tar.gz" bsdtar -xf openssl*.tar.gz rm openssl*.tar.gz cd openssl* @@ -234,7 +242,7 @@ then 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 "83e61bfc78bba230770704e828fa4d23fe3bbfdcfa4a8f5db37ce149731d89b3" "qt-everywhere-opensource-src-$QT_VERSION.tar.xz" bsdtar -xf qt*.tar.xz rm qt*.tar.xz cd qt* @@ -356,6 +364,7 @@ then 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" bsdtar -xf ffmpeg*.tar.xz cd ffmpeg* @@ -604,6 +613,7 @@ then 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" bsdtar -xf qrencode*.tar.bz2 rm qrencode*.tar.bz2 cd qrencode* @@ -633,6 +643,7 @@ then 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" bsdtar -xf libexif*.tar.bz2 rm libexif*.tar.bz2 cd libexif* From 80f1286e7ca5025d3e9f93b4209f791e043ad367 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Thu, 21 Sep 2017 23:28:58 -0400 Subject: [PATCH 3/3] fix(build): Update toxcore and Qt versions for Windows cross-compilation --- windows/cross-compile/build.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/windows/cross-compile/build.sh b/windows/cross-compile/build.sh index da3579ef9..748ca7a63 100644 --- a/windows/cross-compile/build.sh +++ b/windows/cross-compile/build.sh @@ -40,12 +40,6 @@ # - 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. -# -# - Toxcore v0.1.9 doesn't cross-compile to Windows due to a linking order -# issue in monolith_test https://github.com/TokTok/c-toxcore/pull/564. It's -# fixed in master, so we just wait checking out a stable master commit point -# until the next release. Once the next release occurs, we will be checking -# out that instead. set -euo pipefail @@ -238,11 +232,11 @@ then QT_MAJOR=5 QT_MINOR=6 - QT_PATCH=2 + 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 "83e61bfc78bba230770704e828fa4d23fe3bbfdcfa4a8f5db37ce149731d89b3" "qt-everywhere-opensource-src-$QT_VERSION.tar.xz" + check_sha256 "2fa0cf2e5e8841b29a4be62062c1a65c4f6f2cf1beaf61a5fd661f520cd776d0" "qt-everywhere-opensource-src-$QT_VERSION.tar.xz" bsdtar -xf qt*.tar.xz rm qt*.tar.xz cd qt* @@ -772,9 +766,12 @@ then rm -rf "$TOXCORE_PREFIX_DIR" mkdir -p "$TOXCORE_PREFIX_DIR" - git clone https://github.com/TokTok/c-toxcore + git clone \ + --branch v0.1.10 \ + --depth 1 \ + https://github.com/TokTok/c-toxcore \ + c-toxcore cd c-toxcore - git checkout 1b290c0d84d92fd28fc1f64f33bf4455d73e2e2e 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"