Qt: try to fix linking with Qt 5.11
[vlc.git] / contrib / src / qt / rules.mak
blob3b56febcb50cebef1c3e8ed04af24377ed4210b4
1 # Qt
3 QT_VERSION := 5.11.0
4 QT_URL := https://download.qt.io/official_releases/qt/5.11/$(QT_VERSION)/submodules/qtbase-everywhere-src-$(QT_VERSION).tar.xz
6 ifdef HAVE_MACOSX
7 #PKGS += qt
8 endif
9 ifdef HAVE_WIN32
10 PKGS += qt
11 endif
13 ifeq ($(call need_pkg,"Qt5Core Qt5Gui Qt5Widgets"),)
14 PKGS_FOUND += qt
15 endif
17 $(TARBALLS)/qt-$(QT_VERSION).tar.xz:
18 $(call download,$(QT_URL))
20 .sum-qt: qt-$(QT_VERSION).tar.xz
22 qt: qt-$(QT_VERSION).tar.xz .sum-qt
23 $(UNPACK)
24 mv qtbase-everywhere-src-$(QT_VERSION) qt-$(QT_VERSION)
25 $(APPLY) $(SRC)/qt/0001-Windows-QPA-prefer-lower-value-when-rounding-fractio.patch
26 $(APPLY) $(SRC)/qt/0002-Windows-QPA-Disable-systray-notification-sounds.patch
27 $(MOVE)
29 ifdef HAVE_MACOSX
30 QT_PLATFORM := -platform darwin-g++
31 endif
32 ifdef HAVE_WIN32
33 ifdef HAVE_CLANG
34 QT_SPEC := win32-clang-g++
35 else
36 QT_SPEC := win32-g++
37 endif
38 ifdef HAVE_CROSS_COMPILE
39 QT_PLATFORM := -xplatform $(QT_SPEC) -device-option CROSS_COMPILE=$(HOST)-
40 else
41 QT_PLATFORM := -platform $(QT_SPEC)
42 endif
43 endif
45 QT_CONFIG := -static -opensource -confirm-license -no-pkg-config \
46 -no-sql-sqlite -no-gif -qt-libjpeg -no-openssl -no-opengl -no-dbus \
47 -no-sql-odbc -no-pch \
48 -no-compile-examples -nomake examples -qt-zlib
50 QT_CONFIG += -release
52 .qt: qt
53 cd $< && ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX)
54 # Make && Install libraries
55 cd $< && $(MAKE)
56 cd $< && $(MAKE) -C src sub-corelib-install_subtargets sub-gui-install_subtargets sub-widgets-install_subtargets sub-platformsupport-install_subtargets sub-zlib-install_subtargets sub-bootstrap-install_subtargets
57 # Install tools
58 cd $< && $(MAKE) -C src sub-moc-install_subtargets sub-rcc-install_subtargets sub-uic-install_subtargets
59 # Install plugins
60 cd $< && $(MAKE) -C src/plugins sub-platforms-install_subtargets
61 mv $(PREFIX)/plugins/platforms/libqwindows.a $(PREFIX)/lib/ && rm -rf $(PREFIX)/plugins
62 # Move includes to match what VLC expects
63 mkdir -p $(PREFIX)/include/QtGui/qpa
64 cp $(PREFIX)/include/QtGui/$(QT_VERSION)/QtGui/qpa/qplatformnativeinterface.h $(PREFIX)/include/QtGui/qpa
65 # Clean Qt mess
66 rm -rf $(PREFIX)/lib/libQt5Bootstrap* $</lib/libQt5Bootstrap*
67 # Fix .pc files to remove debug version (d)
68 cd $(PREFIX)/lib/pkgconfig; for i in Qt5Core.pc Qt5Gui.pc Qt5Widgets.pc; do sed -i.orig -e 's/d\.a/.a/g' -e 's/d $$/ /' $$i; done
69 # Fix Qt5Gui.pc file to include qwindows (QWindowsIntegrationPlugin) and platform support libraries
70 cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Gui/ -lqwindows -ldwmapi -lQt5ThemeSupport -lQt5FontDatabaseSupport -lQt5EventDispatcherSupport -lQt5WindowsUIAutomationSupport -lqtfreetype -lQt5Gui/g' Qt5Gui.pc
71 ifdef HAVE_CROSS_COMPILE
72 # Building Qt build tools for Xcompilation
73 cd $</include/QtCore; ln -sf $(QT_VERSION)/QtCore/private
74 cd $<; $(MAKE) -C qmake
75 cd $<; $(MAKE) sub-qmake-qmake-aux-pro-install_subtargets install_mkspecs
76 cd $</src/tools; \
77 for i in bootstrap uic rcc moc; \
78 do (cd $$i; echo $$i && ../../../bin/qmake -spec $(QT_SPEC) QMAKE_RC=$(HOST)-windres && $(MAKE) clean && $(MAKE) CC=$(HOST)-gcc CXX=$(HOST)-g++ LINKER=$(HOST)-g++ LIB="$(HOST)-ar -rc" && $(MAKE) install); \
79 done
80 endif
81 touch $@