rules.mak 4.15 KB
Newer Older
1
# Qt
Rafaël Carré's avatar
Rafaël Carré committed
2

3 4 5 6
QT_VERSION_MAJOR := 5.11
QT_VERSION := $(QT_VERSION_MAJOR).0
# Insert potential -betaX suffix here:
QT_VERSION_FULL := $(QT_VERSION)
7
QT_URL := https://download.qt.io/official_releases/qt/$(QT_VERSION_MAJOR)/$(QT_VERSION_FULL)/submodules/qtbase-everywhere-src-$(QT_VERSION_FULL).tar.xz
Rafaël Carré's avatar
Rafaël Carré committed
8 9 10 11 12 13 14 15 16 17 18 19

ifdef HAVE_MACOSX
#PKGS += qt
endif
ifdef HAVE_WIN32
PKGS += qt
endif

ifeq ($(call need_pkg,"Qt5Core Qt5Gui Qt5Widgets"),)
PKGS_FOUND += qt
endif

20
$(TARBALLS)/qt-$(QT_VERSION_FULL).tar.xz:
Rafaël Carré's avatar
Rafaël Carré committed
21 22
	$(call download,$(QT_URL))

23
.sum-qt: qt-$(QT_VERSION_FULL).tar.xz
Rafaël Carré's avatar
Rafaël Carré committed
24

25
qt: qt-$(QT_VERSION_FULL).tar.xz .sum-qt
Rafaël Carré's avatar
Rafaël Carré committed
26
	$(UNPACK)
27
	mv qtbase-everywhere-src-$(QT_VERSION_FULL) qt-$(QT_VERSION_FULL)
28
ifdef HAVE_WIN32
29 30
	$(APPLY) $(SRC)/qt/0001-Windows-QPA-prefer-lower-value-when-rounding-fractio.patch
	$(APPLY) $(SRC)/qt/0002-Windows-QPA-Disable-systray-notification-sounds.patch
31 32
	$(APPLY) $(SRC)/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
	$(APPLY) $(SRC)/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
33 34 35
ifndef HAVE_WIN64
	$(APPLY) $(SRC)/qt/0001-disable-qt_random_cpu.patch
endif
36 37 38 39
ifndef HAVE_CROSS_COMPILE
	cd qt-$(QT_VERSION_FULL); for i in QtFontDatabaseSupport QtWindowsUIAutomationSupport QtEventDispatcherSupport QtCore; do \
		sed -i -e 's,"../../../../../src,"../src,g' include/$$i/$(QT_VERSION)/$$i/private/*.h; done
endif
40
endif
Rafaël Carré's avatar
Rafaël Carré committed
41 42
	$(MOVE)

43 44
QT_OPENGL := -opengl desktop

Rafaël Carré's avatar
Rafaël Carré committed
45
ifdef HAVE_MACOSX
46
QT_SPEC := darwin-g++
Rafaël Carré's avatar
Rafaël Carré committed
47 48
endif
ifdef HAVE_WIN32
49
ifdef HAVE_CLANG
50
QT_SPEC := win32-clang-g++
51 52
else
QT_SPEC := win32-g++
53
endif
54
ifdef HAVE_CROSS_COMPILE
55
QT_PLATFORM := -xplatform $(QT_SPEC) -device-option CROSS_COMPILE=$(HOST)-
56
else
57
ifneq ($(QT_SPEC),)
58 59
QT_PLATFORM := -platform $(QT_SPEC)
endif
60
endif
61 62 63 64
ifneq ($(findstring $(ARCH), arm aarch64),)
# There is no opengl available on windows on these architectures.
QT_OPENGL := -no-opengl
endif
Rafaël Carré's avatar
Rafaël Carré committed
65 66
endif

67
QT_CONFIG := -static -opensource -confirm-license -no-pkg-config \
68
	-no-sql-sqlite -no-gif -qt-libjpeg -no-openssl $(QT_OPENGL) -no-dbus \
69
	-no-vulkan -no-sql-odbc -no-pch \
70
	-no-compile-examples -nomake examples -qt-zlib
71

72 73
QT_CONFIG += -release

Rafaël Carré's avatar
Rafaël Carré committed
74
.qt: qt
75 76 77
	cd $< && ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX)
	# Make && Install libraries
	cd $< && $(MAKE)
78
	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 sub-network-install_subtargets sub-testlib-install_subtargets
79
	# Install tools
80
	cd $< && $(MAKE) -C src sub-moc-install_subtargets sub-rcc-install_subtargets sub-uic-install_subtargets
81
	# Install plugins
82
	cd $< && $(MAKE) -C src/plugins sub-platforms-install_subtargets
83
ifdef HAVE_WIN32
84 85
	cd $< && $(MAKE) -C src/plugins sub-imageformats-install_subtargets
	mv $(PREFIX)/plugins/imageformats/libqjpeg.a $(PREFIX)/lib/
86
	mv $(PREFIX)/plugins/platforms/libqwindows.a $(PREFIX)/lib/ && rm -rf $(PREFIX)/plugins
87 88 89
	# Vista styling
	cd $< && $(MAKE) -C src -C plugins sub-styles-install_subtargets
	mv $(PREFIX)/plugins/styles/libqwindowsvistastyle.a $(PREFIX)/lib/ && rm -rf $(PREFIX)/plugins
90
	# Move includes to match what VLC expects
91 92
	mkdir -p $(PREFIX)/include/QtGui/qpa
	cp $(PREFIX)/include/QtGui/$(QT_VERSION)/QtGui/qpa/qplatformnativeinterface.h $(PREFIX)/include/QtGui/qpa
93
	# Clean Qt mess
94
	rm -rf $(PREFIX)/lib/libQt5Bootstrap* $</lib/libQt5Bootstrap*
95
	# Fix .pc files to remove debug version (d)
96
	cd $(PREFIX)/lib/pkgconfig; for i in Qt5Core.pc Qt5Gui.pc Qt5Widgets.pc Qt5Test.pc Qt5Network.pc; do sed -i.orig -e 's/d\.a/.a/g' -e 's/d $$/ /' $$i; done
97
	# Fix Qt5Gui.pc file to include qwindows (QWindowsIntegrationPlugin) and platform support libraries
98
	cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Gui/ -lqwindows -lqjpeg -luxtheme -ldwmapi -lQt5ThemeSupport -lQt5FontDatabaseSupport -lQt5EventDispatcherSupport -lQt5WindowsUIAutomationSupport -lqtfreetype -lQt5Gui/g' Qt5Gui.pc
99 100
	# Fix Qt5Widget.pc file to include qwindowsvistastyle before Qt5Widget, as it depends on it
	cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Widget/ -lqwindowsvistastyle -lQt5Widget/' Qt5Widgets.pc
101
endif
102
	# Install a qmake with correct paths set
103
	cd $<; $(MAKE) sub-qmake-qmake-aux-pro-install_subtargets install_mkspecs
Rafaël Carré's avatar
Rafaël Carré committed
104
	touch $@