[mingw-qt] Make linking against the static version of Qt work without any manual fiddling
Erik van Pienbroek
epienbro at fedoraproject.org
Thu Apr 19 15:04:52 UTC 2012
commit 2d77c68942fbb9755cde313e713453e119dfe9f7
Author: Erik van Pienbroek <epienbro at fedoraproject.org>
Date: Thu Apr 19 17:04:31 2012 +0200
Make linking against the static version of Qt work without any manual fiddling
mingw-qt.spec | 10 +++++-
qmake.conf.win32 | 4 +-
qmake.conf.win64 | 4 +-
qt-make-linking-against-static-qt-work.patch | 42 ++++++++++++++++++++++++
qt-merge-static-and-shared-library-trees.patch | 26 ---------------
5 files changed, 55 insertions(+), 31 deletions(-)
---
diff --git a/mingw-qt.spec b/mingw-qt.spec
index 577b76c..3db7408 100644
--- a/mingw-qt.spec
+++ b/mingw-qt.spec
@@ -14,7 +14,7 @@
Name: mingw-qt
Version: 4.8.1
-Release: 1%{?pre}%{?dist}
+Release: 2%{?pre}%{?dist}
Summary: Qt for Windows
License: GPLv3 with exceptions or LGPLv2 with exceptions
@@ -66,6 +66,10 @@ Patch22: qt-fix-javascript-jit-on-mingw-x86_64.patch
# Workaround this for now until a proper fix has been found
Patch23: qt-4.8.1-fix-activeqt-compilation.patch
+# Some additional changes are required to make linking against
+# the static version of Qt work without any manual fiddling
+Patch24: qt-make-linking-against-static-qt-work.patch
+
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw32-gcc-c++
@@ -196,6 +200,7 @@ Static version of the mingw64-qt library.
%patch21 -p1
%patch22 -p1
%patch23 -p1
+%patch24 -p0
# Patch 19 (openssl) needs an additional change
# qt loads openssl libraries (ssleay32, libeay32) at runtime, but they are called libssl-OPENSSL_SONAME
@@ -1045,6 +1050,9 @@ sed -i s@'$${QT_LIBINFIX}d'@'d$${QT_LIBINFIX}'@ $RPM_BUILD_ROOT%{mingw64_datadir
%changelog
+* Thu Apr 19 2012 Erik van Pienbroek <epienbro at fedoraproject.org> - 4.8.1-2
+- Make linking against the static version of Qt work without any manual fiddling
+
* Wed Mar 28 2012 Erik van Pienbroek <epienbro at fedoraproject.org> - 4.8.1-1
- Update to 4.8.1
- Removed a patch which fixed a compile failure in kdelibs as
diff --git a/qmake.conf.win32 b/qmake.conf.win32
index 22a1d07..e83ad79 100644
--- a/qmake.conf.win32
+++ b/qmake.conf.win32
@@ -70,8 +70,8 @@ QMAKE_EXTENSION_STATICLIB = a
QMAKE_LIBS =
-QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
-QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
+QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz
+QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -ljpeg -ltiff -lpng
QMAKE_LIBS_NETWORK = -lws2_32
QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 -lgdi32 -luser32
QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
diff --git a/qmake.conf.win64 b/qmake.conf.win64
index 7cc77eb..5d26304 100644
--- a/qmake.conf.win64
+++ b/qmake.conf.win64
@@ -70,8 +70,8 @@ QMAKE_EXTENSION_STATICLIB = a
QMAKE_LIBS =
-QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
-QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
+QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz
+QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -ljpeg -ltiff -lpng
QMAKE_LIBS_NETWORK = -lws2_32
QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 -lgdi32 -luser32
QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
diff --git a/qt-make-linking-against-static-qt-work.patch b/qt-make-linking-against-static-qt-work.patch
new file mode 100644
index 0000000..1c6e191
--- /dev/null
+++ b/qt-make-linking-against-static-qt-work.patch
@@ -0,0 +1,42 @@
+--- mkspecs/features/qt_functions.prf.orig 2011-12-26 21:24:32.448207664 +0100
++++ mkspecs/features/qt_functions.prf 2012-04-19 16:21:25.437111396 +0200
+@@ -71,7 +71,7 @@
+ export(TARGET.CAPABILITY)
+ }
+ isEmpty(LINKAGE) {
+- if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
++ if(!debug_and_release|build_pass):!static:CONFIG(debug, debug|release) {
+ win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d
+ mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
+ }
+@@ -83,6 +83,17 @@
+ QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
+ }
+ LIBS += $$LINKAGE
++ win32:CONFIG(static) {
++ isEqual(LIB_NAME, QtCore) {
++ LIBS += $$QMAKE_LIBS_CORE
++ } else:isEqual(LIB_NAME, QtGui) {
++ LIBS += $$QMAKE_LIBS_GUI
++ } else:isEqual(LIB_NAME, QtNetwork) {
++ LIBS += $$QMAKE_LIBS_NETWORK
++ } else:isEqual(LIB_NAME, QtOpenGL) {
++ LIBS += $$QMAKE_LIBS_OPENGL
++ }
++ }
+ export(LIBS)
+ export(INCLUDEPATH)
+ export(QMAKE_FRAMEWORKPATH)
+--- mkspecs/features/win32/default_post.prf.orig 2011-12-26 02:29:56.365208473 +0100
++++ mkspecs/features/win32/default_post.prf 2011-12-26 02:31:03.650208601 +0100
+@@ -6,6 +6,10 @@
+ }
+ }
+
++contains(CONFIG, static) {
++ QMAKE_LFLAGS += -static
++}
++
+ # Now load the global default_post
+ load(default_post)
+
diff --git a/qt-merge-static-and-shared-library-trees.patch b/qt-merge-static-and-shared-library-trees.patch
index b63b3bb..02cc3d3 100644
--- a/qt-merge-static-and-shared-library-trees.patch
+++ b/qt-merge-static-and-shared-library-trees.patch
@@ -109,19 +109,6 @@
#versioning
QT_VERSION = 4.8.1
---- usr/i686-w64-mingw32/sys-root/mingw/share/qt4/mkspecs/features/win32/default_post.prf.orig 2011-12-26 02:29:56.365208473 +0100
-+++ usr/i686-w64-mingw32/sys-root/mingw/share/qt4/mkspecs/features/win32/default_post.prf 2011-12-26 02:31:03.650208601 +0100
-@@ -6,6 +6,10 @@
- }
- }
-
-+contains(CONFIG, static) {
-+ QMAKE_LFLAGS += -static
-+}
-+
- # Now load the global default_post
- load(default_post)
-
--- usr/x86_64-w64-mingw32/sys-root/mingw/include/QtCore/qconfig.h.orig 2011-12-25 21:03:37.022018831 +0100
+++ usr/x86_64-w64-mingw32/sys-root/mingw/include/QtCore/qconfig.h 2011-12-25 21:13:50.704976445 +0100
@@ -26,6 +26,14 @@
@@ -233,16 +220,3 @@
#versioning
QT_VERSION = 4.8.1
---- usr/x86_64-w64-mingw32/sys-root/mingw/share/qt4/mkspecs/features/win32/default_post.prf.orig 2011-12-26 02:29:56.365208473 +0100
-+++ usr/x86_64-w64-mingw32/sys-root/mingw/share/qt4/mkspecs/features/win32/default_post.prf 2011-12-26 02:31:03.650208601 +0100
-@@ -6,6 +6,10 @@
- }
- }
-
-+contains(CONFIG, static) {
-+ QMAKE_LFLAGS += -static
-+}
-+
- # Now load the global default_post
- load(default_post)
-
More information about the scm-commits
mailing list