windows dependencies cross-building scripts
authoruser <balthazar@yandex.ru>
Sat, 25 Dec 2021 03:19:10 +0000 (06:19 +0300)
committeruser <balthazar@yandex.ru>
Sat, 25 Dec 2021 03:19:10 +0000 (06:19 +0300)
mingw64_deps/README.md [new file with mode: 0644]
mingw64_deps/boost/build.sh [new file with mode: 0755]
mingw64_deps/boost/setup.sh [new file with mode: 0755]
mingw64_deps/db/build.sh [new file with mode: 0755]
mingw64_deps/db/setup.sh [new file with mode: 0755]
mingw64_deps/openssl/build.sh [new file with mode: 0755]
mingw64_deps/openssl/setup.sh [new file with mode: 0755]
mingw64_deps/qt/build.sh [new file with mode: 0755]
mingw64_deps/qt/setup.sh [new file with mode: 0755]

diff --git a/mingw64_deps/README.md b/mingw64_deps/README.md
new file mode 100644 (file)
index 0000000..15e7471
--- /dev/null
@@ -0,0 +1,22 @@
+# Cross-build dependencies for Windows x86-64 and Windows ARM64
+
+## Requirements
+
+Please use llvm-mingw compiler which can be downloaded here:
+    https://github.com/mstorsjo/llvm-mingw/releases
+
+You will also need to install CMake 3.20 or newer to compile Qt libraries. Simplest way to do this is to use python repositories:
+
+    sudo apt install python3-pip
+    pip3 install cmake
+
+Unpack compiler binaries to suitable directory and ensure that /bin directory is mentioned in your PATH. You will also need to add /home/user/.local/bin to PATH as well.
+
+## Setting up
+
+   Every subdirectory contains setup script which can be used to download source code and setup source trees.
+
+## Building
+
+   Just execute ./build.sh script for corresponding dependency using x86_64 or aarch64 as argument. It will build binaries automatically.
+
diff --git a/mingw64_deps/boost/build.sh b/mingw64_deps/boost/build.sh
new file mode 100755 (executable)
index 0000000..7e6e821
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+CROSS=$1
+ROOT=$(pwd)
+
+if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${CROSS} is not supported"
+echo "Expected either aarch64 or x86_64."
+exit 1
+fi
+
+# Create stage directory
+mkdir ${ROOT}/${CROSS}-w64-mingw32
+
+cd ${ROOT}/boost
+
+# Create compiler settings
+echo "using gcc : : ${CROSS}-w64-mingw32-g++ ;" > user-config-${CROSS}.jam
+
+# Build boost
+./b2 --user-config=user-config-${CROSS}.jam --build-type=minimal --layout=system --with-chrono --with-filesystem --with-program_options --with-system --with-thread target-os=windows address-model=64 variant=release link=static threading=multi runtime-link=static stage --prefix=${ROOT}/${CROSS}-w64-mingw32 install
+
+cd ${ROOT}
+
+# Remove build directories
+rm -rf ${ROOT}/boost/stage ${ROOT}/boost/bin.v2
diff --git a/mingw64_deps/boost/setup.sh b/mingw64_deps/boost/setup.sh
new file mode 100755 (executable)
index 0000000..d2f5988
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+ROOT=$(pwd)
+VER=1_78_0
+
+wget -O ${ROOT}/boost_${VER}.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_${VER}.tar.gz
+tar -xzf ${ROOT}/boost_${VER}.tar.gz
+mv ${ROOT}/boost_${VER} boost
+
+cd ${ROOT}/boost
+
+# Compile b2 tool
+./bootstrap.sh
+
+cd ${ROOT}
diff --git a/mingw64_deps/db/build.sh b/mingw64_deps/db/build.sh
new file mode 100755 (executable)
index 0000000..79b426d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+CROSS=$1
+ROOT=$(pwd)
+MUTEX="x86_64/gcc-assembly"
+
+if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${CROSS} is not supported"
+echo "Expected either aarch64 or x86_64."
+exit 1
+fi
+
+if [ "${CROSS}" == "aarch64" ]; then
+MUTEX="ARM64/gcc-assembly"
+fi
+
+# Make build directories
+mkdir ${ROOT}/${CROSS}-w64-mingw32-build
+
+# Stage directory
+mkdir ${ROOT}/${CROSS}-w64-mingw32
+
+# Compile BerkeleyDB
+
+cd ${ROOT}/${CROSS}-w64-mingw32-build
+CC=${CROSS}-w64-mingw32-gcc CXX=${CROSS}-w64-mingw32-g++ ${ROOT}/libdb/dist/configure --prefix=${ROOT}/${CROSS}-w64-mingw32 --enable-smallbuild --enable-cxx --disable-shared --disable-replication --with-mutex=${MUTEX} --enable-mingw --host=${CROSS}-w64-mingw32
+make -j 4 library_build
+make library_install
+
+# Remove build directore
+cd ${ROOT}
+rm -rf ${ROOT}/${CROSS}-w64-mingw32-build
diff --git a/mingw64_deps/db/setup.sh b/mingw64_deps/db/setup.sh
new file mode 100755 (executable)
index 0000000..6b373ee
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+wget https://fossies.org/linux/misc/db-18.1.40.tar.gz
+tar -xzf db-18.1.40.tar.gz
+mv db-18.1.40 libdb
+sed -i "s/WinIoCtl.h/winioctl.h/g" libdb/src/dbinc/win_db.h
diff --git a/mingw64_deps/openssl/build.sh b/mingw64_deps/openssl/build.sh
new file mode 100755 (executable)
index 0000000..6866fe2
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+CROSS=$1
+ROOT=$(pwd)
+
+if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${CROSS} is not supported"
+echo "Expected either aarch64 or x86_64."
+exit 1
+fi
+
+# Make build directories
+mkdir ${ROOT}/${CROSS}-w64-mingw32-build
+
+# Stage directory
+mkdir ${ROOT}/${CROSS}-w64-mingw32
+
+# Compile BerkeleyDB
+
+cd ${ROOT}/${CROSS}-w64-mingw32-build
+CC=${CROSS}-w64-mingw32-gcc CXX=${CROSS}-w64-mingw32-g++ ${ROOT}/openssl/Configure --prefix=${ROOT}/${CROSS}-w64-mingw32 no-shared no-asm mingw64
+make -j 4 build_libs
+make install_dev
+
+# Remove build directore
+cd ${ROOT}
+rm -rf ${ROOT}/${CROSS}-w64-mingw32-build
diff --git a/mingw64_deps/openssl/setup.sh b/mingw64_deps/openssl/setup.sh
new file mode 100755 (executable)
index 0000000..e28dd7d
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+git clone -b openssl-3.0 https://github.com/openssl/openssl
diff --git a/mingw64_deps/qt/build.sh b/mingw64_deps/qt/build.sh
new file mode 100755 (executable)
index 0000000..6ea0cd5
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+CROSS=$1
+ROOT=$(pwd)
+
+if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${CROSS} is not supported"
+echo "Expected either aarch64 or x86_64."
+exit 1
+fi
+
+# Make build directories
+mkdir ${ROOT}/${CROSS}-w64-mingw32-build
+mkdir ${ROOT}/${CROSS}-w64-mingw32-build-qttools
+mkdir ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
+
+# Stage directory
+mkdir ${ROOT}/${CROSS}-w64-mingw32
+
+# Compile Qt
+
+cd ${ROOT}/${CROSS}-w64-mingw32-build
+${ROOT}/qtbase/configure -xplatform win32-clang-g++ --hostprefix=${ROOT}/${CROSS}-w64-mingw32 --prefix=${ROOT}/${CROSS}-w64-mingw32 -device-option CROSS_COMPILE=${CROSS}-w64-mingw32- -release -confirm-license -no-compile-examples -no-cups -no-egl -no-eglfs -no-evdev -no-gif -no-icu -no-ico -no-iconv -no-libjpeg -no-libproxy -no-openssl -no-openvg -no-reduce-relocations -no-schannel -no-sctp -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite  -no-sql-sqlite2 -no-system-proxies -no-use-gold-linker -no-zstd -nomake examples -nomake tests -nomake tools -opensource -qt-libpng -qt-pcre -qt-zlib -static -no-feature-bearermanagement -no-feature-colordialog -no-feature-concurrent -no-feature-dial -no-feature-ftp -no-feature-http -no-feature-image_heuristic_mask -no-feature-keysequenceedit -no-feature-lcdnumber -no-feature-networkdiskcache -no-feature-networkproxy -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sessionmanager -no-feature-socks5 -no-feature-sql -no-feature-sqlmodel -no-feature-statemachine -no-feature-syntaxhighlighter -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-topleveldomain -no-feature-udpsocket -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-vnc -no-feature-xml -no-dbus -no-opengl -no-freetype
+make -j 4
+make install
+
+# Compile Qt tools
+
+cd ${ROOT}/${CROSS}-w64-mingw32-build-qttools
+${ROOT}/${CROSS}-w64-mingw32/bin/qmake ${ROOT}/qttools
+make -j 4
+make DESTDIR=${ROOT}/${CROSS}-w64-mingw32 install
+
+# Compile translations
+
+cd cd ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
+${ROOT}/${CROSS}-w64-mingw32/bin/qmake ${ROOT}/qttranslations
+make -j 4
+make DESTDIR=${ROOT}/${CROSS}-w64-mingw32 install
+
+# Remove build directories
+cd ${ROOT}
+rm -rf ${ROOT}/${CROSS}-w64-mingw32-build ${ROOT}/${CROSS}-w64-mingw32-build-qttools ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
diff --git a/mingw64_deps/qt/setup.sh b/mingw64_deps/qt/setup.sh
new file mode 100755 (executable)
index 0000000..c3ce729
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+git clone -b 5.15.2 https://github.com/qt/qtbase.git
+git clone -b 5.15.2 https://github.com/qt/qttools.git
+git clone -b 5.15.2 https://github.com/qt/qttranslations.git
+