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

42
buildscripts/build_gdb_windows.sh

@ -6,38 +6,18 @@ @@ -6,38 +6,18 @@
set -euo pipefail
usage()
{
echo "Download and build gmp for windows"
echo "Usage: $0 --arch {win64|win32}"
}
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
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" \
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "gdb" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_gdb.sh"
CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
--prefix="${DEP_PREFIX}" \
--enable-static \
--disable-shared
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

34
buildscripts/build_gmp_windows.sh

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

44
buildscripts/build_libexif.sh

@ -6,42 +6,20 @@ @@ -6,42 +6,20 @@
set -euo pipefail
usage()
{
echo "Download and build libexif for the windows cross compiling environment"
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
"$(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/ \
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "libexif" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_libexif.sh"
CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
"--prefix=${DEP_PREFIX}" \
--enable-shared \
--disable-static \
--disable-docs \
--disable-nls
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

42
buildscripts/build_libexpat_windows.sh

@ -6,38 +6,18 @@ @@ -6,38 +6,18 @@
set -euo pipefail
usage()
{
echo "Download and build libexpat for windows"
echo "Usage: $0 --arch {win64|win32}"
}
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
"$(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" \
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "libexpat" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_libexpat.sh"
CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
--prefix="${DEP_PREFIX}" \
--enable-static \
--disable-shared
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

15
buildscripts/build_msgpack_c.sh

@ -5,14 +5,21 @@ @@ -5,14 +5,21 @@
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_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \
"${CMAKE_TOOLCHAIN_FILE}" \
-DMSGPACK_BUILD_EXAMPLES=OFF \
-DMSGPACK_BUILD_TESTS=OFF \
.
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

41
buildscripts/build_openal.sh

@ -8,48 +8,23 @@ set -euo pipefail @@ -8,48 +8,23 @@ set -euo pipefail
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
usage()
{
echo "Download and build openal for the windows cross compiling environment"
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
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "openal" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_openal.sh"
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"
cmake -DCMAKE_INSTALL_PREFIX=/windows/ \
cmake "-DCMAKE_INSTALL_PREFIX=${DEP_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DALSOFT_UTILS=OFF \
-DALSOFT_EXAMPLES=OFF \
-DCMAKE_TOOLCHAIN_FILE=/build/windows-toolchain.cmake \
-DDSOUND_INCLUDE_DIR="/usr/${MINGW_DIR}/include" \
-DDSOUND_LIBRARY="/usr/${MINGW_DIR}/lib/libdsound.a" \
"${CMAKE_TOOLCHAIN_FILE}" \
-DDSOUND_INCLUDE_DIR="/usr/${MINGW_ARCH}-w64-mingw32/include" \
-DDSOUND_LIBRARY="/usr/${MINGW_ARCH}-w64-mingw32/lib/libdsound.a" \
.
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

42
buildscripts/build_openssl.sh

@ -6,41 +6,25 @@ @@ -6,41 +6,25 @@
set -euo pipefail
usage()
{
echo "Download and build openssl for the windows cross compiling environment"
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" == "win64" ]]; then
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "openssl" --supported "win32 win64" "$@"
if [[ "$SCRIPT_ARCH" == "win64" ]]; then
OPENSSL_ARCH="mingw64"
PREFIX="x86_64-w64-mingw32-"
elif [[ "$ARCH" == "win32" ]]; then
OPENSSL_ARCH="mingw"
PREFIX="i686-w64-mingw32-"
else
echo "Invalid architecture"
usage
exit 1
OPENSSL_ARCH="mingw"
fi
"$(dirname "$(realpath "$0")")/download/download_openssl.sh"
"${SCRIPT_DIR}/download/download_openssl.sh"
./Configure --prefix=/windows/ \
--openssldir=/windows/ssl \
./Configure "--prefix=${DEP_PREFIX}" \
"--openssldir=${DEP_PREFIX}/ssl" \
shared \
$OPENSSL_ARCH \
--cross-compile-prefix=${PREFIX}
"--cross-compile-prefix=${MINGW_ARCH}-w64-mingw32-"
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install_sw

40
buildscripts/build_opus.sh

@ -6,41 +6,21 @@ @@ -6,41 +6,21 @@
set -euo pipefail
usage()
{
echo "Download and build opus for the windows cross compiling environment"
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" == "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"
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "opus" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_opus.sh"
LDFLAGS="-fstack-protector" CFLAGS="-O2 -g0" \
./configure --host="${HOST}" \
--prefix=/windows/ \
./configure "${HOST_OPTION}" \
"--prefix=${DEP_PREFIX}" \
--enable-shared \
--disable-static \
--disable-extra-programs \
--disable-doc
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

42
buildscripts/build_qrencode.sh

@ -6,41 +6,21 @@ @@ -6,41 +6,21 @@
set -euo pipefail
usage()
{
echo "Download and build qrencode for the windows cross compiling environment"
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" == "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 \
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "qrencode" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_qrencode.sh"
CFLAGS="-O2 -g0" ./configure "${HOST_OPTION}" \
--prefix="${DEP_PREFIX}" \
--enable-shared \
--disable-static \
--disable-sdltest \
--without-tools \
--without-debug
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

34
buildscripts/build_qt_windows.sh

@ -6,41 +6,21 @@ @@ -6,41 +6,21 @@
set -euo pipefail
usage()
{
echo "Download and build qt for the windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}"
}
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
ARCH=""
source "${SCRIPT_DIR}/build_utils.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
parse_arch --dep "qt" --supported "win32 win64" "$@"
if [[ "$ARCH" == "win64" ]]; then
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"
"${SCRIPT_DIR}/download/download_qt.sh"
OPENSSL_LIBS=$(pkg-config --libs openssl)
export OPENSSL_LIBS
./configure -prefix /windows/ \
./configure -prefix "${DEP_PREFIX}" \
-release \
-shared \
-device-option CROSS_COMPILE=${CROSS} \
-device-option "CROSS_COMPILE=${MINGW_ARCH}-w64-mingw32-" \
-xplatform win32-g++ \
-openssl \
"$(pkg-config --cflags openssl)" \
@ -94,5 +74,5 @@ export OPENSSL_LIBS @@ -94,5 +74,5 @@ export OPENSSL_LIBS
-qt-pcre \
-opengl desktop
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

40
buildscripts/build_sodium.sh

@ -6,39 +6,19 @@ @@ -6,39 +6,19 @@
set -euo pipefail
usage()
{
echo "Download and build sodium for the windows cross compiling environment"
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" == "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"
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "sodium" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_sodium.sh"
LDFLAGS="-fstack-protector" \
./configure --host="${HOST}" \
--prefix=/windows \
./configure "${HOST_OPTION}" \
"--prefix=${DEP_PREFIX}" \
--enable-shared \
--disable-static
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

44
buildscripts/build_sqlcipher.sh

@ -6,47 +6,27 @@ @@ -6,47 +6,27 @@
set -euo pipefail
usage()
{
echo "Download and build sqlcipher for the windows cross compiling environment"
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" == "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"
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "${SCRIPT_DIR}/build_utils.sh"
parse_arch --dep "sqlcipher" --supported "win32 win64" "$@"
"${SCRIPT_DIR}/download/download_sqlcipher.sh"
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
./configure --host="${HOST}" \
--prefix=/windows/ \
./configure "${HOST_OPTION}" \
"--prefix=${DEP_PREFIX}" \
--enable-shared \
--disable-static \
--enable-tempstore=yes \
CFLAGS="-O2 -g0 -DSQLITE_HAS_CODEC -I/windows/include/" \
LDFLAGS="-lcrypto -lgdi32 -L/windows/lib/" \
CFLAGS="-O2 -g0 -DSQLITE_HAS_CODEC -I${DEP_PREFIX}/include/" \
LDFLAGS="-lcrypto -lgdi32 -L${DEP_PREFIX}/lib/" \
LIBS="-lgdi32 -lws2_32"
sed -i s/"TEXE = $"/"TEXE = .exe"/ Makefile
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

21
buildscripts/build_toxcore.sh

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

16
buildscripts/build_utils.sh

@ -12,7 +12,18 @@ usage() @@ -12,7 +12,18 @@ usage()
# doesn't include --dep argument, since that comes from the build script
# itself.
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()
@ -21,11 +32,14 @@ parse_arch() @@ -21,11 +32,14 @@ parse_arch()
case $1 in
--arch) SCRIPT_ARCH=$2; shift 2 ;;
--dep) DEP_NAME=$2; shift 2 ;;
--supported) SUPPORTED=$2; shift 2 ;;
-h|--help) usage; exit 1 ;;
*) echo "Unexpected argument $1"; usage; exit 1;;
esac
done
assert_supported "${SCRIPT_ARCH}" "${SUPPORTED}"
if [ "${SCRIPT_ARCH}" == "win32" ] || [ "${SCRIPT_ARCH}" == "win64" ]; then
if [ "${SCRIPT_ARCH}" == "win32" ]; then
local ARCH="i686"

35
buildscripts/build_vpx.sh

@ -6,47 +6,32 @@ @@ -6,47 +6,32 @@
set -euo pipefail
usage()
{
echo "Download and build vpx for the windows cross compiling environment"
echo "Usage: $0 --arch {win64|win32}"
}
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
ARCH=""
source "${SCRIPT_DIR}/build_utils.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
parse_arch --dep "vpx" --supported "win32 win64" "$@"
if [[ "$ARCH" == "win64" ]]; then
if [[ "$SCRIPT_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
# VPX fails to build due to it.
# This is a workaround as suggested in https://stackoverflow.com/questions/43152633
ARCH_FLAGS="-fno-asynchronous-unwind-tables"
VPX_ARCH="x86_64-win64-gcc"
CROSS="x86_64-w64-mingw32-"
elif [[ "$ARCH" == "win32" ]]; then
elif [[ "$SCRIPT_ARCH" == "win32" ]]; then
ARCH_FLAGS=""
VPX_ARCH="x86-win32-gcc"
CROSS="i686-w64-mingw32-"
else
echo "Unexpected arch $ARCH"
usage
exit 1
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}" \
--prefix=/windows/ \
"--prefix=${DEP_PREFIX}" \
--enable-shared \
--disable-static \
--enable-runtime-cpu-detect \
@ -55,5 +40,5 @@ CFLAGS=${ARCH_FLAGS} CROSS="${CROSS}" \ @@ -55,5 +40,5 @@ CFLAGS=${ARCH_FLAGS} CROSS="${CROSS}" \
--disable-docs \
--disable-unit-tests
make -j $(nproc)
make -j "${MAKE_JOBS}"
make install

2
buildscripts/docker/Dockerfile.windows_builder

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

Loading…
Cancel
Save