# Maintainer: Martchus # Contributor: ant32 # Contributor: Filip Brcic # Contributor: jellysheep # BEFORE COMMENTING OR REPORING ISSUES, PLEASE READ THE FILE `README.md` IN THIS REPOSITORY. # ALSO HAVE A LOOK AT THE COMMENTS IN THE AUR. # DOES NOT WORK YET, see comment in build() function # All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where # you also find the URL of a binary repository. # All patches are managed at https://github.com/Martchus/qtbase _qt_module=qtbase pkgname=mingw-w64-qt5-base-angle pkgver=5.15.0 pkgrel=1 pkgdesc='A cross-platform application and UI framework, ANGLE OpenGL backend (mingw-w64)' arch=('i686' 'x86_64') url='https://www.qt.io/' license=('GPL3' 'LGPL3' 'FDL' 'custom') depends=('mingw-w64-crt' 'mingw-w64-zlib' 'mingw-w64-libjpeg-turbo' 'mingw-w64-sqlite' 'mingw-w64-libpng' 'mingw-w64-openssl' 'mingw-w64-dbus' 'mingw-w64-harfbuzz' 'mingw-w64-pcre2') optdepends=('mingw-w64-mesa: use LLVMpipe software rasterizer for Qt Quick' 'mingw-w64-postgresql: PostgreSQL support' 'mingw-w64-mariadb-connector-c: MySQL support') makedepends=('mingw-w64-gcc' 'mingw-w64-postgresql' 'mingw-w64-mariadb-connector-c' 'mingw-w64-vulkan-headers' 'mingw-w64-pkg-config' 'mingw-w64-environment') # makedepends+=('mingw-w64-wine') # the dynamic/ANGLE version needs to run fxc.exe (not implemented yet) groups=('mingw-w64-qt5') provides+=('mingw-w64-qt5-base') conflicts+=('mingw-w64-qt5-base' 'mingw-w64-qt5-base-angle' 'mingw-w64-qt5-base-noopengl' 'mingw-w64-qt5-base-dynamic' 'mingw-w64-qt5-base-openql') options=('!strip' '!buildflags' 'staticlibs' '!emptydirs') _pkgfqn="${_qt_module}-everywhere-src-${pkgver}" source=("https://download.qt.io/official_releases/qt/${pkgver%.*}/${pkgver}/submodules/${_pkgfqn}.tar.xz" '0001-Adjust-win32-g-profile-for-cross-compilation-with-mi.patch' '0002-Ensure-GLdouble-is-defined-when-using-dynamic-OpenGL.patch' '0003-Fix-too-many-sections-assemler-error-in-OpenGL-facto.patch' '0004-Make-sure-.pc-files-are-installed-correctly.patch' '0005-Don-t-add-resource-files-to-LIBS-parameter.patch' '0006-Prevent-debug-library-names-in-pkg-config-files.patch' '0007-Fix-linking-against-shared-static-libpng.patch' '0008-Fix-linking-against-static-D-Bus.patch' '0009-Don-t-try-to-use-debug-version-of-D-Bus-library.patch' '0010-Fix-linking-against-static-freetype2.patch' '0011-Fix-linking-against-static-harfbuzz.patch' '0012-Fix-linking-against-static-pcre.patch' '0013-Fix-linking-against-shared-static-MariaDB.patch' '0014-Fix-linking-against-shared-static-PostgreSQL.patch' '0015-Rename-qtmain-to-qt5main.patch' '0016-Enable-rpath-for-build-tools.patch' '0017-Use-system-zlib-for-build-tools.patch' '0018-Merge-shared-and-static-library-trees.patch' '0019-Use-.dll.a-as-import-lib-extension.patch' '0020-Pull-dependencies-of-static-libraries-in-CMake-modul.patch' '0021-Allow-usage-of-static-version-with-CMake.patch' '0022-Adjust-linker-flags-for-static-build-with-cmake-ming.patch' '0023-Use-correct-pkg-config-static-flag.patch' '0024-Fix-macro-invoking-moc-rcc-and-uic.patch' '0025-Ignore-errors-about-missing-feature-static.patch' '0026-Enable-and-fix-use-of-iconv.patch' '0027-Ignore-failing-pkg-config-test.patch' '0028-Prevent-qmake-from-messing-static-lib-dependencies.patch' '0029-Hardcode-linker-flags-for-platform-plugins.patch' '0030-Fix-linking-against-static-plugins-with-qmake.patch' '0031-Prevent-Cannot-find-feature-windows_vulkan_sdk.patch') sha256sums=('48b9e79220941665a9dd827548c6428f7aa3052ccba8f4f7e039a94aa1d2b28a' '03fbaa97d7e867db4f73c36045010c915d69e14d8de82fba886db6dbb5f2c19a' '25a28f49c2403fd7352736e29bcd25b7fcfb761b469515f773e782f2bdee7535' 'd0d83f1ef804f0012bea97f1f2c838d650a50556ec1635d5adbf6c8c155abd7e' '288ee263514ac6bab04245f3f3403511225a4d135a8db290777f68a91072b9ca' '1a25dc976dcd763edb2ca9431083b88b3f4d075104dfbc4aa84ab3ce6e009896' '0e81316237392605a09fba67c4fc8d0c596f1b2306b4a5de56e2fc857ef270eb' '1371046f24787eb1b7cb7779d5b5f792dd0e96c01fb83abea53dc1d7a3671409' 'be86f463255a0a146d80ff6d12d3faf9abca6eb65a8a2ce1cba1e9a27d24aad4' '6fd65bf739e9c27e837e73bcb5c203d1d6692e551b05f285f9205fa3818652ec' '42c7c59dd5b0d30659c72ff6405a931bdc286278cac4d197da67f565e4b42ba7' 'a146c63f13af1ab095ce0d7709e61a96a595c74715f98d6370ad4a42e2361466' '68ca7b583d40b8eaf6f3f022256f26e041a5e845c435c17a1462d2a825901f62' '9ea635d6aed7d9af8eae17282dcf4e40b9259d03a7afd3af3d9f62e85abda65d' '11112caf945e199bca20d1adad09990e348d078fd99567be037fd02ef5081174' '39e3fec01c9e823c16219b289babdc8c5af597cfe5496b681f4acc960de2dadb' '1b1bed9052a0f7666bbfd99d0a2e21e146e5b24d1967b80367ab0df55c3f3474' '896360b605d5b47db2c8459c620a1c07a5951efa702734c58dfb773396dc328b' 'd339e29673f2ec6f3ae7c4b6f64188b0686946b0ad5a99c6721fa99dc123bb70' '0ac665c9c982be0b35d249bec3e38b8d95c8539a9e68379216994e01f32daaff' '8aceb87b3ec8a77bec3f0826dd81325447acdeff4e7179d464f1d1440f867e9e' 'fc65b1578af0e6f7883b1f7769d6b333f48bf2d9aa4c2c6423db24237079473f' '8c13620f2b35e3b9abc772cef2bf28d1873e3a230c49f19eed1fd305903825c7' '227fd12bda01bd023c5f353b3b3c42bc8b14dbd3fd0fc7e78b0ee5fe16017b26' 'a63e76c896c2fafef4f457b95d547631d86845d2bb6d414a64d0ffa391dd21ef' 'a80a47c4d40e61431cf0357ab14d1634eadec9add509c995e7ff4ee417bd2065' '563169bc4886659f026ab35f92175828265385fbfebce44b23565f7de35a1420' 'a90671b2188cd76e9d950793d4d41cf2ec54d8f4d3adbc1d966efafc313d2b3a' '25a6eabbd5ae5b2f3b86ec36b0d6a298cc9f3df5dd3190abcbd24f54d662da9c' 'd69836ba35570985c271ce84a4c6833f33436696e8e25ecb23e27f3e498aa696' '3b5ea2572e65c52ff988a97e988f7f4a36a20973c63afb047db6d8a2b67a2dc5' 'c8181d71a5209983e4659c1bb11957fb0199e0c7e66808e5cb877e5876c704be') _architectures='i686-w64-mingw32 x86_64-w64-mingw32' prepare() { cd "${srcdir}/${_pkgfqn}" # apply patches; further descriptions can be found in patch files itself for patch in "$srcdir/"*.patch; do msg2 "Applying patch $patch" patch -p1 -i "$patch" done # make sure the Qt 5 build system uses our external PCRE library and zlib rm -rf src/3rdparty/{pcre,zlib} # clear buildflags ('!buildflags' only effects build() but not prepare()) unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH # build qmake using mingw-w64 {C,CXX,LD}FLAGS # * This also sets default {C,CXX,LD}FLAGS for projects built using qmake. source mingw-env sed -i -e "s|^\(QMAKE_CFLAGS_RELEASE.*=\).*$|\1 ${CFLAGS}|" \ -e "s|^\(QMAKE_CXXFLAGS_RELEASE.*=\).*$|\1 ${CXXFLAGS}|" \ -e "s|^\(QMAKE_LFLAGS_RELEASE.*=\).*$|\1 ${LDFLAGS}|" \ mkspecs/common/gcc-base.conf \ mkspecs/common/g++-win32.conf sed -i -e "s|^\(QMAKE_LFLAGS_RELEASE.*=\).*$|\1|" \ mkspecs/common/g++-unix.conf } build() { cd "${srcdir}/${_pkgfqn}" for _arch in ${_architectures}; do # define general configure arguments local qt_configure_args="\ -xplatform win32-g++ \ -optimized-qmake \ -verbose \ -opensource \ -confirm-license \ -force-pkg-config \ -force-debug-info \ -system-zlib \ -system-libpng \ -system-libjpeg \ -system-sqlite \ -system-freetype \ -system-harfbuzz \ -system-pcre \ -no-fontconfig \ -sql-mysql \ -sql-psql \ -sql-sqlite \ -dbus-linked \ -no-glib \ -no-icu \ -iconv \ -nomake examples \ -make tools \ -hostprefix /usr/${_arch} \ -hostdatadir /usr/${_arch}/lib/qt \ -hostbindir /usr/${_arch}/lib/qt/bin \ -prefix /usr/${_arch} \ -bindir /usr/${_arch}/bin \ -archdatadir /usr/${_arch}/lib/qt \ -datadir /usr/${_arch}/share/qt \ -docdir /usr/${_arch}/share/doc/qt \ -examplesdir /usr/${_arch}/share/qt/examples \ -headerdir /usr/${_arch}/include/qt \ -libdir /usr/${_arch}/lib \ -plugindir /usr/${_arch}/lib/qt/plugins \ -sysconfdir /usr/${_arch}/etc \ -translationdir /usr/${_arch}/share/qt/translations \ -device-option CROSS_COMPILE=${_arch}- \ -device-option CROSS_COMPILE_PREFIX=/usr/${_arch}" # allows using ccache despite the use of pre-compile header (sloppiness must be set to pch_defines,time_macros in ccache config for this) qt_configure_args+=' -device-option CROSS_COMPILE_CFLAGS=-fpch-preprocess' qt_configure_args+=' -device-option CROSS_COMPILE_CXXFLAGS=-fpch-preprocess' # add include directory of freetype2 and dbus manually (pkg-config detection in qmake doesn't work which is currently ignored via a patch) qt_configure_args+=" $(${_arch}-pkg-config --cflags-only-I freetype2 dbus-1 | sed -e "s/-I\/usr\/${_arch}\/include //g")" # note: The sed is required to prevent -isystem /usr/${_arch}/include (qmake will turn -I into -isystem) which would lead to # the same issue as here: https://github.com/Martchus/tageditor/issues/22#issuecomment-330899141 # enable debug build if MINGW_W64_QT_DEBUG_BUILD is set (could be set in eg. /etc/makepkg.config if debug build is wanted) [[ $MINGW_W64_QT_DEBUG_BUILD ]] \ && qt_configure_args+=' -debug-and-release' \ || qt_configure_args+=' -release' # configure usage of ANGLE/OpenGL # FIXME: This is broken because we needed to invoke fxc.exe (Direct3D Shader Compiler) # during the build. Maybe start it with WINE? msg2 'Using ANGLE as OpenGL backend' qt_configure_args+=' -angle' # enable declarations of GLES functions # FIXME: Still required? qt_configure_args+=' -DGL_GLEXT_PROTOTYPES' # add include directory of MariaDB qt_configure_args+=" -I/usr/${_arch}/include/mariadb" # add include directory for Vulkan export VULKAN_SDK=/usr/${_arch} msg2 'Configure and build qmake' mkdir -p ../build-${_arch} && pushd ../build-${_arch} qt_configure_args+=' -shared' # configure shared version to load OpenSSL dynamically qt_configure_args+=' -openssl-runtime' qt_configure_args+=' -device-option CROSS_COMPILE_CUSTOM_CONFIG=actually_a_shared_build' # override LD_LIBRARY_PATH so libraries for native build tools like libQt5Bootstrap.so are found #export LD_LIBRARY_PATH="$PWD/lib" #export LDFLAGS="-L$PWD/lib" msg2 'Build qmake and configure' && ../${_pkgfqn}/configure $qt_configure_args msg2 'Build Qt libraries' && make popd done } package() { for _arch in ${_architectures}; do cd "$srcdir/${_pkgfqn}" make install -C ../build-${_arch} INSTALL_ROOT="${pkgdir}" # use prl files from build directory since installed prl files seem to have incorrect QMAKE_PRL_LIBS_FOR_CMAKE pushd "$srcdir/build-${_arch}/lib" find -iname '*.prl' -exec cp --target-directory "${pkgdir}/usr/${_arch}/lib" --parents {} + popd pushd "$srcdir/build-${_arch}/plugins" find -iname '*.prl' -exec cp --target-directory "${pkgdir}/usr/${_arch}/lib/qt/plugins" --parents {} + popd # remove DLLs from libdir (DLLs are installed in both bindir and libdir, one copy is sufficient) find "${pkgdir}/usr/${_arch}/lib" -maxdepth 1 -name "*.dll" -exec rm {} \; # install missing libQt5BootstrapDBus.a manually cp --target-directory "${pkgdir}/usr/${_arch}/lib" "$srcdir/build-${_arch}/lib/libQt5BootstrapDBus.a" # create symlinks for tools mkdir -p "${pkgdir}/usr/bin" for tool in qmake moc rcc uic qdbuscpp2xml qdbusxml2cpp qdoc syncqt.pl; do ln -s "../${_arch}/lib/qt/bin/${tool}" "${pkgdir}/usr/bin/${_arch}-${tool}-qt5" done # create qt.conf containing plugin path, see https://github.com/Martchus/PKGBUILDs/issues/109 echo "[Paths] Plugins = /usr/${_arch}/lib/qt/plugins" > "${pkgdir}/usr/${_arch}/bin/qt.conf" # drop QMAKE_PRL_BUILD_DIR because reference the build dir find "${pkgdir}/usr/${_arch}/lib" -type f -name '*.prl' -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \; # remove doc rm -rf "${pkgdir}/usr/${_arch}/share/doc" # remove prl files for debug version if ! [[ $MINGW_W64_QT_DEBUG_BUILD ]]; then for file in $(find "${pkgdir}/usr/${_arch}" -name '*d.prl' -o -name '*d.static.prl'); do [ -f "${file%d*}${file##*d}" ] && rm "${file}"; done fi # remove '.static.prl' files find "${pkgdir}/usr/${_arch}" -name '.static.prl' -delete # replace library path in *.prl files so it points to the installed location and not the build directory find "${pkgdir}/usr/${_arch}/lib" \( -type f -name '*.prl' -o -name '*.pc' \) -exec sed -i -e "s:${PWD%/*}/build-${_arch}/lib:/usr/${_arch}/lib:g" {} \; # strip binaries, remove unuseful files strip --strip-all "${pkgdir}/usr/${_arch}/lib/qt/bin/"*[!.pl] strip --strip-debug "${pkgdir}/usr/${_arch}/lib/libQt5Bootstrap"*.a if [[ $NO_EXECUTABLES ]]; then find "${pkgdir}/usr/${_arch}" -name '*.exe' -delete else find "${pkgdir}/usr/${_arch}" -name '*.exe' -exec ${_arch}-strip --strip-all {} \; fi find "${pkgdir}/usr/${_arch}" \( -name '*.bat' -o -name '*.def' -o -name '*.exp' \) -delete find "${pkgdir}/usr/${_arch}" -name '*.dll' -exec ${_arch}-strip --strip-unneeded {} \; find "${pkgdir}/usr/${_arch}" \( -name '*.a' -not -name 'libQt5QmlDevTools.a' -not -name 'libQt5Bootstrap.a' \) -exec ${_arch}-strip -g {} \; done }