Last active
December 9, 2024 01:33
-
-
Save smellman/1716e2bc5e4b3a6ac158bf2fd75c42eb to your computer and use it in GitHub Desktop.
WIP: qt5 build for qgis macos x86_64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qt-everywhere-opensource-src* | |
qt-everywhere-src* | |
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is used to build Qt5 for QGIS on macOS. | |
# see: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/q/[email protected] | |
# Set the version of Qt5 to build | |
QT_VERSION=5.15.16 | |
SRC_DIR=qt-everywhere-src-${QT_VERSION} | |
TAR_BALL=qt-everywhere-opensource-src-${QT_VERSION}.tar.xz | |
PREFIX=/opt/qt/${QT_VERSION} | |
# Remove the previous build | |
rm -fr ${SRC_DIR} | |
# install dev dependency | |
# brew install python ninja gperf | |
# unarchive the tarball | |
tar jxvf ${TAR_BALL} | |
# Change directory to the source directory | |
cd ${SRC_DIR} | |
# configure python3.12 | |
echo "Create virtual env for Python 3.12" | |
python3.12 -m venv venv | |
source venv/bin/activate | |
export PYTHONPATH=venv/lib/python3.12/site-packages/ | |
# Configure qtwebengine start | |
## git clone qtwebengine | |
echo "Cloning qtwebengine" | |
rm -fr qtwebengine | |
git clone https://code.qt.io/qt/qtwebengine.git qtwebengine | |
cd qtwebengine | |
git checkout -b v5.15.18-lts refs/tags/v5.15.18-lts | |
git submodule update --init --recursive | |
# ## patch qtwebengine | |
# ### libxml2 2.12 compatibility | |
# echo "Patching qtwebengine - libxml2 2.12 compatibility" | |
# cd src/3rdparty | |
# curl "https://github.com/qt/qtwebengine-chromium/commit/c98d28f2f0f23721b080c74bc1329871a529efd8.patch?full_index=1" | patch -p 1 | |
# cd ../.. | |
### Use Arch Linux's patch for ICU 75 support | |
echo "Patching qtwebengine - Use Arch Linux's patch for ICU 75 support" | |
cd src/3rdparty | |
curl "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/a6348f22ac66f1337f400497a5b36057810acf97/qt5-webengine-icu-75.patch" | patch -p 1 | |
cd ../.. | |
### Use Arch Linux / Debian patches for Python 3.12 support | |
echo "Patching qtwebengine - Use Arch Linux / Debian patches for Python 3.12 support" | |
cd src/3rdparty/chromium | |
curl "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/55a02804953a9035cdee7e6ff2e2dae0bf5c5fea/python3.12-imp.patch" | patch -p 1 | |
curl "https://gitlab.archlinux.org/archlinux/packaging/packages/qt5-webengine/-/raw/6b0c0e76e0934db2f84be40cb5978cee47266e78/python3.12-six.patch" | patch -p 1 | |
cd ../../.. | |
# ### python3 support for qtwebengine-chromium | |
# echo "Patching qtwebengine - python3 support for qtwebengine-chromium" | |
# cd src/3rdparty | |
# curl "https://raw.githubusercontent.com/Homebrew/formula-patches/7ae178a617d1e0eceb742557e63721af949bd28a/qt5/qt5-webengine-chromium-python3.patch?full_index=1" | patch -p 1 | |
# cd ../.. | |
# ### python3 support for qtwebengine | |
# echo "Patching qtwebengine - python3 support for qtwebengine" | |
# curl "https://raw.githubusercontent.com/Homebrew/formula-patches/a6f16c6daea3b5a1f7bc9f175d1645922c131563/qt5/qt5-webengine-python3.patch?full_index=1" | patch -p 1 | |
# ### Use Debian patch to support Python 3.11 | |
# echo "Patching qtwebengine - Use Debian patch to support Python 3.11" | |
# curl "https://raw.githubusercontent.com/Homebrew/formula-patches/9758d3dd8ace5aaa9d6720b2e2e8ea1b863658d5/qt5/qtwebengine-py3.11.patch" | patch -p 1 | |
# ### Fix ffmpeg build with binutils | |
# echo "Patching qtwebengine - Fix ffmpeg build with binutils" | |
# cd src/3rdparty/chromium/third_party/ffmpeg | |
# curl "https://github.com/FFmpeg/FFmpeg/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb.patch?full_index=1" | patch -p 1 | |
# cd ../../../../.. | |
# ### Use Gentoo's patch for ICU 74 support | |
# echo "Patching qtwebengine - Use Gentoo's patch for ICU 74 support" | |
# curl "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-qt/qtwebengine/files/qtwebengine-6.5.3-icu74.patch?id=ba397fa71f9bc9a074d9c65b63759e0145bb9fa0" | patch -p 1 | |
# ### added CXX build flag | |
# echo "Patching qtwebengine - added CXX build flag" | |
# curl "https://gist.githubusercontent.com/smellman/413757bff6cece516b1c4300bbbaffcb/raw/6e61c60fed0897321cb4a2aba7207b00bd06319b/qt-webengine-cxxflag.patch" | patch -p 0 | |
## patch qtwebengine end | |
cd .. | |
# configure qtwebengine end | |
# Fix build with Xcode 14.3. | |
echo "Patching - Fix build with Xcode 14.3" | |
cd qtlocation/src/3rdparty/mapbox-gl-native | |
curl "https://invent.kde.org/qt/qt/qtlocation-mapboxgl/-/commit/5a07e1967dcc925d9def47accadae991436b9686.diff" | patch -p 1 | |
cd ../../../.. | |
# # Fix qmake with Xcode 15. | |
# echo "Patching - Fix qmake with Xcode 15" | |
# curl "https://raw.githubusercontent.com/Homebrew/formula-patches/086e8cf/qt5/qt5-qmake-xcode15.patch" | patch -p 1 | |
# # Fix qtmultimedia build with Xcode 15 | |
# echo "Patching - Fix qtmultimedia build with Xcode 15" | |
# curl "https://raw.githubusercontent.com/Homebrew/formula-patches/3f509180/qt5/qt5-qtmultimedia-xcode15.patch" | patch -p 1 | |
# # Fix use of macOS 14 only memory_resource on macOS 13 | |
# echo "Patching - Fix use of macOS 14 only memory_resource on macOS 13" | |
# cd qtbase | |
# curl "https://raw.githubusercontent.com/macports/macports-ports/56a9af76a6bcecc3d12c3a65f2465c25e05f2559/aqua/qt5/files/patch-qtbase-memory_resource.diff" | patch -p 0 | |
# cd .. | |
# CVE-2023-51714 Remove with Qt 5.15.17 | |
echo "Patching - CVE-2023-51714 Remove with Qt 5.15.17" | |
cd qtbase | |
curl "https://download.qt.io/official_releases/qt/5.15/0001-CVE-2023-51714-qtbase-5.15.diff" | patch -p 1 | |
curl "https://download.qt.io/official_releases/qt/5.15/0002-CVE-2023-51714-qtbase-5.15.diff" | patch -p 1 | |
cd .. | |
# CVE-2024-25580 Remove with Qt 5.15.17 | |
echo "Patching - CVE-2024-25580 Remove with Qt 5.15.17" | |
cd qtbase | |
curl "https://download.qt.io/official_releases/qt/5.15/CVE-2024-25580-qtbase-5.15.diff" | patch -p 1 | |
cd .. | |
# CVE-2024-36048 Remove with Qt 5.15.17 | |
echo "Patching - CVE-2024-36048 Remove with Qt 5.15.17" | |
cd qtnetworkauth | |
curl "https://download.qt.io/official_releases/qt/5.15/CVE-2024-36048-qtnetworkauth-5.15.diff" | patch -p 1 | |
cd .. | |
# CVE-2024-39936 Remove with Qt 5.15.18 | |
echo "Patching - CVE-2024-39936 Remove with Qt 5.15.18" | |
cd qtbase | |
curl "https://download.qt.io/official_releases/qt/5.15/CVE-2024-39936-qtbase-5.15.patch" | patch -p 1 | |
cd .. | |
# # assimp fix | |
# cd qtquick3d | |
# curl "https://raw.githubusercontent.com/macports/macports-ports/master/aqua/qt5/files/patch-qtquick3d-assimp.diff" | patch -p 0 | |
# cd .. | |
# # boost patch | |
# cd qtlocation | |
# curl "https://gist.githubusercontent.com/smellman/b715667dba22d22da63a87de4a5b7613/raw/131305e8592f0e99d7d0a88febe9e50f75aeeb6c/boost-1.61.1.patch" | patch -p 0 | |
# cd .. | |
# patches end | |
# # copy hunspell source | |
# git clone https://github.com/hunspell/hunspell.git | |
# cd hunspell | |
# git checkout -b v1.7.2 refs/tags/v1.7.2 | |
# mkdir data | |
# cd data | |
# wget https://raw.githubusercontent.com/LibreOffice/dictionaries/master/en/en_US.aff | |
# wget https://raw.githubusercontent.com/LibreOffice/dictionaries/master/en/en_US.dic | |
# cd .. | |
# mv src ../qtvirtualkeyboard/src/plugins/hunspell/3rdparty/hunspell/ | |
# mv data ../qtvirtualkeyboard/src/plugins/hunspell/3rdparty/hunspell/ | |
# cd .. | |
# rm -fr hunspell | |
# # replace BUILD.gn | |
# sed -i '' 's|rebase_path("$clang_base_path/bin/", root_build_dir)|""|g' qtwebengine/src/3rdparty/chromium/build/toolchain/mac/BUILD.gn | |
# Configure the build | |
echo "-no-assimp flag for arm64 build, if you want to build for intel binary, remove this flag" | |
echo "Configuring the build" | |
./configure -verbose -prefix ${PREFIX} -release -opensource -confirm-license -nomake examples -nomake tests \ | |
-pkg-config -dbus-runtime -proprietary-codecs \ | |
-qt-freetype -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \ | |
-qt-harfbuzz -qt-doubleconversion -qt-sqlite \ | |
-qt-tiff -qt-webp \ | |
-no-feature-vulkan \ | |
-no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds \ | |
-no-rpath \ | |
-no-assimp \ | |
-webengine-python-version python3 | |
echo "Build the project" | |
make -j$(sysctl -n hw.logicalcpu) | |
cd qtlocation/src/3rdparty/clip2tri | |
make | |
cd ../../../../ | |
make -j$(sysctl -n hw.logicalcpu) # will fail in qtwebengine's locale | |
make -j$(sysctl -n hw.logicalcpu) | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment