Browse Source

chore(CI): Use platform detection script in Windows dep build scripts

Allows future macOS configuration in each individual build script to not all be
duplicated. Also deduplicates current Windows arg checking and config setting.
pull/6542/head
Anthony Bilinski 4 years ago
parent
commit
42b4385c35
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 34
      buildscripts/build_ffmpeg.sh
  2. 42
      buildscripts/build_gdb_windows.sh
  3. 34
      buildscripts/build_gmp_windows.sh
  4. 44
      buildscripts/build_libexif.sh
  5. 42
      buildscripts/build_libexpat_windows.sh
  6. 15
      buildscripts/build_msgpack_c.sh
  7. 41
      buildscripts/build_openal.sh
  8. 42
      buildscripts/build_openssl.sh
  9. 40
      buildscripts/build_opus.sh
  10. 42
      buildscripts/build_qrencode.sh
  11. 34
      buildscripts/build_qt_windows.sh
  12. 40
      buildscripts/build_sodium.sh
  13. 44
      buildscripts/build_sqlcipher.sh
  14. 21
      buildscripts/build_toxcore.sh
  15. 16
      buildscripts/build_utils.sh
  16. 35
      buildscripts/build_vpx.sh
  17. 2
      buildscripts/docker/Dockerfile.windows_builder

34
buildscripts/build_ffmpeg.sh

@ -6,45 +6,27 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build ffmpeg for the windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}"
}
ARCH="" source "${SCRIPT_DIR}/build_utils.sh"
while (( $# > 0 )); do parse_arch --dep "ffmpeg" --supported "win32 win64" "$@"
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_ffmpeg.sh"
if [ "${ARCH}" == "win64" ]; then if [ "${ARCH}" == "win64" ]; then
FFMPEG_ARCH="x86_64" FFMPEG_ARCH="x86_64"
CROSS_PREFIX="x86_64-w64-mingw32-"
else else
FFMPEG_ARCH="x86" FFMPEG_ARCH="x86"
CROSS_PREFIX="i686-w64-mingw32-"
fi fi
"${SCRIPT_DIR}/download/download_ffmpeg.sh"
./configure --arch=${FFMPEG_ARCH} \ ./configure --arch=${FFMPEG_ARCH} \
--enable-gpl \ --enable-gpl \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--prefix=/windows/ \ "--prefix=${DEP_PREFIX}" \
--target-os="mingw32" \ --target-os="mingw32" \
--cross-prefix="${CROSS_PREFIX}" \ "--cross-prefix=${MINGW_ARCH}-w64-mingw32-" \
--pkg-config="pkg-config" \ --pkg-config="pkg-config" \
--extra-cflags="-O2 -g0" \ --extra-cflags="-O2 -g0" \
--disable-debug \ --disable-debug \
@ -88,5 +70,5 @@ fi
--enable-decoder=mjpeg \ --enable-decoder=mjpeg \
--enable-decoder=rawvideo --enable-decoder=rawvideo
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

42
buildscripts/build_gdb_windows.sh

@ -6,38 +6,18 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build gmp for windows" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "gdb" --supported "win32 win64" "$@"
while (( $# > 0 )); do "${SCRIPT_DIR}/download/download_gdb.sh"
case $1 in
--arch) ARCH=$2; shift 2 ;; CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
-h|--help) usage; exit 1 ;; --prefix="${DEP_PREFIX}" \
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
echo "Unexpected arch $ARCH"
usage
exit 1
fi
if [ "${ARCH}" == "win64" ]; then
HOST="x86_64-w64-mingw32"
else
HOST="i686-w64-mingw32"
fi
"$(dirname "$(realpath "$0")")/download/download_gdb.sh"
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix="/windows" \
--enable-static \ --enable-static \
--disable-shared --disable-shared
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

34
buildscripts/build_gmp_windows.sh

@ -6,38 +6,18 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build gmp for windows"
echo "Usage: $0 --arch {win64|win32}"
}
while (( $# > 0 )); do source "${SCRIPT_DIR}/build_utils.sh"
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then parse_arch --dep "gmp" --supported "win32 win64" "$@"
echo "Unexpected arch $ARCH"
usage
exit 1
fi
if [ "${ARCH}" == "win64" ]; then "${SCRIPT_DIR}/download/download_gmp.sh"
HOST="x86_64-w64-mingw32"
else
HOST="i686-w64-mingw32"
fi
"$(dirname "$(realpath "$0")")/download/download_gmp.sh"
# https://gmplib.org/list-archives/gmp-discuss/2020-July/006519.html # https://gmplib.org/list-archives/gmp-discuss/2020-July/006519.html
CC_FOR_BUILD=gcc CFLAGS="-O2 -g0" ./configure --host="${HOST}" \ CC_FOR_BUILD=gcc CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
--prefix="/windows" \ --prefix="${DEP_PREFIX}" \
--enable-static \ --enable-static \
--disable-shared --disable-shared
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

44
buildscripts/build_libexif.sh

@ -6,42 +6,20 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build libexif for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "libexif" --supported "win32 win64" "$@"
ARCH="" "${SCRIPT_DIR}/download/download_libexif.sh"
while (( $# > 0 )); do CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
case $1 in "--prefix=${DEP_PREFIX}" \
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_libexif.sh"
if [ "${ARCH}" == "win64" ]; then
HOST="x86_64-w64-mingw32"
else
HOST="i686-w64-mingw32"
fi
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix=/windows/ \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--disable-docs \ --disable-docs \
--disable-nls --disable-nls
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

42
buildscripts/build_libexpat_windows.sh

@ -6,38 +6,18 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build libexpat for windows" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "libexpat" --supported "win32 win64" "$@"
while (( $# > 0 )); do "${SCRIPT_DIR}/download/download_libexpat.sh"
case $1 in
--arch) ARCH=$2; shift 2 ;; CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
-h|--help) usage; exit 1 ;; --prefix="${DEP_PREFIX}" \
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_libexpat.sh"
if [ "${ARCH}" == "win64" ]; then
HOST="x86_64-w64-mingw32"
else
HOST="i686-w64-mingw32"
fi
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix="/windows" \
--enable-static \ --enable-static \
--disable-shared --disable-shared
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

15
buildscripts/build_msgpack_c.sh

@ -5,14 +5,21 @@
set -euo pipefail set -euo pipefail
"$(dirname "$(realpath "$0")")/download/download_msgpack_c.sh" readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \ source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "msgpack-c" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_msgpack_c.sh"
cmake .\
"-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \ "${CMAKE_TOOLCHAIN_FILE}" \
-DMSGPACK_BUILD_EXAMPLES=OFF \ -DMSGPACK_BUILD_EXAMPLES=OFF \
-DMSGPACK_BUILD_TESTS=OFF \ -DMSGPACK_BUILD_TESTS=OFF \
. .
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

41
buildscripts/build_openal.sh

@ -8,48 +8,23 @@ set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")" readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
usage() source "${SCRIPT_DIR}/build_utils.sh"
{
echo "Download and build openal for the windows cross compiling environment" parse_arch --dep "openal" --supported "win32 win64" "$@"
echo "Usage: $0 --arch {win64|win32}"
}
ARCH=""
while (( $# > 0 )); do
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [ "$ARCH" != "win32" ] && [ "$ARCH" != "win64" ]; then
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"${SCRIPT_DIR}/download/download_openal.sh" "${SCRIPT_DIR}/download/download_openal.sh"
patch -p1 < "${SCRIPT_DIR}/patches/openal-cmake-3-11.patch" patch -p1 < "${SCRIPT_DIR}/patches/openal-cmake-3-11.patch"
if [ "${ARCH}" == "win64" ]; then
MINGW_DIR="x86_64-w64-mingw32"
else
MINGW_DIR="x86-w64-mingw32"
fi
export CFLAGS="-fPIC" export CFLAGS="-fPIC"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \ cmake "-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DALSOFT_UTILS=OFF \ -DALSOFT_UTILS=OFF \
-DALSOFT_EXAMPLES=OFF \ -DALSOFT_EXAMPLES=OFF \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \ "${CMAKE_TOOLCHAIN_FILE}" \
-DDSOUND_INCLUDE_DIR="/usr/${MINGW_DIR}/include" \ -DDSOUND_INCLUDE_DIR="/usr/${MINGW_ARCH}-w64-mingw32/include" \
-DDSOUND_LIBRARY="/usr/${MINGW_DIR}/lib/libdsound.a" \ -DDSOUND_LIBRARY="/usr/${MINGW_ARCH}-w64-mingw32/lib/libdsound.a" \
. .
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

42
buildscripts/build_openssl.sh

@ -6,41 +6,25 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build openssl for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "openssl" --supported "win32 win64" "$@"
ARCH="" if [[ "$SCRIPT_ARCH" == "win64" ]]; then
while (( $# > 0 )); do
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then
OPENSSL_ARCH="mingw64" OPENSSL_ARCH="mingw64"
PREFIX="x86_64-w64-mingw32-"
elif [[ "$ARCH" == "win32" ]]; then
OPENSSL_ARCH="mingw"
PREFIX="i686-w64-mingw32-"
else else
echo "Invalid architecture" OPENSSL_ARCH="mingw"
usage
exit 1
fi fi
"$(dirname "$(realpath "$0")")/download/download_openssl.sh" "${SCRIPT_DIR}/download/download_openssl.sh"
./Configure --prefix=/windows/ \ ./Configure "--prefix=${DEP_PREFIX}" \
--openssldir=/windows/ssl \ "--openssldir=${DEP_PREFIX}/ssl" \
shared \ shared \
$OPENSSL_ARCH \ $OPENSSL_ARCH \
--cross-compile-prefix=${PREFIX} "--cross-compile-prefix=${MINGW_ARCH}-w64-mingw32-"
make -j $(nproc) make -j "${MAKE_JOBS}"
make install_sw make install_sw

40
buildscripts/build_opus.sh

@ -6,41 +6,21 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build opus for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "opus" --supported "win32 win64" "$@"
ARCH="" "${SCRIPT_DIR}/download/download_opus.sh"
while (( $# > 0 )); do
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then
HOST="x86_64-w64-mingw32"
elif [[ "$ARCH" == "win32" ]]; then
HOST="i686-w64-mingw32"
else
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_opus.sh"
LDFLAGS="-fstack-protector" CFLAGS="-O2 -g0" \ LDFLAGS="-fstack-protector" CFLAGS="-O2 -g0" \
./configure --host="${HOST}" \ ./configure "${HOST_OPTION}" \
--prefix=/windows/ \ "--prefix=${DEP_PREFIX}" \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--disable-extra-programs \ --disable-extra-programs \
--disable-doc --disable-doc
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

42
buildscripts/build_qrencode.sh

@ -6,41 +6,21 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build qrencode for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "qrencode" --supported "win32 win64" "$@"
ARCH="" "${SCRIPT_DIR}/download/download_qrencode.sh"
while (( $# > 0 )); do CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
case $1 in --prefix="${DEP_PREFIX}" \
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then
HOST="x86_64-w64-mingw32"
elif [[ "$ARCH" == "win32" ]]; then
HOST="i686-w64-mingw32"
else
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_qrencode.sh"
CFLAGS="-O2 -g0" ./configure --host="${HOST}" \
--prefix=/windows \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--disable-sdltest \ --disable-sdltest \
--without-tools \ --without-tools \
--without-debug --without-debug
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

34
buildscripts/build_qt_windows.sh

@ -6,41 +6,21 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build qt for the windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}"
}
ARCH="" source "${SCRIPT_DIR}/build_utils.sh"
while (( $# > 0 )); do parse_arch --dep "qt" --supported "win32 win64" "$@"
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then "${SCRIPT_DIR}/download/download_qt.sh"
CROSS="x86_64-w64-mingw32-"
elif [[ "$ARCH" == "win32" ]]; then
CROSS="i686-w64-mingw32-"
else
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_qt.sh"
OPENSSL_LIBS=$(pkg-config --libs openssl) OPENSSL_LIBS=$(pkg-config --libs openssl)
export OPENSSL_LIBS export OPENSSL_LIBS
./configure -prefix /windows/ \ ./configure -prefix "${DEP_PREFIX}" \
-release \ -release \
-shared \ -shared \
-device-option CROSS_COMPILE=${CROSS} \ -device-option "CROSS_COMPILE=${MINGW_ARCH}-w64-mingw32-" \
-xplatform win32-g++ \ -xplatform win32-g++ \
-openssl \ -openssl \
"$(pkg-config --cflags openssl)" \ "$(pkg-config --cflags openssl)" \
@ -94,5 +74,5 @@ export OPENSSL_LIBS
-qt-pcre \ -qt-pcre \
-opengl desktop -opengl desktop
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

40
buildscripts/build_sodium.sh

@ -6,39 +6,19 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build sodium for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "sodium" --supported "win32 win64" "$@"
ARCH="" "${SCRIPT_DIR}/download/download_sodium.sh"
while (( $# > 0 )); do
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then
HOST="x86_64-w64-mingw32"
elif [[ "$ARCH" == "win32" ]]; then
HOST="i686-w64-mingw32"
else
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_sodium.sh"
LDFLAGS="-fstack-protector" \ LDFLAGS="-fstack-protector" \
./configure --host="${HOST}" \ ./configure "${HOST_OPTION}" \
--prefix=/windows \ "--prefix=${DEP_PREFIX}" \
--enable-shared \ --enable-shared \
--disable-static --disable-static
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

44
buildscripts/build_sqlcipher.sh

@ -6,47 +6,27 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build sqlcipher for the windows cross compiling environment" source "${SCRIPT_DIR}/build_utils.sh"
echo "Usage: $0 --arch {win64|win32}"
} parse_arch --dep "sqlcipher" --supported "win32 win64" "$@"
ARCH="" "${SCRIPT_DIR}/download/download_sqlcipher.sh"
while (( $# > 0 )); do
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$ARCH" == "win64" ]]; then
HOST="x86_64-w64-mingw32"
elif [[ "$ARCH" == "win32" ]]; then
HOST="i686-w64-mingw32"
else
echo "Unexpected arch $ARCH"
usage
exit 1
fi
"$(dirname "$(realpath "$0")")/download/download_sqlcipher.sh"
sed -i s/'if test "$TARGET_EXEEXT" = ".exe"'/'if test ".exe" = ".exe"'/g configure sed -i s/'if test "$TARGET_EXEEXT" = ".exe"'/'if test ".exe" = ".exe"'/g configure
sed -i 's|exec $PWD/mksourceid manifest|exec $PWD/mksourceid.exe manifest|g' tool/mksqlite3h.tcl sed -i 's|exec $PWD/mksourceid manifest|exec $PWD/mksourceid.exe manifest|g' tool/mksqlite3h.tcl
./configure --host="${HOST}" \ ./configure "${HOST_OPTION}" \
--prefix=/windows/ \ "--prefix=${DEP_PREFIX}" \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--enable-tempstore=yes \ --enable-tempstore=yes \
CFLAGS="-O2 -g0 -DSQLITE_HAS_CODEC -I/windows/include/" \ CFLAGS="-O2 -g0 -DSQLITE_HAS_CODEC -I${DEP_PREFIX}/include/" \
LDFLAGS="-lcrypto -lgdi32 -L/windows/lib/" \ LDFLAGS="-lcrypto -lgdi32 -L${DEP_PREFIX}/lib/" \
LIBS="-lgdi32 -lws2_32" LIBS="-lgdi32 -lws2_32"
sed -i s/"TEXE = $"/"TEXE = .exe"/ Makefile sed -i s/"TEXE = $"/"TEXE = .exe"/ Makefile
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

21
buildscripts/build_toxcore.sh

@ -8,6 +8,10 @@ set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")" readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "toxcore and toxext extensions" --supported "win32 win64" "$@"
build_toxcore() { build_toxcore() {
TOXCORE_SRC="$(realpath toxcore)" TOXCORE_SRC="$(realpath toxcore)"
@ -16,15 +20,15 @@ build_toxcore() {
"${SCRIPT_DIR}/download/download_toxcore.sh" "${SCRIPT_DIR}/download/download_toxcore.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \ cmake "-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DBOOTSTRAP_DAEMON=OFF \ -DBOOTSTRAP_DAEMON=OFF \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DENABLE_STATIC=OFF \ -DENABLE_STATIC=OFF \
-DENABLE_SHARED=ON \ -DENABLE_SHARED=ON \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \ "${CMAKE_TOOLCHAIN_FILE}" \
. .
cmake --build . -- -j$(nproc) cmake --build . -- "-j${MAKE_JOBS}"
cmake --build . --target install cmake --build . --target install
popd >/dev/null popd >/dev/null
@ -38,12 +42,12 @@ build_toxext() {
"${SCRIPT_DIR}/download/download_toxext.sh" "${SCRIPT_DIR}/download/download_toxext.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \ cmake "-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \ "${CMAKE_TOOLCHAIN_FILE}" \
. .
cmake --build . -- -j$(nproc) cmake --build . -- "-j${MAKE_JOBS}"
cmake --build . --target install cmake --build . --target install
popd >/dev/null popd >/dev/null
@ -57,10 +61,11 @@ build_toxext_messages() {
"${SCRIPT_DIR}/download/download_toxext_messages.sh" "${SCRIPT_DIR}/download/download_toxext_messages.sh"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \ cmake "-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \ "${CMAKE_TOOLCHAIN_FILE}" \
. .
cmake --build . -- "-j${MAKE_JOBS}"
cmake --build . --target install cmake --build . --target install
popd >/dev/null popd >/dev/null

16
buildscripts/build_utils.sh

@ -12,7 +12,18 @@ usage()
# doesn't include --dep argument, since that comes from the build script # doesn't include --dep argument, since that comes from the build script
# itself. # itself.
echo "Download and build $DEP_NAME for the Windows cross compiling environment" echo "Download and build $DEP_NAME for the Windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}" echo "Usage: $0 --arch {$1}"
}
assert_supported()
{
for supported in $2; do
if [ "$1" == "$supported" ]; then
return
fi
done
usage "$2"
exit 1
} }
parse_arch() parse_arch()
@ -21,11 +32,14 @@ parse_arch()
case $1 in case $1 in
--arch) SCRIPT_ARCH=$2; shift 2 ;; --arch) SCRIPT_ARCH=$2; shift 2 ;;
--dep) DEP_NAME=$2; shift 2 ;; --dep) DEP_NAME=$2; shift 2 ;;
--supported) SUPPORTED=$2; shift 2 ;;
-h|--help) usage; exit 1 ;; -h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;; *) echo "Unexpected argument $1"; usage; exit 1;;
esac esac
done done
assert_supported "${SCRIPT_ARCH}" "${SUPPORTED}"
if [ "${SCRIPT_ARCH}" == "win32" ] || [ "${SCRIPT_ARCH}" == "win64" ]; then if [ "${SCRIPT_ARCH}" == "win32" ] || [ "${SCRIPT_ARCH}" == "win64" ]; then
if [ "${SCRIPT_ARCH}" == "win32" ]; then if [ "${SCRIPT_ARCH}" == "win32" ]; then
local ARCH="i686" local ARCH="i686"

35
buildscripts/build_vpx.sh

@ -6,47 +6,32 @@
set -euo pipefail set -euo pipefail
usage() readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
{
echo "Download and build vpx for the windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}"
}
ARCH="" source "${SCRIPT_DIR}/build_utils.sh"
while (( $# > 0 )); do parse_arch --dep "vpx" --supported "win32 win64" "$@"
case $1 in
--arch) ARCH=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
if [[ "$SCRIPT_ARCH" == "win64" ]]; then
if [[ "$ARCH" == "win64" ]]; then
# There is a bug in gcc that breaks avx512 on 64-bit Windows https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 # There is a bug in gcc that breaks avx512 on 64-bit Windows https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
# VPX fails to build due to it. # VPX fails to build due to it.
# This is a workaround as suggested in https://stackoverflow.com/questions/43152633 # This is a workaround as suggested in https://stackoverflow.com/questions/43152633
ARCH_FLAGS="-fno-asynchronous-unwind-tables" ARCH_FLAGS="-fno-asynchronous-unwind-tables"
VPX_ARCH="x86_64-win64-gcc" VPX_ARCH="x86_64-win64-gcc"
CROSS="x86_64-w64-mingw32-" elif [[ "$SCRIPT_ARCH" == "win32" ]]; then
elif [[ "$ARCH" == "win32" ]]; then
ARCH_FLAGS="" ARCH_FLAGS=""
VPX_ARCH="x86-win32-gcc" VPX_ARCH="x86-win32-gcc"
CROSS="i686-w64-mingw32-"
else else
echo "Unexpected arch $ARCH"
usage
exit 1 exit 1
fi fi
"$(dirname "$(realpath "$0")")/download/download_vpx.sh" "${SCRIPT_DIR}/download/download_vpx.sh"
patch -Np1 < "$(dirname "$0")"/patches/vpx.patch patch -Np1 < "${SCRIPT_DIR}/patches/vpx.patch"
CFLAGS=${ARCH_FLAGS} CROSS="${CROSS}" \ CFLAGS=${ARCH_FLAGS} CROSS="${MINGW_ARCH}-w64-mingw32-" \
./configure --target="${VPX_ARCH}" \ ./configure --target="${VPX_ARCH}" \
--prefix=/windows/ \ "--prefix=${DEP_PREFIX}" \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--enable-runtime-cpu-detect \ --enable-runtime-cpu-detect \
@ -55,5 +40,5 @@ CFLAGS=${ARCH_FLAGS} CROSS="${CROSS}" \
--disable-docs \ --disable-docs \
--disable-unit-tests --disable-unit-tests
make -j $(nproc) make -j "${MAKE_JOBS}"
make install make install

2
buildscripts/docker/Dockerfile.windows_builder

@ -67,8 +67,6 @@ RUN mkdir -p /src/openssl && \
/build/build_openssl.sh --arch ${SCRIPT_ARCH} && \ /build/build_openssl.sh --arch ${SCRIPT_ARCH} && \
rm -fr /src/openssl rm -fr /src/openssl
env PKG_CONFIG_PATH=/windows/lib/pkgconfig
COPY download/download_qt.sh /build/download/download_qt.sh COPY download/download_qt.sh /build/download/download_qt.sh
COPY build_qt_windows.sh /build/build_qt_windows.sh COPY build_qt_windows.sh /build/build_qt_windows.sh

Loading…
Cancel
Save