Subject: bug#27404: closed (Re: [bug#27404] [PATCH] gnu: calibre: Fix build with Qt >5.8.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 21 Jun 2017 22:14:02 +0000

Your bug report

#27404: [PATCH] gnu: calibre: Fix build with Qt >5.8.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
27404: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27404
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#27404] [PATCH] gnu: calibre: Fix build with Qt >5.8.
From: Roel Janssen <[email-masked]>
To: [email-masked]
Date: Thu, 22 Jun 2017 00:13:31 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Roel Janssen writes:

>>>From c499f6fa84ce78bc568a0b553cc41d17d0724e2d Mon Sep 17 00:00:00 2001
> From: Roel Janssen <[email-masked]>
> Date: Sat, 17 Jun 2017 08:56:36 +0200
> Subject: [PATCH] gnu: calibre: Fix build with Qt >5.8.
>
> * gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch: New file.
> * gnu/local.mk: Add patch.
> * gnu/packages/ebook.scm: Add patch.
> ---
>  gnu/local.mk                                       |  1 +
>  gnu/packages/ebook.scm                             |  3 +-
>  .../calibre-fix-missing-qbasicfontdatabase_p.patch | 85 ++++++++++++++++++++++
>  3 files changed, 88 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 148ba12d6..216853570 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -526,6 +526,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/calibre-dont-load-remote-icons.patch	\
>    %D%/packages/patches/calibre-no-updates-dialog.patch		\
>    %D%/packages/patches/calibre-use-packaged-feedparser.patch	\
> +  %D%/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch	\
>    %D%/packages/patches/cdparanoia-fpic.patch			\
>    %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch 	\
>    %D%/packages/patches/ceph-disable-cpu-optimizations.patch	\
> diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
> index 1d64e9b69..ad7a03185 100644
> --- a/gnu/packages/ebook.scm
> +++ b/gnu/packages/ebook.scm
> @@ -91,7 +91,8 @@
>          (patches (search-patches "calibre-drop-unrar.patch"
>                                   "calibre-use-packaged-feedparser.patch"
>                                   "calibre-dont-load-remote-icons.patch"
> -                                 "calibre-no-updates-dialog.patch"))))
> +                                 "calibre-no-updates-dialog.patch"
> +                                 "calibre-fix-missing-qbasicfontdatabase_p.patch"))))
>      (build-system python-build-system)
>      (native-inputs
>       `(("pkg-config" ,pkg-config)
> diff --git a/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch b/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch
> new file mode 100644
> index 000000000..25cea0818
> --- /dev/null
> +++ b/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch
> @@ -0,0 +1,85 @@
> +From 82bd2e1a51df0650cb40894c5dc2b958f601a91d Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <[email-masked]>
> +Date: Tue, 16 May 2017 14:20:51 -0400
> +Subject: [PATCH] Compatibility with qt5-5.9.0
> +
> +---
> + src/calibre/headless/fontconfig_database.cpp | 16 ++++++++++------
> + src/calibre/headless/fontconfig_database.h   | 12 ++++++++----
> + 2 files changed, 18 insertions(+), 10 deletions(-)
> +
> +diff --git a/src/calibre/headless/fontconfig_database.cpp b/src/calibre/headless/fontconfig_database.cpp
> +index 4e87b8f81b..33defd0b48 100644
> +--- a/src/calibre/headless/fontconfig_database.cpp
> ++++ b/src/calibre/headless/fontconfig_database.cpp
> +@@ -48,14 +48,18 @@
> + #include <qpa/qplatformservices.h>
> + 
> + #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
> +-#include <QtFontDatabaseSupport/private/qfontenginemultifontconfig_p.h>
> ++#  include <QtFontDatabaseSupport/private/qfontenginemultifontconfig_p.h>
> + #else
> +-#include <QtPlatformSupport/private/qfontenginemultifontconfig_p.h>
> ++#  include <QtPlatformSupport/private/qfontenginemultifontconfig_p.h>
> ++#endif
> ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
> ++#  include <QtFontDatabaseSupport/private/qfontengine_ft_p.h>
> ++#else
> ++#  include <QtGui/private/qfontengine_ft_p.h>
> + #endif
> +-#include <QtGui/private/qfontengine_ft_p.h>
> + #include <QtGui/private/qguiapplication_p.h>
> + #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
> +-#include <QtGui/private/qhighdpiscaling_p.h>
> ++#  include <QtGui/private/qhighdpiscaling_p.h>
> + #endif
> + 
> + #include <QtGui/qguiapplication.h>
> +@@ -763,7 +767,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
> + 
> + QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
> + {
> +-    QFontEngineFT *engine = static_cast<QFontEngineFT*>(QBasicFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
> ++    QFontEngineFT *engine = static_cast<QFontEngineFT*>(QFreeTypeFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
> +     if (engine == 0)
> +         return 0;
> + 
> +@@ -915,7 +919,7 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
> + 
> + QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
> + {
> +-    QString resolved = QBasicFontDatabase::resolveFontFamilyAlias(family);
> ++    QString resolved = QFreeTypeFontDatabase::resolveFontFamilyAlias(family);
> +     if (!resolved.isEmpty() && resolved != family)
> +         return resolved;
> +     FcPattern *pattern = FcPatternCreate();
> +diff --git a/src/calibre/headless/fontconfig_database.h b/src/calibre/headless/fontconfig_database.h
> +index e2fecff724..62afc129cf 100644
> +--- a/src/calibre/headless/fontconfig_database.h
> ++++ b/src/calibre/headless/fontconfig_database.h
> +@@ -7,17 +7,21 @@
> + #pragma once
> + 
> + #include <qpa/qplatformfontdatabase.h>
> +-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
> +-#include <QtFontDatabaseSupport/private/qbasicfontdatabase_p.h>
> ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
> ++#  include <QtFontDatabaseSupport/private/qfreetypefontdatabase_p.h>
> ++#elif (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
> ++#  include <QtFontDatabaseSupport/private/qbasicfontdatabase_p.h>
> ++#  define QFreeTypeFontDatabase QBasicFontDatabase
> + #else
> +-#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
> ++#  include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
> ++#  define QFreeTypeFontDatabase QBasicFontDatabase
> + #endif
> + 
> + QT_BEGIN_NAMESPACE
> + 
> + class QFontEngineFT;
> + 
> +-class QFontconfigDatabase : public QBasicFontDatabase
> ++class QFontconfigDatabase : public QFreeTypeFontDatabase
> + {
> + public:
> + #if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))

This patch is no longer relevant because version 3.0.0 is now in
upstream.

Kind regards,
Roel Janssen

Subject: [PATCH] gnu: calibre: Fix build with Qt >5.8.
From: Roel Janssen <[email-masked]>
To: [email-masked]
Date: Sat, 17 Jun 2017 09:10:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

>From c499f6fa84ce78bc568a0b553cc41d17d0724e2d Mon Sep 17 00:00:00 2001
From: Roel Janssen <[email-masked]>
Date: Sat, 17 Jun 2017 08:56:36 +0200
Subject: [PATCH] gnu: calibre: Fix build with Qt >5.8.

* gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch: New file.
* gnu/local.mk: Add patch.
* gnu/packages/ebook.scm: Add patch.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/ebook.scm                             |  3 +-
 .../calibre-fix-missing-qbasicfontdatabase_p.patch | 85 ++++++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 148ba12d6..216853570 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -526,6 +526,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/calibre-dont-load-remote-icons.patch	\
   %D%/packages/patches/calibre-no-updates-dialog.patch		\
   %D%/packages/patches/calibre-use-packaged-feedparser.patch	\
+  %D%/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch	\
   %D%/packages/patches/cdparanoia-fpic.patch			\
   %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch 	\
   %D%/packages/patches/ceph-disable-cpu-optimizations.patch	\
diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index 1d64e9b69..ad7a03185 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -91,7 +91,8 @@
         (patches (search-patches "calibre-drop-unrar.patch"
                                  "calibre-use-packaged-feedparser.patch"
                                  "calibre-dont-load-remote-icons.patch"
-                                 "calibre-no-updates-dialog.patch"))))
+                                 "calibre-no-updates-dialog.patch"
+                                 "calibre-fix-missing-qbasicfontdatabase_p.patch"))))
     (build-system python-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)
diff --git a/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch b/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch
new file mode 100644
index 000000000..25cea0818
--- /dev/null
+++ b/gnu/packages/patches/calibre-fix-missing-qbasicfontdatabase_p.patch
@@ -0,0 +1,85 @@
+From 82bd2e1a51df0650cb40894c5dc2b958f601a91d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <[email-masked]>
+Date: Tue, 16 May 2017 14:20:51 -0400
+Subject: [PATCH] Compatibility with qt5-5.9.0
+
+---
+ src/calibre/headless/fontconfig_database.cpp | 16 ++++++++++------
+ src/calibre/headless/fontconfig_database.h   | 12 ++++++++----
+ 2 files changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/src/calibre/headless/fontconfig_database.cpp b/src/calibre/headless/fontconfig_database.cpp
+index 4e87b8f81b..33defd0b48 100644
+--- a/src/calibre/headless/fontconfig_database.cpp
++++ b/src/calibre/headless/fontconfig_database.cpp
+@@ -48,14 +48,18 @@
+ #include <qpa/qplatformservices.h>
+ 
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
+-#include <QtFontDatabaseSupport/private/qfontenginemultifontconfig_p.h>
++#  include <QtFontDatabaseSupport/private/qfontenginemultifontconfig_p.h>
+ #else
+-#include <QtPlatformSupport/private/qfontenginemultifontconfig_p.h>
++#  include <QtPlatformSupport/private/qfontenginemultifontconfig_p.h>
++#endif
++#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
++#  include <QtFontDatabaseSupport/private/qfontengine_ft_p.h>
++#else
++#  include <QtGui/private/qfontengine_ft_p.h>
+ #endif
+-#include <QtGui/private/qfontengine_ft_p.h>
+ #include <QtGui/private/qguiapplication_p.h>
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
+-#include <QtGui/private/qhighdpiscaling_p.h>
++#  include <QtGui/private/qhighdpiscaling_p.h>
+ #endif
+ 
+ #include <QtGui/qguiapplication.h>
+@@ -763,7 +767,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
+ 
+ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
+ {
+-    QFontEngineFT *engine = static_cast<QFontEngineFT*>(QBasicFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
++    QFontEngineFT *engine = static_cast<QFontEngineFT*>(QFreeTypeFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
+     if (engine == 0)
+         return 0;
+ 
+@@ -915,7 +919,7 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
+ 
+ QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
+ {
+-    QString resolved = QBasicFontDatabase::resolveFontFamilyAlias(family);
++    QString resolved = QFreeTypeFontDatabase::resolveFontFamilyAlias(family);
+     if (!resolved.isEmpty() && resolved != family)
+         return resolved;
+     FcPattern *pattern = FcPatternCreate();
+diff --git a/src/calibre/headless/fontconfig_database.h b/src/calibre/headless/fontconfig_database.h
+index e2fecff724..62afc129cf 100644
+--- a/src/calibre/headless/fontconfig_database.h
++++ b/src/calibre/headless/fontconfig_database.h
+@@ -7,17 +7,21 @@
+ #pragma once
+ 
+ #include <qpa/qplatformfontdatabase.h>
+-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
+-#include <QtFontDatabaseSupport/private/qbasicfontdatabase_p.h>
++#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
++#  include <QtFontDatabaseSupport/private/qfreetypefontdatabase_p.h>
++#elif (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
++#  include <QtFontDatabaseSupport/private/qbasicfontdatabase_p.h>
++#  define QFreeTypeFontDatabase QBasicFontDatabase
+ #else
+-#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
++#  include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
++#  define QFreeTypeFontDatabase QBasicFontDatabase
+ #endif
+ 
+ QT_BEGIN_NAMESPACE
+ 
+ class QFontEngineFT;
+ 
+-class QFontconfigDatabase : public QBasicFontDatabase
++class QFontconfigDatabase : public QFreeTypeFontDatabase
+ {
+ public:
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
-- 
2.13.0

Dear Guix,

This patch fixes the build for Calibre (see
http://hydra.gnu.org/build/2092277).

The patch is already committed to the Calibre repository, and there has
been a new release where this problem has been dealt with (3.0.0),
however, building 3.0.0 requires more changes (the current patches do
not apply, so we have to investigate whether we need to do more work to
remove non-free stuff).  So, therefore, I would like to fix this version
first with this patch.

The added patch file can be removed when we get 3.0.0 to build.

Kind regards,
Roel Janssen