aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartchus2016-08-30 23:33:54 +0200
committerMartchus2016-08-30 23:33:54 +0200
commitaa00f964343af5611e30bf77896fbe66c933a494 (patch)
treeeb66547c8b0a0b43d2182946f72cfda1f66a130e
parent220ae6877f510f1bd06bf9a28b1ff7d489969047 (diff)
downloadaur-aa00f964343af5611e30bf77896fbe66c933a494.tar.gz
Fix static variant
-rw-r--r--.SRCINFO47
-rw-r--r--PKGBUILD290
-rw-r--r--qt5-add-angle-support.patch46
-rw-r--r--qt5-allow-usage-of-static-qt-with-cmake.patch444
-rw-r--r--qt5-customize-extensions-for-static-build.patch15
-rw-r--r--qt5-disable-default-lib-include-detection.patch11
-rw-r--r--qt5-fix-linking-against-static-dbus.patch26
-rw-r--r--qt5-fix-linking-against-static-pcre.patch13
-rw-r--r--qt5-fix-opengl-to-many-sections.patch10
-rw-r--r--qt5-fix-static-psql-mysql.patch15
-rw-r--r--qt5-fixes-from-mxe.patch91
-rw-r--r--qt5-merge-static-and-shared-library-trees.patch50
-rw-r--r--qt5-pkgconfig-static-library-name-workaround.patch19
-rw-r--r--qt5-use-correct-pkg-config-static-flags.patch14
-rw-r--r--qt5-use-external-angle-library.patch79
-rw-r--r--qt5-use-pkgconfig-for-harfbuzz.patch31
-rw-r--r--qt5-use-win32-g++-mkspecs-profile.patch14
-rw-r--r--qt5-win32-static-cmake-link-ws2_32-and--static.patch15
18 files changed, 1100 insertions, 130 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 23f15179f295..5093fc369205 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,17 @@
# Generated by mksrcinfo v8
-# Wed Jun 22 18:54:43 UTC 2016
+# Tue Aug 30 21:33:51 UTC 2016
pkgbase = mingw-w64-qt5-base-static
pkgdesc = A cross-platform application and UI framework (mingw-w64)
pkgver = 5.7.0
- pkgrel = 1
+ pkgrel = 4
url = https://www.qt.io/
arch = any
groups = mingw-w64-qt
groups = mingw-w64-qt5
- license = custom, FDL, GPL3, LGPL
+ license = GPL3
+ license = LGPL3
+ license = FDL
+ license = custom
makedepends = mingw-w64-gcc
makedepends = mingw-w64-postgresql-libs
makedepends = mingw-w64-mariadb-connector-c
@@ -16,55 +19,67 @@ pkgbase = mingw-w64-qt5-base-static
depends = mingw-w64-crt
depends = mingw-w64-zlib
depends = mingw-w64-libjpeg-turbo
- depends = mingw-w64-libiconv
depends = mingw-w64-sqlite
depends = mingw-w64-libpng
depends = mingw-w64-openssl
depends = mingw-w64-libdbus
- depends = mingw-w64-pcre
depends = mingw-w64-harfbuzz
depends = mingw-w64-qt5-base
- depends = mingw-w64-angleproject
optdepends = mingw-w64-postgresql-libs: PostgreSQL support
optdepends = mingw-w64-mariadb-connector-c: MySQL support
optdepends = qtchooser
options = !strip
options = !buildflags
options = staticlibs
+ options = !emptydirs
source = https://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/qtbase-opensource-src-5.7.0.tar.xz
- source = add-angle-support.patch
- source = use-external-angle-library.patch
+ source = qt5-add-angle-support.patch
+ source = qt5-use-external-angle-library.patch
source = qt5-workaround-pkgconfig-install-issue.patch
- source = qt5-qtbase-fix-linking-against-static-pcre.patch
+ source = qt5-merge-static-and-shared-library-trees.patch
+ source = qt5-fix-linking-against-static-pcre.patch
source = qt5-rename-qtmain-to-qt5main.patch
source = qt5-dont-build-host-libs-static.patch
source = qt5-enable-rpath-for-host-tools.patch
source = qt5-dont-add-resource-files-to-qmake-libs.patch
source = qt5-prevent-debug-library-names-in-pkgconfig-files.patch
- source = qt5-fix-static-dbus-detection.patch
+ source = qt5-fix-linking-against-static-dbus.patch
source = qt5-use-win32-g++-mkspecs-profile.patch
source = qt5-use-system-zlib-in-host-libs.patch
- source = fix-opengl-to-many-sections.patch
- source = fix-static-psql-mysql.patch
- source = qtbase-1-fixes.patch
+ source = qt5-fix-opengl-to-many-sections.patch
+ source = qt5-fix-static-psql-mysql.patch
+ source = qt5-fixes-from-mxe.patch
source = qt5-fix-implib-ext.patch
+ source = qt5-disable-default-lib-include-detection.patch
+ source = qt5-win32-static-cmake-link-ws2_32-and--static.patch
+ source = qt5-allow-usage-of-static-qt-with-cmake.patch
+ source = qt5-customize-extensions-for-static-build.patch
+ source = qt5-use-correct-pkg-config-static-flags.patch
+ source = qt5-use-pkgconfig-for-harfbuzz.patch
md5sums = 184f9460b40752d71b15b827260580c2
md5sums = bab00ccc19d888997f323c80354a7c3f
md5sums = f7e1487de6e85116d9c6bde2eac4fb73
md5sums = bc99c4cc6998295d76f37ed681c20d47
+ md5sums = 370218fd439f25ab3f35bd1f14652988
md5sums = 4fe6523dd1c34398df3aa5a8763530cc
md5sums = f32a768e1acb9785c79c8e93aa266db2
md5sums = 3bd322551924543553a2bf81b4419a09
md5sums = 30fa9ddf8d842b1392e8d63868940657
md5sums = 99bb9f51ec684803768f36e407baf486
md5sums = 6a6bc88f35ac8080869de39bc128ce5b
- md5sums = 40de3aaf7d713034e06f4eece665b1ba
- md5sums = 0186761e13206a32b689f10898e0d536
+ md5sums = 261d9071a6af3f1d5c3f955da3781573
+ md5sums = f28edb1fe61c575522d3df814e680f9a
md5sums = c15d9f480d0248648fa52aeacb46e3c7
md5sums = 612a4dfb9f1a3898a1920c28bb999159
md5sums = d0eb81aef1a21c65813fe4ddabbc4206
- md5sums = 42c4968a0bd29856b683ad1b5d2b2a75
+ md5sums = 1e8c03872062fe8499ed7786475ed4e0
md5sums = 83139869355c2d46921adb25e47cf0fa
+ md5sums = b9565219e9252a17fc1b8fb9ee30662c
+ md5sums = 20de722808e8a3fb684b0212bef8de46
+ md5sums = 1dc792faa7761d8d7d2f17170da04d6b
+ md5sums = 41ec67d9e5e70e0d6d93b42aebd0e12a
+ md5sums = 61c0f9d0095c5a6dec8d14e9ec35a608
+ md5sums = bba65d27704cf36e148d8f18ad02ad15
pkgname = mingw-w64-qt5-base-static
diff --git a/PKGBUILD b/PKGBUILD
index 161984fc3307..b16d3ec510af 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,104 +6,159 @@
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.
+# There currently three variants of the package:
+# - mingw-w64-qt5-base: includes dynamic libs only, using native OpenGL
+# - mingw-w64-qt5-base-angle: includes dynamic libs only, using ANGLE, conflicts with OpenGL version
+# - mingw-w64-qt5-base-static: includes static libs only, relies on mingw-w64-qt5-base for headers and tools
+
+# By default CMake and qmake will link against the dynamic libary.
+
+# To use the static variant with CMake set the following variable before calling find_package for finding a Qt module:
+# set(USE_STATIC_QT_BUILD ON)
+# To use a static plugin, add the corresponding imported target, eg.
+# target_link_libraries(target ... Qt5::QWindowsIntegrationPlugin)
+# Automatically importing static plugins is currently not possible, though. Hence it is required to use Q_IMPORT_PLUGIN, eg.
+# #include<QtPlugin>
+# Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+
+# To use the static variant with qmake set the following variables (either inside the *.pro file or as qmake argument):
+# CONFIG+=static
+
+# Further Qt modules (those not found in the base repository and hence not included in this package) include by default
+# static and dynamic libraries; if only one version is requried, just
+# set $NO_STATIC_LIBS or $NO_SHARED_LIBS.
+
+# By default, executables will not be removed because I find them useful when testing. To remove executables
+# set $NO_EXECUTABLES or $NO_STATIC_EXECUTABLES to remove statically linked executables only.
+# However, if Qt modules containing tools are built as static and as dynamic library only the dynamically linked
+# tools will be present in the package.
+
+# Qt packages can be built in the following order (for example):
+# qt5-base qt5-declarative qt5-tools qt5-xmlpatterns qt5-script qt5-location qt5-multimedia qt5-sensors qt5-webchannel qt5-3d qt5-imageformats qt5-quickcontrols qt5-quickcontrols2 qt5-translations qt5-svg qt5-websockets qt5-winextras qt5-serialport qt5-canvas3d qt5-connectivity qt5-charts qt5-gamepad qt5-scxml qt5-datavis3s qt5-virtualkeyboard qt5-activeqt qt5-webkit
+
# Helper functions for the split builds
isStatic() {
- [ $pkgname = "mingw-w64-qt5-base-static" ]
+ [[ $pkgname = "mingw-w64-qt5-base-static" ]] || \
+ [[ $pkgname == 'mingw-w64-qt5-base-angle-static' ]] || \
+ [[ $pkgname == 'mingw-w64-qt5-base-noopengl-static' ]]
}
-
isOpenGL() {
- [ $pkgname = "mingw-w64-qt5-base-opengl" ]
+ [[ $pkgname = "mingw-w64-qt5-base" ]] || [[ $pkgname = "mingw-w64-qt5-base-static" ]]
+}
+isANGLE() {
+ [[ $pkgname == 'mingw-w64-qt5-base-angle' ]] || [[ $pkgname == 'mingw-w64-qt5-base-angle-static' ]]
+}
+isNoOpenGL() {
+ [[ $pkgname == 'mingw-w64-qt5-base-noopengl' ]] || [[ $pkgname == 'mingw-w64-qt5-base-noopengl-static' ]]
}
pkgname=mingw-w64-qt5-base-static
pkgver=5.7.0
-pkgrel=1
+pkgrel=4
pkgdesc="A cross-platform application and UI framework (mingw-w64)"
-! isStatic && arch=('i686' 'x86_64')
-isStatic && arch=('any') # the static variant doesn't contain any executables which need to be executed on the host
-url="https://www.qt.io/"
-license=("custom, FDL, GPL3, LGPL")
-depends=(
- 'mingw-w64-crt'
- 'mingw-w64-zlib'
- 'mingw-w64-libjpeg-turbo'
- 'mingw-w64-libiconv'
- 'mingw-w64-sqlite'
- 'mingw-w64-libpng'
- 'mingw-w64-openssl'
- 'mingw-w64-libdbus'
- 'mingw-w64-pcre'
- 'mingw-w64-harfbuzz'
-)
+# the static variant doesn't contain any executables which need to be executed on the build machine
+isStatic && arch=('any') || 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-libdbus' 'mingw-w64-harfbuzz')
groups=('mingw-w64-qt' 'mingw-w64-qt5')
-optdepends=(
- 'mingw-w64-postgresql-libs: PostgreSQL support'
- 'mingw-w64-mariadb-connector-c: MySQL support'
- 'qtchooser'
-)
-makedepends=('mingw-w64-gcc'
- 'mingw-w64-postgresql-libs'
- 'mingw-w64-mariadb-connector-c'
- 'mingw-w64-pkg-config')
-options=(!strip !buildflags staticlibs)
+optdepends=('mingw-w64-postgresql-libs: PostgreSQL support' 'mingw-w64-mariadb-connector-c: MySQL support'
+ 'qtchooser')
+makedepends=('mingw-w64-gcc' 'mingw-w64-postgresql-libs' 'mingw-w64-mariadb-connector-c' 'mingw-w64-pkg-config')
+options=(!strip !buildflags staticlibs !emptydirs)
_pkgfqn="qtbase-opensource-src-${pkgver}"
source=("https://download.qt.io/official_releases/qt/${pkgver:0:3}/${pkgver}/submodules/${_pkgfqn}.tar.xz"
- "add-angle-support.patch"
- "use-external-angle-library.patch"
+ "qt5-add-angle-support.patch"
+ "qt5-use-external-angle-library.patch"
"qt5-workaround-pkgconfig-install-issue.patch"
- "qt5-qtbase-fix-linking-against-static-pcre.patch"
+ "qt5-merge-static-and-shared-library-trees.patch"
+ "qt5-fix-linking-against-static-pcre.patch"
"qt5-rename-qtmain-to-qt5main.patch"
"qt5-dont-build-host-libs-static.patch"
"qt5-enable-rpath-for-host-tools.patch"
"qt5-dont-add-resource-files-to-qmake-libs.patch"
"qt5-prevent-debug-library-names-in-pkgconfig-files.patch"
- "qt5-fix-static-dbus-detection.patch"
+ "qt5-fix-linking-against-static-dbus.patch"
"qt5-use-win32-g++-mkspecs-profile.patch"
"qt5-use-system-zlib-in-host-libs.patch"
- "fix-opengl-to-many-sections.patch"
- "fix-static-psql-mysql.patch"
- "qtbase-1-fixes.patch"
- "qt5-fix-implib-ext.patch")
+ "qt5-fix-opengl-to-many-sections.patch"
+ "qt5-fix-static-psql-mysql.patch"
+ "qt5-fixes-from-mxe.patch"
+ "qt5-fix-implib-ext.patch"
+ "qt5-disable-default-lib-include-detection.patch"
+ "qt5-win32-static-cmake-link-ws2_32-and--static.patch"
+ "qt5-allow-usage-of-static-qt-with-cmake.patch"
+ "qt5-customize-extensions-for-static-build.patch"
+ "qt5-use-correct-pkg-config-static-flags.patch"
+ "qt5-use-pkgconfig-for-harfbuzz.patch")
md5sums=('184f9460b40752d71b15b827260580c2'
'bab00ccc19d888997f323c80354a7c3f'
'f7e1487de6e85116d9c6bde2eac4fb73'
'bc99c4cc6998295d76f37ed681c20d47'
+ '370218fd439f25ab3f35bd1f14652988'
'4fe6523dd1c34398df3aa5a8763530cc'
'f32a768e1acb9785c79c8e93aa266db2'
'3bd322551924543553a2bf81b4419a09'
'30fa9ddf8d842b1392e8d63868940657'
'99bb9f51ec684803768f36e407baf486'
'6a6bc88f35ac8080869de39bc128ce5b'
- '40de3aaf7d713034e06f4eece665b1ba'
- '0186761e13206a32b689f10898e0d536'
+ '261d9071a6af3f1d5c3f955da3781573'
+ 'f28edb1fe61c575522d3df814e680f9a'
'c15d9f480d0248648fa52aeacb46e3c7'
'612a4dfb9f1a3898a1920c28bb999159'
'd0eb81aef1a21c65813fe4ddabbc4206'
- '42c4968a0bd29856b683ad1b5d2b2a75'
- '83139869355c2d46921adb25e47cf0fa')
-_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
-
-isStatic && depends+=("mingw-w64-qt5-base")
-! isOpenGL && depends+=("mingw-w64-angleproject")
-isOpenGL && provides+=("mingw-w64-qt5-base")
-isOpenGL && conflicts+=("mingw-w64-qt5-base")
+ '1e8c03872062fe8499ed7786475ed4e0'
+ '83139869355c2d46921adb25e47cf0fa'
+ 'b9565219e9252a17fc1b8fb9ee30662c'
+ '20de722808e8a3fb684b0212bef8de46'
+ '1dc792faa7761d8d7d2f17170da04d6b'
+ '41ec67d9e5e70e0d6d93b42aebd0e12a'
+ '61c0f9d0095c5a6dec8d14e9ec35a608'
+ 'bba65d27704cf36e148d8f18ad02ad15')
+
+_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
+
+isStatic && depends+=(${pkgname%-static})
+isANGLE && depends+=('mingw-w64-angleproject')
+if ! isOpenGL; then
+ provides+=('mingw-w64-qt5-base')
+ if isStatic; then
+ conflicts+=('mingw-w64-qt5-base-static' 'mingw-w64-qt5-base-angle-static' 'mingw-w64-qt5-base-noopengl-static')
+ else
+ conflicts+=('mingw-w64-qt5-base' 'mingw-w64-qt5-base-angle' 'mingw-w64-qt5-base-noopengl')
+ fi
+fi
+
+patch() {
+ local input_found=
+ local patch_file=
+ for arg in $@; do
+ if [[ $input_found ]]; then
+ patch_file="$arg"
+ break
+ fi
+ [[ $arg == -i ]] && input_found=1
+ done
+ msg2 "Applying patch $patch_file"
+ /usr/bin/patch $@
+}
prepare() {
cd "${srcdir}/${_pkgfqn}"
# include fixes from MXE
- patch -p1 -b -i ../qtbase-1-fixes.patch
+ patch -p1 -b -i ../qt5-fixes-from-mxe.patch
- if ! isOpenGL; then
+ if isANGLE; then
# Add support for Angle
- patch -p1 -i ../add-angle-support.patch
-
+ patch -p1 -i ../qt5-add-angle-support.patch
# Make sure our external Angle package is used instead of the bundled one
- patch -p1 -i ../use-external-angle-library.patch
+ patch -p1 -i ../qt5-use-external-angle-library.patch
fi
- # opengl to many sections error
- isOpenGL && patch -p0 -i ../fix-opengl-to-many-sections.patch
+ # Fix opengl to many sections error
+ isOpenGL && patch -p0 -i ../qt5-fix-opengl-to-many-sections.patch
# Make sure the .pc files of the Qt5 modules are installed correctly
patch -p0 -i ../qt5-workaround-pkgconfig-install-issue.patch
@@ -122,17 +177,21 @@ prepare() {
# files for the debug build an unique file name
patch -p1 -i ../qt5-prevent-debug-library-names-in-pkgconfig-files.patch
- # Fix the detection of the static DBus
- patch -p1 -i ../qt5-fix-static-dbus-detection.patch
+ # Fix linking against static DBus
+ patch -p0 -i ../qt5-fix-linking-against-static-dbus.patch
# Patch the win32-g++ mkspecs profile to match our environment
patch -p0 -i ../qt5-use-win32-g++-mkspecs-profile.patch
+ # Use pkgconfig for harfbzz dependency
+ # (must be applied after qt5-use-win32-g++-mkspecs-profile.patch)
+ patch -p0 -i ../qt5-use-pkgconfig-for-harfbuzz.patch
+
# The bundled pcre is built as static library by default
# As we're not using the bundled copy but our own copy
# we need to do some fiddling to fix compilation issues
# when trying to build static qmake projects
- patch -p1 -i ../qt5-qtbase-fix-linking-against-static-pcre.patch
+ patch -p1 -i ../qt5-fix-linking-against-static-pcre.patch
# Make sure the qtmain (static) library doesn't conflict with the one
# provided by the mingw-qt (qt4) package. The mkspecs profile is already
@@ -157,10 +216,26 @@ prepare() {
# due to the other host-libs patches.
patch -p0 -i ../qt5-use-system-zlib-in-host-libs.patch
+ # Determine the compiler's default include and lib directories at qmake time
+ # see https://codereview.qt-project.org/#/c/157817
+ patch -p1 -i ../qt5-disable-default-lib-include-detection.patch
+
# Fix qmake to append .dll.a extension to import libs
patch -p1 -i ../qt5-fix-implib-ext.patch
- isStatic && patch -p0 -i ../fix-static-psql-mysql.patch
+ # Allow use of static version via CMake
+ patch -p0 -i ../qt5-win32-static-cmake-link-ws2_32-and--static.patch
+ patch -p0 -i ../qt5-allow-usage-of-static-qt-with-cmake.patch
+
+ # Allow installation of static Qt in the same prefix as the shared version
+ patch -p0 -i ../qt5-merge-static-and-shared-library-trees.patch
+ isStatic && patch -p0 -i ../qt5-customize-extensions-for-static-build.patch
+
+ # Use correct pkg-config --static flag
+ isStatic && patch -p1 -i ../qt5-use-correct-pkg-config-static-flags.patch
+
+ # Fix detection of static mariadb client
+ isStatic && patch -p0 -i ../qt5-fix-static-psql-mysql.patch
# Make sure the Qt5 build system uses our external ANGLE library
rm -rf src/3rdparty/angle include/QtANGLE/{EGL,GLES2,GLES3,KHR}
@@ -173,17 +248,17 @@ build() {
cd "${srcdir}/${_pkgfqn}"
# Setup flags
- export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
- export CXXFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
+ local mingw_flags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4'
+ export CFLAGS="$mingw_flags"
+ export CXXFLAGS="$mingw_flags"
unset LDFLAGS
for _arch in ${_architectures}; do
-
# Phonon is disabled for now because we lack the directx headers
# The odd paths for the -hostbindir argument are on purpose
# The qtchooser tool assumes that the tools 'qmake', 'moc' and others
# are all available in the same folder with these exact file names
- # To prevent conflicts with the mingw-qt (Qt4) package we have
+ # To prevent conflicts with the mingw-w64-qt4 package we have
# to put these tools in a dedicated folder
qt_configure_args="\
-xplatform win32-g++ \
@@ -224,13 +299,14 @@ build() {
-translationdir /usr/${_arch}/share/qt/translations \
-device-option CROSS_COMPILE=${_arch}-"
- # fix include directory of dbus
+ # Fix include directory of dbus
qt_configure_args+=" $(${_arch}-pkg-config --cflags-only-I dbus-1 --cflags)"
- if isStatic; then
- qt_configure_args+=' -opengl no'
- elif isOpenGL; then
+ # Configure usage of ANGLE/OpenGL
+ if isOpenGL; then
qt_configure_args+=' -opengl desktop'
+ elif isNoOpenGL; then
+ qt_configure_args+=' -no-opengl'
else
# GL_GLEXT_PROTOTYPES must be defined to enable declarations GLES functions
qt_configure_args+=' -DGL_GLEXT_PROTOTYPES'
@@ -239,18 +315,18 @@ build() {
unset PKG_CONFIG_PATH
+ # Fix MySQL
if ! isStatic; then
export QT_LFLAGS_MYSQL="-L/usr/${_arch}/lib -lmysql"
fi
-
# Qt doesn't detect mysql correctly, so use this:
export QT_CFLAGS_MYSQL="-I/usr/${_arch}/include/mariadb"
- #export QT_LFLAGS_MYSQL_R="-lmariadbclient -lws2_32 -lpthread -lz -lm -lssl -lcrypto"
# Hardcode MySQL flags into configure (really nice solution :( )
sed -e "s|^QT_CFLAGS_MYSQL=.*$|QT_CFLAGS_MYSQL=\"${QT_CFLAGS_MYSQL}\"|g" -i "${srcdir}/${_pkgfqn}/configure"
sed -e "s|^QT_LFLAGS_MYSQL=.*$|QT_LFLAGS_MYSQL=\"${QT_LFLAGS_MYSQL}\"|g" -i "${srcdir}/${_pkgfqn}/configure"
#sed -e "s|^QT_LFLAGS_MYSQL_R=.*$|QT_LFLAGS_MYSQL_R=\"${QT_LFLAGS_MYSQL_R}\"|g" -i "${srcdir}/${_pkgfqn}/configure"
qt_configure_args_mysql="-mysql_config /this/file/should/not/exist"
+ # TODO: test whether this workaround is still requried
mkdir -p ../build-${_arch} && pushd ../build-${_arch}
@@ -264,7 +340,6 @@ build() {
../${_pkgfqn}/configure -shared $qt_configure_args $qt_configure_args_mysql
LD_LIBRARY_PATH="$PWD/lib" LDFLAGS="-L$PWD/lib" make
fi
-
popd
done
}
@@ -275,68 +350,69 @@ package() {
make install -C ../build-${_arch} INSTALL_ROOT="${pkgdir}"
if isStatic; then
- # Drop the qtmain and Qt5Bootstrap static libraries from the static tree as
- # they are already part of the main tree
- rm -f "${pkgdir}/usr/${_arch}/lib/libqt5main"*
- rm -f "${pkgdir}/usr/${_arch}/lib/libQt5Bootstrap"*
- rm -f "${pkgdir}/usr/${_arch}/lib/libQt5OpenGLExtensions"*
- rm -f "${pkgdir}/usr/${_arch}/lib/libQt5PlatformSupport"*
-
- # Also keep various Qt5 plugins to be used in static builds
- # https://bugzilla.redhat.com/show_bug.cgi?id=1257630
- mv "${pkgdir}/usr/${_arch}/lib/qt/plugins/"*/*.a "${pkgdir}/usr/${_arch}/lib/"
-
- # we want to keep a couple pri files not found in base
+ # The static release contains only the static libs itself but relies on the
+ # shared release for Qt5Bootstrap library and tools (qmake, uic, ...)
+
+ # Drop Qt5Bootstrap and libraries which are only provided as statically
+ # and are hence already present in the shared version
+ rm -f "${pkgdir}/usr/${_arch}/lib/"{lib,}qt5main* \
+ "${pkgdir}/usr/${_arch}/lib/"{lib,}Qt5OpenGLExtensions* \
+ "${pkgdir}/usr/${_arch}/lib/"{lib,}Qt5PlatformSupport* \
+ "${pkgdir}/usr/${_arch}/lib/"libQt5Bootstrap*
+
+ # Keep various Qt 5 plugins to be used in static builds
+ pushd "${pkgdir}/usr/${_arch}/lib/" && ln -s "./qt/plugins/"*/*.a . && popd
+
+ # Keep a couple pri files not found in base
mv "${pkgdir}/usr/${_arch}/lib/qt/mkspecs/modules/qt_plugin_"*.pri "${pkgdir}/usr/${_arch}"
+ # remove CMake which are also in base
+ find "${pkgdir}/usr/${_arch}/lib/cmake" -not -name "Static*.cmake" -exec rm {} \;
+
# Delete duplicate files that are in the base package
rm -fR "${pkgdir}/usr/${_arch}/"{include,share}
- rm -fR "${pkgdir}/usr/${_arch}/lib/"{qt/bin,qt/mkspecs,pkgconfig,cmake}
+ rm -fR "${pkgdir}/usr/${_arch}/lib/"{qt/bin,qt/mkspecs}
- # move pri files back
+ # Move pri files back
mkdir -p "${pkgdir}/usr/${_arch}/lib/qt/mkspecs/modules"
mv "${pkgdir}/usr/${_arch}/"*.pri "${pkgdir}/usr/${_arch}/lib/qt/mkspecs/modules"
- else # not static => shared release
- # The .dll's are installed in both bindir and libdir
- # One copy of the .dll's is sufficient
- rm -f "${pkgdir}/usr/${_arch}/lib/"*.dll
+ else # Shared release
+ # The .dll's are installed in both bindir and libdir, one copy of the .dll's is sufficient
+ find "${pkgdir}/usr/${_arch}/lib" -maxdepth 1 -name "*.dll" -exec rm {} \;
# Add qtchooser support
- [ "${_arch}" = "i686-w64-mingw32" ] && mingwn='mingw32' || mingwn='mingw64'
+ [[ ${_arch} == i686-w64-mingw32 ]] && mingwn='mingw32' || mingwn='mingw64'
mkdir -p "${pkgdir}/etc/xdg/qtchooser"
- echo "/usr/${_arch}/lib/qt/bin" > "${pkgdir}/etc/xdg/qtchooser/$mingwn-qt5.conf"
+ echo "/usr/${_arch}/lib/qt/bin" > "${pkgdir}/etc/xdg/qtchooser/$mingwn-qt5.conf"
echo "/usr/${_arch}/lib" >> "${pkgdir}/etc/xdg/qtchooser/$mingwn-qt5.conf"
- # Manually install qmake and other native tools so we don't depend anymore on
- # the version of the native system Qt and also fix issues as illustrated at
- # http://stackoverflow.com/questions/6592931/building-for-windows-under-linux-using-qt-creator
- # Also make sure the tools can be found by CMake
+ # 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"
+ ln -s "../${_arch}/lib/qt/bin/${tool}" "${pkgdir}/usr/bin/${_arch}-${tool}-qt5"
done
fi
- # The pkg-config files for Qt5Bootstrap aren't interesting as this particular
- # library only contains native code and not cross-compiled code
- rm -f "${pkgdir}/usr/${_arch}/lib/pkgconfig/Qt5Bootstrap.pc"
-
- # remove doc
+ # Remove doc
rm -rf "${pkgdir}/usr/${_arch}/share/doc"
- # strip the binaries
+ # Strip the binaries
if ! isStatic; then
strip --strip-all "${pkgdir}/usr/${_arch}/lib/qt/bin/"*[!.pl]
strip --strip-unneeded "${pkgdir}/usr/${_arch}/lib/libQt5Bootstrap"{,DBus}.so.${pkgver}
fi
- # keeping prl files for base build since qbs seems to need them.
- isStatic && rm -f "${pkgdir}/usr/${_arch}/lib"{,/qt/plugins/*}/*.prl
-
- # remove binaries, strip libs
- find "${pkgdir}/usr/${_arch}" -name "*.exe" -o -name "*.bat" -o -name "*.def" -o -name "*.exp" | xargs -rtl1 rm
+ # Applications might be useful as well; keeping them by default will not hurt anybody I suppose
+ if isStatic || [[ $NO_EXECUTABLES ]]; then
+ find "${pkgdir}/usr/${_arch}" -name "*.exe" -exec rm {} \;
+ else
+ find "${pkgdir}/usr/${_arch}" -name "*.exe" -exec ${_arch}-strip --strip-all {} \;
+ fi
+ # No use for these files though
+ find "${pkgdir}/usr/${_arch}" \( -name "*.bat" -o -name "*.def" -o -name "*.exp" \) -exec rm {} \;
+ # Strip binaries
find "${pkgdir}/usr/${_arch}" -name "*.dll" -exec ${_arch}-strip --strip-unneeded {} \;
- find "${pkgdir}/usr/${_arch}" -name "*.a" -o -name "*.dll" | xargs -rtl1 ${_arch}-strip -g
+ find "${pkgdir}/usr/${_arch}" -name "*.a" -exec ${_arch}-strip -g {} \;
done
}
diff --git a/qt5-add-angle-support.patch b/qt5-add-angle-support.patch
new file mode 100644
index 000000000000..8b9af40ac2a8
--- /dev/null
+++ b/qt5-add-angle-support.patch
@@ -0,0 +1,46 @@
+diff -U 3 -r a/configure b/configure
+--- a/configure 2015-06-29 14:03:05.000000000 -0600
++++ b/configure 2015-07-18 11:14:30.312317765 -0600
+@@ -5081,7 +5081,7 @@
+ fi
+ if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
+ if compileTest x11/opengl "OpenGL"; then
+- CFG_OPENGL=desktop
++ CFG_OPENGL=angle
+ elif compileTest unix/opengles2 "OpenGL ES 2.0"; then
+ CFG_OPENGL=es2
+ else
+@@ -6072,6 +6072,11 @@
+ QT_CONFIG="$QT_CONFIG opengles2"
+ fi
+
++if [ "$CFG_OPENGL" = "angle" ]; then
++ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES QT_OPENGL_ES_2"
++ QT_CONFIG="$QT_CONFIG opengles2 egl angle"
++fi
++
+ if [ "$CFG_SHARED" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG shared"
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared"
+@@ -7077,7 +7082,7 @@
+ report_support " NIS ...................." "$CFG_NIS"
+ report_support " OpenGL / OpenVG:"
+ report_support " EGL .................." "$CFG_EGL"
+-report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+"
++report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+" angle "ANGLE"
+ report_support " OpenVG ..............." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native"
+ report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy"
+ if [ -n "$PKG_CONFIG" ]; then
+diff -U 3 -r a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
+--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp 2015-06-29 14:04:40.000000000 -0600
++++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp 2015-07-18 11:16:05.767172673 -0600
+@@ -45,7 +45,9 @@
+ #include <algorithm>
+
+ #include <wingdi.h>
++#ifndef QT_OPENGL_ES_2
+ #include <GL/gl.h>
++#endif
+
+ // #define DEBUG_GL
+
diff --git a/qt5-allow-usage-of-static-qt-with-cmake.patch b/qt5-allow-usage-of-static-qt-with-cmake.patch
new file mode 100644
index 000000000000..844db1e7ce41
--- /dev/null
+++ b/qt5-allow-usage-of-static-qt-with-cmake.patch
@@ -0,0 +1,444 @@
+--- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in.orig 2016-08-14 20:44:32.515151700 +0200
++++ mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in 2016-08-18 23:22:00.447257800 +0200
+@@ -59,19 +59,30 @@
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++ if(USE_STATIC_QT_BUILD)
++ set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib/${LIB_LOCATION}\")
++ else()
++ set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/bin/${LIB_LOCATION}\")
++ endif()
+ !!ELSE
+- set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++ if(USE_STATIC_QT_BUILD)
++ set(imported_location \"lib/${LIB_LOCATION}\")
++ else()
++ set(imported_location \"bin/${LIB_LOCATION}\")
++ endif()
+ !!ENDIF
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
++ if (_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
+ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+- \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
++ \"INTERFACE_LINK_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}\"
+ \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+ !!IF !isEmpty(CMAKE_LIB_SONAME)
+ \"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
+ !!ENDIF
+ # For backward compatibility with CMake < 2.8.12
+- \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
++ \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}\"
+ )
+
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+@@ -222,16 +233,50 @@
+ endif()
+ !!ENDIF
+
+-!!IF !isEmpty(CMAKE_STATIC_TYPE)
+- add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
+- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
+-!!ELSE
+ !!IF equals(TEMPLATE, aux)
+ add_library(Qt5::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
+ !!ELSE
+- add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
++ if(USE_STATIC_QT_BUILD)
++ add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
++ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
++
++ macro(macro_process_prl_file prl_file_location Configuration)
++ if (EXISTS \"${prl_file_location}\")
++ file(STRINGS \"${prl_file_location}\" prl_strings REGEX \"QMAKE_PRL_LIBS_FOR_CMAKE\")
++ string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE *= *([^\\n]*)\" \"\\\\1\" static_depends ${prl_strings})
++ string(REGEX REPLACE \"\\\\$\\\\$\\\\[QT_INSTALL_LIBS\\\\]\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" static_depends \"${static_depends}\")
++ if (_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
++ set(_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}${_list_sep}${static_depends}\")
++ endif()
++ endmacro()
++
++ macro(macro_process_plugin_prl_file prl_file_location Configuration LIB_DIRECTORY LIB_LOCATION)
++ # First add the (static) plugin itself ...
++ if (_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
++ set(_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}${_list_sep}${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/${LIB_DIRECTORY}/${LIB_LOCATION}\")
++ # .. then its dependencies.
++ macro_process_prl_file(${prl_file_location} ${Configuration})
++ endmacro()
++
++!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
++ macro_process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC}\" DEBUG)
++!!ELSE
++ macro_process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC}\" DEBUG)
+ !!ENDIF
++!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
++ macro_process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC}\" RELEASE)
++!!ELSE
++ macro_process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC}\" RELEASE)
++!!ENDIF
++ else()
++ add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
++ endif()
+ !!ENDIF
++
+ !!IF !equals(TEMPLATE, aux)
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
+@@ -240,67 +285,132 @@
+
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
+- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
+- INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE})
++ set(interface_compile_definitions $${MODULE_DEFINE})
++ if(USE_STATIC_QT_BUILD)
++ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
++ INTERFACE_COMPILE_DEFINITIONS $${CMAKE_INTERFACE_COMPILE_DEFINITIONS_STATIC} $${MODULE_DEFINE})
++ else()
++ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
++ INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE})
++ endif()
++ if(USE_STATIC_QT_BUILD)
++ file(GLOB pluginTargetsMaybe \"${CMAKE_CURRENT_LIST_DIR}/StaticQt5$${CMAKE_MODULE_NAME}_*.cmake\")
++ else()
++ file(GLOB pluginTargetsMaybe \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*.cmake\")
++ endif()
++ unset(pluginTargets)
++ if (pluginTargetsMaybe)
++ foreach(pluginTarget ${pluginTargetsMaybe})
++ file(STRINGS ${pluginTarget} matched REGEX Qt5$${CMAKE_MODULE_NAME}_PLUGINS)
++ if (matched)
++ list(APPEND pluginTargets ${pluginTarget})
++ endif()
++ endforeach()
++ endif()
++
++ macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
++ set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
++
++!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
++ set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++!!ELSE
++ set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++!!ENDIF
++ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
++ set_target_properties(Qt5::${Plugin} PROPERTIES
++ \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
++ )
++ if(USE_STATIC_QT_BUILD)
++ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY STATIC_PLUGINS ${Plugin})
++ get_filename_component(_plugindir ${PLUGIN_LOCATION} PATH)
++ get_filename_component(_plugindirname ${_plugindir} NAME)
++ get_filename_component(_pluginname ${PLUGIN_LOCATION} NAME)
++ string(REGEX REPLACE \"^lib(.*)\\\\.a\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib/qt/plugins/${_plugindirname}/\\\\1-static.prl\" plugin_prl_file_location ${_pluginname})
++ macro_process_plugin_prl_file(${plugin_prl_file_location} ${Configuration} \"lib/qt/plugins\" ${PLUGIN_LOCATION})
++ endif()
++
++ endmacro()
++
++ if (pluginTargets)
++ foreach(pluginTarget ${pluginTargets})
++ include(${pluginTarget})
++ endforeach()
++ endif()
+
+ !!IF !equals(TEMPLATE, aux)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ if(USE_STATIC_QT_BUILD)
++ _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" \"\" )
++ else()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ endif()
++!!ENDIF // CMAKE_WINDOWS_BUILD
++
+
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ if(USE_STATIC_QT_BUILD)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+- if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++ if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC}\" )
+ !!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+- if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++ if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+- _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
++ _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC}\" \"\" )
++ endif()
++ else()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+ if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+ \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ELSE
+ \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ENDIF
+- AND EXISTS
++ AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ELSE
+ \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ endif()
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ endif()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+ !!ENDIF // CMAKE_DEBUG_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+-
+ !!ENDIF // CMAKE_RELEASE_TYPE
+
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+- _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ if(USE_STATIC_QT_BUILD)
++ _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
++ else()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ endif()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
++
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ if(USE_STATIC_QT_BUILD)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+- if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++ if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" )
+ !!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+- if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++ if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" )
+ !!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
++ _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC}\" \"\" )
++ else()
++!!ENDIF // CMAKE_WINDOWS_BUILD
+ if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+- \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
++ \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE_STATIC}\"
+ !!ELSE
+ \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ENDIF
+@@ -311,8 +421,12 @@
+ \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+ _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ endif()
++!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
++ endif()
++!!ENDIF // CMAKE_WINDOWS_BUILD
++
++
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+
+@@ -323,28 +437,6 @@
+ )
+ !!ENDIF // TEMPLATE != aux
+
+- file(GLOB pluginTargets \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*Plugin.cmake\")
+-
+- macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+- set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+-
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+- set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+- _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+- set_target_properties(Qt5::${Plugin} PROPERTIES
+- \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+- )
+- endmacro()
+-
+- if (pluginTargets)
+- foreach(pluginTarget ${pluginTargets})
+- include(${pluginTarget})
+- endforeach()
+- endif()
+-
+
+ !!IF !isEmpty(CMAKE_MODULE_EXTRAS)
+ include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
+--- mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in.orig 2016-06-10 08:48:56.000000000 +0200
++++ mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in 2016-08-18 23:22:41.994211700 +0200
+@@ -2,10 +2,18 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE_STATIC}\")
++!!ELSE
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
++!!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG_STATIC}\")
++!!ELSE
+ _populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
++!!ENDIF
+
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
+--- mkspecs/features/create_cmake.prf.orig 2016-08-14 20:44:32.513342200 +0200
++++ mkspecs/features/create_cmake.prf 2016-08-18 22:47:39.606635000 +0200
+@@ -135,17 +135,19 @@
+ CMAKE_PLUGIN_NAME = $$PLUGIN_CLASS_NAME
+
+ win32 {
+- isEmpty(CMAKE_STATIC_TYPE) {
++ mingw {
+ CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
+ CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
+- } else:mingw {
+- CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
+- CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
++ CMAKE_PLUGIN_LOCATION_RELEASE_STATIC = $$PLUGIN_TYPE/lib$${TARGET}.a
++ CMAKE_PLUGIN_LOCATION_DEBUG_STATIC = $$PLUGIN_TYPE/lib$${TARGET}d.a
+ } else { # MSVC static
+ CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
+ CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
++ CMAKE_PLUGIN_LOCATION_RELEASE_STATIC = $$PLUGIN_TYPE/$${TARGET}.lib
++ CMAKE_PLUGIN_LOCATION_DEBUG_STATIC = $$PLUGIN_TYPE/$${TARGET}d.lib
+ }
+ } else {
++ # this branch is broken by the patch, only apply when building for Windows
+ mac {
+ isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
+ else: CMAKE_PlUGIN_EXT = .a
+@@ -161,7 +163,8 @@
+ }
+ }
+ cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
+- cmake_target_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
++ isEmpty(CMAKE_STATIC_TYPE): cmake_target_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
++ else: cmake_target_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/StaticQt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
+
+ !build_pass:QMAKE_SUBSTITUTES += \
+ cmake_target_file
+@@ -180,6 +183,8 @@
+ lib_deps =
+ aux_mod_deps =
+ aux_lib_deps =
++aux_compile_defs_static = QT_STATIC QT_DESIGNER_STATIC
++contains(QT_CONFIG, angle): aux_compile_defs += QT_OPENGL_ES_2_ANGLE_STATIC
+ # Until CMake 3.0 is the minimum requirement of Qt 5, we need to filter
+ # out header-only modules from dependencies. CMake 3.0 provides INTERFACE
+ # libraries which are equivalent to header-only modules.
+@@ -197,10 +202,13 @@
+ CMAKE_QT5_MODULE_DEPS = $$join(lib_deps, ";")
+ CMAKE_INTERFACE_MODULE_DEPS = $$join(aux_mod_deps, ";")
+ CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";")
++CMAKE_INTERFACE_COMPILE_DEFINITIONS_STATIC = $$join(aux_compile_defs_static, ";")
++
+
+ CMAKE_QT_STEM = Qt$$QT_MAJOR_VERSION$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
+
+ mac {
++ # this branch is broken by the patch, only apply when building for Windows
+ !isEmpty(CMAKE_STATIC_TYPE) {
+ CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a
+ CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
+@@ -228,35 +236,33 @@
+ CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqt5main$${QT_LIBINFIX}.a
+ CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqt5main$${QT_LIBINFIX}.a
+
+- !isEmpty(CMAKE_STATIC_TYPE) {
+- CMAKE_STATIC_WINDOWS_BUILD = "true"
+- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
+- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
++ isEmpty(QMAKE_EXTENSION_IMPORTLIB): QMAKE_EXTENSION_IMPORTLIB = dll.a
++ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.$${QMAKE_EXTENSION_IMPORTLIB}
++ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$${QMAKE_EXTENSION_IMPORTLIB}
++ CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
++ CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
++
++ CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC = lib$${CMAKE_QT_STEM}d.a
++ CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC = lib$${CMAKE_QT_STEM}.a
++ CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}d-static.prl
++ CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}-static.prl
+
+- CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.prl
+- CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
+- } else {
+- isEmpty(QMAKE_EXTENSION_IMPORTLIB): QMAKE_EXTENSION_IMPORTLIB = a
+- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.$${QMAKE_EXTENSION_IMPORTLIB}
+- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$${QMAKE_EXTENSION_IMPORTLIB}
+- }
+ } else {
+ CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
+ CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
+
+- !isEmpty(CMAKE_STATIC_TYPE) {
+- CMAKE_STATIC_WINDOWS_BUILD = "true"
+- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
+- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
+-
+- CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
+- CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
+- } else {
+- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
+- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
+- }
++ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
++ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
++ CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
++ CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
++
++ CMAKE_IMPLIB_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}d.lib
++ CMAKE_IMPLIB_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}.lib
++ CMAKE_PRL_FILE_LOCATION_DEBUG_STATIC = $${CMAKE_QT_STEM}d-static.prl
++ CMAKE_PRL_FILE_LOCATION_RELEASE_STATIC = $${CMAKE_QT_STEM}-static.prl
+ }
+ } else {
++ # this branch is broken by the patch, only apply when building for Windows
+ !isEmpty(CMAKE_STATIC_TYPE) {
+ CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.a
+ CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
+--- qmake/generators/makefile.cpp 2015-08-26 14:29:10.131124600 +0100
++++ qmake/generators/makefile.cpp 2015-08-26 15:06:33.375635900 +0100
+@@ -1006,6 +1006,13 @@
+ for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
+ t << qv(project->values((*it).toKey()));
+ t << endl;
++ t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
++ QString sep;
++ for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) {
++ t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
++ sep = ';';
++ }
++ t << endl;
+ }
+ }
diff --git a/qt5-customize-extensions-for-static-build.patch b/qt5-customize-extensions-for-static-build.patch
new file mode 100644
index 000000000000..d9398200ddcb
--- /dev/null
+++ b/qt5-customize-extensions-for-static-build.patch
@@ -0,0 +1,15 @@
+--- mkspecs/features/spec_pre.prf.orig 2016-06-10 08:48:56.000000000 +0200
++++ mkspecs/features/spec_pre.prf 2016-08-09 16:42:35.000000000 +0200
+@@ -14,9 +14,9 @@
+ QMAKE_EXT_H_MOC = .cpp
+ QMAKE_EXT_JS = .js
+ QMAKE_EXT_LEX = .l
+-QMAKE_EXT_LIBTOOL = .la
+-QMAKE_EXT_PKGCONFIG = .pc
+-QMAKE_EXT_PRL = .prl
++QMAKE_EXT_LIBTOOL = -static.la
++QMAKE_EXT_PKGCONFIG = -static.pc
++QMAKE_EXT_PRL = -static.prl
+ QMAKE_EXT_UI = .ui
+ QMAKE_EXT_YACC = .y
+
diff --git a/qt5-disable-default-lib-include-detection.patch b/qt5-disable-default-lib-include-detection.patch
new file mode 100644
index 000000000000..64475b7e7a0a
--- /dev/null
+++ b/qt5-disable-default-lib-include-detection.patch
@@ -0,0 +1,11 @@
+--- a/mkspecs/features/default_pre.prf 2016-06-25 18:44:50.952774100 +0200
++++ b/mkspecs/features/default_pre.prf 2016-06-25 18:42:00.416181500 +0200
+@@ -29,7 +29,7 @@
+ #
+ # Get default include and library paths from compiler
+ #
+- gcc {
++ !win32:gcc {
+ equals(QMAKE_DIR_SEP, /) {
+ cmd_prefix = "LC_ALL=C"
+ cmd_suffix = "</dev/null >/dev/null"
diff --git a/qt5-fix-linking-against-static-dbus.patch b/qt5-fix-linking-against-static-dbus.patch
new file mode 100644
index 000000000000..b17ac71cff45
--- /dev/null
+++ b/qt5-fix-linking-against-static-dbus.patch
@@ -0,0 +1,26 @@
+--- config.tests/unix/dbus/dbus.cpp.orig 2015-03-08 17:05:21.216593135 +0100
++++ config.tests/unix/dbus/dbus.cpp 2015-03-08 17:06:35.276826201 +0100
+@@ -31,6 +31,10 @@
+ **
+ ****************************************************************************/
+
++#ifdef QT_STATIC
++# define DBUS_STATIC_BUILD
++#endif
++
+ #define DBUS_API_SUBJECT_TO_CHANGE
+ #include <dbus/dbus.h>
+
+ --- src/dbus/qdbus_symbols_p.h.orig 2016-06-10 08:48:56.000000000 +0200
+ +++ src/dbus/qdbus_symbols_p.h 2016-08-14 00:23:15.325768622 +0200
+ @@ -57,6 +57,10 @@
+
+ #ifndef QT_NO_DBUS
+
+ +#ifdef QT_STATIC
+ +# define DBUS_STATIC_BUILD
+ +#endif
+ +
+ #ifdef QT_LINKED_LIBDBUS
+ # include <dbus/dbus.h>
+ #else
diff --git a/qt5-fix-linking-against-static-pcre.patch b/qt5-fix-linking-against-static-pcre.patch
new file mode 100644
index 000000000000..3dd77468ed37
--- /dev/null
+++ b/qt5-fix-linking-against-static-pcre.patch
@@ -0,0 +1,13 @@
+--- qtbase-opensource-src-5.1.0/src/corelib/tools/qregularexpression.cpp.orig 2013-07-11 08:23:02.687691337 +0200
++++ qtbase-opensource-src-5.1.0/src/corelib/tools/qregularexpression.cpp 2013-07-11 08:23:27.231900674 +0200
+@@ -47,6 +47,10 @@
+ #include <QtCore/qatomic.h>
+ #include <QtCore/qdatastream.h>
+
++#ifdef QT_STATIC
++#define PCRE_STATIC
++#endif
++
+ #include <pcre.h>
+
+ QT_BEGIN_NAMESPACE
diff --git a/qt5-fix-opengl-to-many-sections.patch b/qt5-fix-opengl-to-many-sections.patch
new file mode 100644
index 000000000000..f83fc54368c5
--- /dev/null
+++ b/qt5-fix-opengl-to-many-sections.patch
@@ -0,0 +1,10 @@
+--- src/gui/opengl/opengl.pri.orig 2014-12-05 09:24:35.000000000 -0700
++++ src/gui/opengl/opengl.pri 2015-02-09 10:48:48.484071754 -0700
+@@ -4,6 +4,7 @@
+ contains(QT_CONFIG, opengles2):CONFIG += opengles2
+
+ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
++ QMAKE_CXXFLAGS+="-Wa,-mbig-obj"
+
+ HEADERS += opengl/qopengl.h \
+ opengl/qopengl_p.h \
diff --git a/qt5-fix-static-psql-mysql.patch b/qt5-fix-static-psql-mysql.patch
new file mode 100644
index 000000000000..3c308c57805a
--- /dev/null
+++ b/qt5-fix-static-psql-mysql.patch
@@ -0,0 +1,15 @@
+--- config.tests/unix/psql/psql.pro.orig 2015-02-16 21:56:55.000000000 -0700
++++ config.tests/unix/psql/psql.pro 2015-03-09 21:45:44.746755052 -0600
+@@ -1,3 +1,3 @@
+ SOURCES = psql.cpp
+ CONFIG -= qt dylib
+-LIBS *= -lpq
++LIBS *= -lpq -lintl -liconv -lssl -lcrypto -lwldap32 -lshfolder -lwsock32 -lws2_32 -lsecur32 -lgdi32
+
+--- config.tests/unix/mysql/mysql.pro.orig 2015-02-16 21:56:55.000000000 -0700
++++ config.tests/unix/mysql/mysql.pro 2015-03-09 21:38:59.930405876 -0600
+@@ -1,3 +1,3 @@
+ SOURCES = mysql.cpp
+ CONFIG -= qt dylib
+-LIBS += -lmysqlclient
++LIBS += -lmariadbclient -lws2_32 -lpthread -lz -lm -lssl -lcrypto
diff --git a/qt5-fixes-from-mxe.patch b/qt5-fixes-from-mxe.patch
new file mode 100644
index 000000000000..c40231a639d1
--- /dev/null
+++ b/qt5-fixes-from-mxe.patch
@@ -0,0 +1,91 @@
+This file is part of MXE.
+See index.html for further information.
+
+Contains ad hoc patches for cross building.
+
+From 54b168c305f54e60de0e32501b166faa7f5913e0 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Thu, 6 Aug 2015 23:35:08 +0200
+Subject: [PATCH 1/8] fix qwindows plugin linking with system-freetype (MXE
+ specific)
+
+Change-Id: I8783e3ab2d19011b083dd3c471107298a17293c4
+
+diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri
+index 39280de..e152b0d 100644
+--- a/src/3rdparty/freetype_dependency.pri
++++ b/src/3rdparty/freetype_dependency.pri
+@@ -4,4 +4,5 @@ contains(QT_CONFIG, freetype) {
+ } else:contains(QT_CONFIG, system-freetype) {
+ # pull in the proper freetype2 include directory
+ include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
++ win32:shared:LIBS_PRIVATE += -lfreetype
+ }
+--
+2.5.0
+
+
+From fa5ca49b4ffc1911a597b294ef2d4b5ecb983cad Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Mon, 8 Dec 2014 14:15:12 +0100
+Subject: [PATCH 3/8] fix oci config test on windows
+
+Change-Id: If1ce2241682259ca495b0ba68bf18410f8548922
+
+diff --git a/config.tests/unix/oci/oci.pro b/config.tests/unix/oci/oci.pro
+index 3ffda1d..39b6f3759 100644
+--- a/config.tests/unix/oci/oci.pro
++++ b/config.tests/unix/oci/oci.pro
+@@ -1,3 +1,3 @@
+ SOURCES = oci.cpp
+ CONFIG -= qt dylib
+-LIBS += -lclntsh
++!win32:LIBS += -lclntsh
+--
+2.5.0
+
+
+From 7fd641a032c7b4ce1b14d7ca02da646b0a0c34d5 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Thu, 6 Aug 2015 13:24:56 +0200
+Subject: [PATCH 4/8] configure: don't set QT_NO_SYSTEMSEMAPHORE for Windows
+
+Change-Id: I53c110ef40e3d14cc49fa23aa5d294611cac2ffa
+
+diff --git a/configure b/configure
+index 7651e29..4a4b478 100755
+--- a/configure
++++ b/configure
+@@ -4575,7 +4575,7 @@ fi
+ [ "$XPLATFORM_ANDROID" = "yes" ] && QMakeVar add styles "android"
+
+ # check IPC support
+-if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
++if [ "$XPLATFORM_MINGW" = "no" ] && ! compileTest unix/ipc_sysv "ipc_sysv" ; then
+ # SYSV IPC is not supported - check POSIX IPC
+ if compileTest unix/ipc_posix "ipc_posix" ; then
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC"
+--
+2.5.0
+
+
+From 959d3a71bced8c00967a16f23c6f9305e56fafcd Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Tue, 6 Oct 2015 09:53:20 +0200
+Subject: [PATCH 5/8] fix building mysql driver under mingw
+
+Change-Id: I9c4e821d5b3a6919566c6b684cb4916827feb6a9
+
+diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri
+index 3cfb614..8b7063f 100644
+--- a/src/sql/drivers/mysql/qsql_mysql.pri
++++ b/src/sql/drivers/mysql/qsql_mysql.pri
+@@ -4,7 +4,7 @@ SOURCES += $$PWD/qsql_mysql.cpp
+ QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
+ LIBS += $$QT_LFLAGS_MYSQL
+
+-unix {
++if (unix|mingw) {
+ isEmpty(QT_LFLAGS_MYSQL) {
+ !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
+ use_libmysqlclient_r:LIBS += -lmysqlclient_r
diff --git a/qt5-merge-static-and-shared-library-trees.patch b/qt5-merge-static-and-shared-library-trees.patch
new file mode 100644
index 000000000000..9e6271a6ea63
--- /dev/null
+++ b/qt5-merge-static-and-shared-library-trees.patch
@@ -0,0 +1,50 @@
+--- mkspecs/features/qt.prf.orig 2016-03-27 17:38:28.396736835 +0200
++++ mkspecs/features/qt.prf 2016-03-27 18:09:17.061088857 +0200
+@@ -141,6 +141,18 @@
+ }
+ }
+ }
++
++ win32:CONFIG(static) {
++ isEqual(MODULE_NAME, QtCore) {
++ LIBS$$var_sfx += $$QMAKE_LIBS_CORE
++ } else:isEqual(MODULE_NAME, QtGui) {
++ LIBS$$var_sfx += $$QMAKE_LIBS_GUI
++ } else:isEqual(MODULE_NAME, QtNetwork) {
++ LIBS$$var_sfx += $$QMAKE_LIBS_NETWORK
++ } else:isEqual(MODULE_NAME, QtOpenGL) {
++ LIBS$$var_sfx += $$QMAKE_LIBS_OPENGL
++ }
++ }
+ }
+ !isEmpty(BAD_QT):error("Unknown module(s) in QT$$var_sfx: $$replace(BAD_QT, _private$, -private)")
+
+--- mkspecs/features/default_post.prf.orig 2012-09-05 23:28:56.827501401 +0200
++++ mkspecs/features/default_post.prf 2012-09-05 23:29:31.617923080 +0200
+@@ -47,3 +50,11 @@
+
+ QMAKE_INCDIR += $$QMAKE_INCDIR_POST
+ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
++
++win32:contains(CONFIG, static) {
++ DEFINES += QT_STATIC QT_DESIGNER_STATIC
++ DEFINES -= QT_SHARED
++ contains(QT_CONFIG, angle): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC
++ QMAKE_LFLAGS += -static -static-libstdc++ -static-libgcc
++ QMAKE_EXT_PRL=-static.prl # prevents qmake from finding the prl file for shared libs
++}
+--- configure.orig 2012-12-10 23:51:02.920255366 +0100
++++ configure 2012-12-10 23:55:58.101753703 +0100
+@@ -6193,6 +6193,12 @@
+ }
+ QT_CONFIG += $QT_CONFIG
+
++contains(CONFIG, static) {
++ CONFIG -= shared
++ QT_CONFIG += static jpeg gif
++ QT_CONFIG -= shared
++}
++
+ #versioning
+ QT_VERSION = $QT_VERSION
+ QT_MAJOR_VERSION = $QT_MAJOR_VERSION
diff --git a/qt5-pkgconfig-static-library-name-workaround.patch b/qt5-pkgconfig-static-library-name-workaround.patch
new file mode 100644
index 000000000000..7065940164b6
--- /dev/null
+++ b/qt5-pkgconfig-static-library-name-workaround.patch
@@ -0,0 +1,19 @@
+--- qtbase-opensource-src-5.6.0/mkspecs/features/qt_module.prf.orig 2016-04-09 13:13:38.374286031 +0200
++++ qtbase-opensource-src-5.6.0/mkspecs/features/qt_module.prf 2016-04-09 13:24:04.292077922 +0200
+@@ -265,6 +265,16 @@
+ pclib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
+ pclib_replace.CONFIG = path
+ QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace
++
++ pclib_replace2.CONFIG = path
++ pclib_replace2.match = " /lib"
++ pclib_replace2.replace = "-l"
++ QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace2
++
++ pclib_replace3.CONFIG = path
++ pclib_replace3.match = "\.dll\.a"
++ pclib_replace3.replace = ""
++ QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace3
+ }
+ !lib_bundle:unix {
+ CONFIG += create_libtool
diff --git a/qt5-use-correct-pkg-config-static-flags.patch b/qt5-use-correct-pkg-config-static-flags.patch
new file mode 100644
index 000000000000..67b6a8e8dc3e
--- /dev/null
+++ b/qt5-use-correct-pkg-config-static-flags.patch
@@ -0,0 +1,14 @@
+--- qtbase-opensource-src-5.4.1/configure.orig 2015-02-17 05:56:22.000000000 +0100
++++ qtbase-opensource-src-5.4.1/configure 2015-03-21 17:08:54.138635641 +0100
+@@ -3884,6 +3884,11 @@
+ # See if PKG_CONFIG is set in the mkspec:
+ PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`"
+ [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG"
++
++ if [ "$CFG_SHARED" = "no" ] ; then
++ PKG_CONFIG="$PKG_CONFIG --static"
++ [ "$OPT_VERBOSE" = "yes" ] && echo "Using '$PKG_CONFIG' because we're doing a static build"
++ fi
+ fi
+ if [ -z "$PKG_CONFIG" ]; then
+ PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
diff --git a/qt5-use-external-angle-library.patch b/qt5-use-external-angle-library.patch
new file mode 100644
index 000000000000..bbdda14974bc
--- /dev/null
+++ b/qt5-use-external-angle-library.patch
@@ -0,0 +1,79 @@
+diff -U 3 -r a/src/gui/gui.pro b/src/gui/gui.pro
+--- a/src/gui/gui.pro 2015-06-29 14:04:55.000000000 -0600
++++ b/src/gui/gui.pro 2015-07-18 10:50:02.228227482 -0600
+@@ -17,10 +17,5 @@
+ imageformats \
+ egldeviceintegrations
+
+-# This is here only because the platform plugin is no module, obviously.
+-win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
+- MODULE_AUX_INCLUDES = \
+- \$\$QT_MODULE_INCLUDE_BASE/QtANGLE
+-}
+
+ # Code coverage with TestCocoon
+@@ -35,6 +29,10 @@
+
+ mac:!ios: LIBS_PRIVATE += -framework Cocoa
+
++win32:contains(QT_CONFIG, angle) {
++ LIBS_PRIVATE += -lGLESv2
++}
++
+ CONFIG += simd optimize_full
+
+ include(accessible/accessible.pri)
+diff -U 3 -r a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in 2015-06-29 14:04:51.000000000 -0600
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in 2015-07-18 10:51:09.666053970 -0600
+@@ -2,9 +2,9 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\")
+ !!ELSE
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\")
+ !!ENDIF
+
+ _qt5_Gui_check_file_exists(${Qt5Gui_EGL_INCLUDE_DIRS})
+diff -U 3 -r a/src/opengl/opengl.pro b/src/opengl/opengl.pro
+--- a/src/opengl/opengl.pro 2015-06-29 14:04:05.000000000 -0600
++++ b/src/opengl/opengl.pro 2015-07-18 10:46:46.588388411 -0600
+@@ -12,6 +12,9 @@
+
+ contains(QT_CONFIG, opengl):CONFIG += opengl
+ contains(QT_CONFIG, opengles2):CONFIG += opengles2
++win32:contains(QT_CONFIG, angle) {
++ LIBS_PRIVATE += -lGLESv2
++}
+
+ HEADERS += qgl.h \
+ qgl_p.h \
+
+diff -U 3 -r a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
+--- a/src/plugins/platforms/windows/windows.pri 2015-06-29 14:04:40.000000000 -0600
++++ b/src/plugins/platforms/windows/windows.pri 2015-07-18 10:53:45.585348009 -0600
+@@ -3,6 +3,7 @@
+ !wince*:LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32
+
+ contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32
++contains(QT_CONFIG, angle):LIBS += -lGLESv2 -lEGL
+
+ mingw: LIBS *= -luuid
+ # For the dialog helpers:
+diff -U 3 -r a/src/src.pro b/src/src.pro
+--- a/src/src.pro 2015-06-29 14:05:06.000000000 -0600
++++ b/src/src.pro 2015-07-18 10:43:01.698195194 -0600
+@@ -155,10 +155,6 @@
+ SUBDIRS += src_3rdparty_harfbuzzng
+ src_gui.depends += src_3rdparty_harfbuzzng
+ }
+- win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
+- SUBDIRS += src_angle
+- src_gui.depends += src_angle
+- }
+ contains(QT_CONFIG, freetype) {
+ SUBDIRS += src_3rdparty_freetype
+ src_platformsupport.depends += src_3rdparty_freetype
diff --git a/qt5-use-pkgconfig-for-harfbuzz.patch b/qt5-use-pkgconfig-for-harfbuzz.patch
new file mode 100644
index 000000000000..82c684e106d1
--- /dev/null
+++ b/qt5-use-pkgconfig-for-harfbuzz.patch
@@ -0,0 +1,31 @@
+--- src/3rdparty/harfbuzz_dependency.pri.orig 2016-08-12 22:07:40.467953900 +0200
++++ src/3rdparty/harfbuzz_dependency.pri 2016-08-12 22:08:06.583981900 +0200
+@@ -2,5 +2,7 @@
+ INCLUDEPATH += $$PWD/harfbuzz-ng/include
+ LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix()
+ } else:contains(QT_CONFIG, system-harfbuzz) {
+- LIBS_PRIVATE += -lharfbuzz
++ # can't use 'feature' link_pkgconfig here because it would add harfbuzz to LIBS rather than LIBS_PRIVATE
++ contains(QT_CONFIG, static): LIBS_PRIVATE += $$system($$PKG_CONFIG --static --libs harfbuzz)
++ else: LIBS_PRIVATE += $$system($$PKG_CONFIG --libs harfbuzz)
+ }
+
+--- config.tests/unix/harfbuzz/harfbuzz.pro.orig
++++ config.tests/unix/harfbuzz/harfbuzz.pro
+@@ -1,3 +1,4 @@
+ SOURCES = harfbuzz.cpp
+ CONFIG -= qt dylib
+-LIBS += -lharfbuzz
++contains(CONFIG, static): LIBS += $$system($$PKG_CONFIG --static --libs harfbuzz)
++else: LIBS += $$system($$PKG_CONFIG --libs harfbuzz)
+
+--- mkspecs/win32-g++/qmake.conf.orig 2016-08-11 22:48:02.000000000 +0200
++++ mkspecs/win32-g++/qmake.conf 2016-08-13 02:15:32.791706438 +0200
+@@ -97,6 +97,6 @@
+ QMAKE_LIBS =
+ QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lpcre16
+-QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -ljpeg -lpng -lharfbuzz -lglib-2.0 -lintl -lwinmm
++QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -ljpeg -lpng $$system($${CROSS_COMPILE}pkg-config --static --libs harfbuzz)
+ QMAKE_LIBS_NETWORK = -lws2_32 -lcrypt32 -ldnsapi
+ QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32
+ QMAKE_LIBS_OPENGL_ES2 = -l$${LIBEGL_NAME} -l$${LIBGLESV2_NAME} -ld3d9 -ldxguid -lgdi32 -luser32
diff --git a/qt5-use-win32-g++-mkspecs-profile.patch b/qt5-use-win32-g++-mkspecs-profile.patch
index 29302dac8205..004eacdc2ef6 100644
--- a/qt5-use-win32-g++-mkspecs-profile.patch
+++ b/qt5-use-win32-g++-mkspecs-profile.patch
@@ -5,12 +5,12 @@
QMAKE_YACC = byacc
QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -pipe -fno-keep-inline-dllexport
-+QMAKE_CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 --param=ssp-buffer-size=4 -fno-keep-inline-dllexport
++QMAKE_CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-keep-inline-dllexport
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -Wall -Wextra
QMAKE_CFLAGS_WARN_OFF = -w
@@ -67,10 +67,10 @@
-
+
QMAKE_LINK = $${CROSS_COMPILE}g++
QMAKE_LINK_C = $${CROSS_COMPILE}gcc
-QMAKE_LFLAGS =
@@ -18,18 +18,18 @@
QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
QMAKE_LFLAGS_EXCEPTIONS_OFF =
-QMAKE_LFLAGS_RELEASE = -Wl,-s
-+QMAKE_LFLAGS_RELEASE =
++QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console
QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows
@@ -95,21 +95,26 @@
QMAKE_LIB_EXTENSIONS = a dll.a
-
+
QMAKE_LIBS =
-QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
-QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32
-QMAKE_LIBS_NETWORK = -lws2_32
-+QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lpcre16
++QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lpcre16
+QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -ljpeg -lpng -lharfbuzz -lglib-2.0 -lintl -lwinmm
+QMAKE_LIBS_NETWORK = -lws2_32 -lcrypt32 -ldnsapi
QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32
@@ -40,14 +40,14 @@
QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
-QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
+QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqt5main
-
+
-QMAKE_IDL = midl
+QMAKE_IDL = $${CROSS_COMPILE}widl
QMAKE_LIB = $${CROSS_COMPILE}ar -rc
QMAKE_RC = $${CROSS_COMPILE}windres
+QMAKE_DLLTOOL = $${CROSS_COMPILE}dlltool
+QMAKE_LRELEASE = $${CROSS_COMPILE}lrelease-qt5
-
+
QMAKE_STRIP = $${CROSS_COMPILE}strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
diff --git a/qt5-win32-static-cmake-link-ws2_32-and--static.patch b/qt5-win32-static-cmake-link-ws2_32-and--static.patch
new file mode 100644
index 000000000000..be20044903f1
--- /dev/null
+++ b/qt5-win32-static-cmake-link-ws2_32-and--static.patch
@@ -0,0 +1,15 @@
+--- src/corelib/Qt5CoreConfigExtras.cmake.in.orig 2014-11-09 00:54:20.852201500 +0000
++++ src/corelib/Qt5CoreConfigExtras.cmake.in 2014-11-09 00:55:52.437439900 +0000
+@@ -165,3 +165,12 @@
+ set(_Qt5CTestMacros \"${_Qt5CoreConfigDir}/Qt5CTestMacros.cmake\")
+
+ _qt5_Core_check_file_exists(${_Qt5CTestMacros})
++
++get_target_property(_libType Qt5::Core TYPE)
++if(_libType STREQUAL \"STATIC_LIBRARY\" AND WIN32)
++ set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
++ # INTERFACE_LINK_LIBRARIES is used to pass a linker flag (-static)
++ # and a library (ws2_32)
++ set_target_properties(Qt5::Core PROPERTIES \"INTERFACE_LINK_LIBRARIES\" \"$<${_isExe}:-static;ws2_32>\")
++ unset(_isExe)
++endif()