[vlc-devel] [PATCH 01/10] qt: add support for QtSVG

Pierre Lamot pierre at videolabs.io
Fri Sep 29 10:25:03 CEST 2017


---
 configure.ac                                       |  2 +-
 contrib/src/qt/rules.mak                           |  3 +-
 .../0001-Force-the-usage-of-QtZlib-header.patch    | 29 ++++++++++++++++++
 contrib/src/qtsvg/SHA512SUMS                       |  1 +
 contrib/src/qtsvg/rules.mak                        | 34 ++++++++++++++++++++++
 modules/gui/qt/qt.cpp                              |  2 ++
 6 files changed, 69 insertions(+), 2 deletions(-)
 create mode 100644 contrib/src/qtsvg/0001-Force-the-usage-of-QtZlib-header.patch
 create mode 100644 contrib/src/qtsvg/SHA512SUMS
 create mode 100644 contrib/src/qtsvg/rules.mak

diff --git a/configure.ac b/configure.ac
index 0230807515..c9902ca3d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3648,7 +3648,7 @@ AC_ARG_ENABLE(qt, [
 ])
 have_qt5_x11="no"
 AS_IF([test "${enable_qt}" != "no"], [
-  PKG_CHECK_MODULES([QT], [Qt5Core >= 5.2.0 Qt5Widgets Qt5Gui], [
+  PKG_CHECK_MODULES([QT], [Qt5Core >= 5.6.0 Qt5Widgets Qt5Gui Qt5Svg], [
       PKG_CHECK_MODULES([QT5_X11], [Qt5X11Extras], [
           have_qt5_x11="yes"
       ],[
diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak
index 3a3ff05c3b..d8b2196f57 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -60,7 +60,7 @@ endif
 	mkdir -p $(PREFIX)/include/QtGui/qpa
 	cp $(PREFIX)/include/QtGui/$(QT_VERSION)/QtGui/qpa/qplatformnativeinterface.h $(PREFIX)/include/QtGui/qpa
 	# Clean Qt mess
-	rm -rf $(PREFIX)/lib/libQt5Bootstrap* $(PREFIX)/lib/*.prl $(PREFIX)/mkspecs
+	rm -rf $(PREFIX)/lib/libQt5Bootstrap*
 	# Fix .pc files to remove debug version (d)
 	cd $(PREFIX)/lib/pkgconfig; for i in Qt5Core.pc Qt5Gui.pc Qt5Widgets.pc; do sed -i -e 's/d\.a/.a/g' -e 's/d $$/ /' $$i; done
 	# Fix Qt5Gui.pc file to include qwindows (QWindowsIntegrationPlugin) and Qt5Platform Support
@@ -69,6 +69,7 @@ ifdef HAVE_CROSS_COMPILE
 	# Building Qt build tools for Xcompilation
 	cd $</include/QtCore; ln -sf $(QT_VERSION)/QtCore/private
 	cd $</qmake; $(MAKE)
+	cd $<; $(MAKE) install_qmake install_mkspecs
 	cd $</src/tools; \
 	for i in bootstrap uic rcc moc; \
 		do (cd $$i; echo $$i && ../../../bin/qmake -spec $(QT_SPEC) && $(MAKE) clean && $(MAKE) CC=$(HOST)-gcc CXX=$(HOST)-g++ LINKER=$(HOST)-g++ && $(MAKE) install); \
diff --git a/contrib/src/qtsvg/0001-Force-the-usage-of-QtZlib-header.patch b/contrib/src/qtsvg/0001-Force-the-usage-of-QtZlib-header.patch
new file mode 100644
index 0000000000..701b36c264
--- /dev/null
+++ b/contrib/src/qtsvg/0001-Force-the-usage-of-QtZlib-header.patch
@@ -0,0 +1,29 @@
+From ed55cab9836d8ed9a4738c795855b0b2af6fa6b9 Mon Sep 17 00:00:00 2001
+From: Pierre Lamot <pierre at videolabs.io>
+Date: Thu, 21 Sep 2017 12:05:15 +0200
+Subject: [PATCH] Force the usage of QtZlib header
+
+  qmake adds -I$(PREFIX)/include before adding
+  -I$(PREFIX)/include/QtZlib in its path while cross
+  compiling which ends up using the definition from the
+  system zlib while linking to QtZlib
+---
+ src/svg/qsvgtinydocument.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
+index cc0fd5d..450c2d1 100644
+--- a/src/svg/qsvgtinydocument.cpp
++++ b/src/svg/qsvgtinydocument.cpp
+@@ -45,7 +45,7 @@
+ #include "qdebug.h"
+ 
+ #ifndef QT_NO_COMPRESS
+-#include <zlib.h>
++#include <QtZlib/zlib.h>
+ #endif
+ 
+ QT_BEGIN_NAMESPACE
+-- 
+2.14.1
+
diff --git a/contrib/src/qtsvg/SHA512SUMS b/contrib/src/qtsvg/SHA512SUMS
new file mode 100644
index 0000000000..0edeff3a5e
--- /dev/null
+++ b/contrib/src/qtsvg/SHA512SUMS
@@ -0,0 +1 @@
+ff78a75d0452de56dfe5b33f64d611c9e75e1a46c2ca168f9d3467ef3bb32f17ef256b45df275ed45bc2215d31dbf321d9cacb3f428096354041481276683958  qtsvg-5.6.2.tar.xz
diff --git a/contrib/src/qtsvg/rules.mak b/contrib/src/qtsvg/rules.mak
new file mode 100644
index 0000000000..924f6efca7
--- /dev/null
+++ b/contrib/src/qtsvg/rules.mak
@@ -0,0 +1,34 @@
+# Qt
+
+QTSVG_VERSION := 5.6.2
+QTSVG_URL := https://download.qt.io/official_releases/qt/5.6/$(QTSVG_VERSION)/submodules/qtsvg-opensource-src-$(QTSVG_VERSION).tar.xz
+
+DEPS_qtsvg += qt $(DEPS_qt)
+
+ifeq ($(call need_pkg,"Qt5Svg"),)
+PKGS_FOUND += qtsvg
+endif
+
+$(TARBALLS)/qtsvg-$(QTSVG_VERSION).tar.xz:
+	$(call download,$(QTSVG_URL))
+
+.sum-qtsvg: qtsvg-$(QTSVG_VERSION).tar.xz
+
+qtsvg: qtsvg-$(QTSVG_VERSION).tar.xz .sum-qtsvg
+	$(UNPACK)
+	mv qtsvg-opensource-src-$(QTSVG_VERSION) qtsvg-$(QTSVG_VERSION)
+	$(APPLY) $(SRC)/qtsvg/0001-Force-the-usage-of-QtZlib-header.patch
+	$(MOVE)
+
+.qtsvg: qtsvg
+	cd $< && $(PREFIX)/bin/qmake
+	# Make && Install libraries
+	cd $< && $(MAKE)
+	cd $</src && $(MAKE) sub-plugins-install_subtargets sub-svg-install_subtargets
+	mv $(PREFIX)/plugins/iconengines/libqsvgicon.a $(PREFIX)/lib/
+	mv $(PREFIX)/plugins/imageformats/libqsvg.a $(PREFIX)/lib/
+	cd $(PREFIX)/lib/pkgconfig; sed -i \
+		-e 's/d\.a/.a/g' \
+		-e 's/-lQt\([^ ]*\)d/-lQt\1/g' \
+		-e '/Libs:/  s/$$/ -lqsvg -lqsvgicon/ ' \
+		Qt5Svg.pc
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index f521d04171..914671aa1e 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -56,6 +56,8 @@
  #if HAS_QT5
   #ifdef QT_STATICPLUGIN
    Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+   Q_IMPORT_PLUGIN(QSvgIconPlugin)
+   Q_IMPORT_PLUGIN(QSvgPlugin)
    #if !HAS_QT56
     Q_IMPORT_PLUGIN(AccessibleFactory)
    #endif
-- 
2.14.1



More information about the vlc-devel mailing list