Tue Nov 17 01:55:04 2020 UTC ()
calibre: fix build with ICU 68

This package depends on ICU headers that now unconditionally expect C99
features, so it requires C99 just as ICU does. Patch around ICU API
changes that caused related breakages.


(gutteridge)
diff -r1.243 -r1.244 pkgsrc/misc/calibre/Makefile
diff -r1.105 -r1.106 pkgsrc/misc/calibre/distinfo
diff -r0 -r1.1 pkgsrc/misc/calibre/patches/patch-src_calibre_utils_icu.c
diff -r0 -r1.1 pkgsrc/misc/calibre/patches/patch-src_calibre_utils_matcher.c

cvs diff -r1.243 -r1.244 pkgsrc/misc/calibre/Makefile (expand / switch to unified diff)

--- pkgsrc/misc/calibre/Makefile 2020/11/05 09:08:39 1.243
+++ pkgsrc/misc/calibre/Makefile 2020/11/17 01:55:04 1.244
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.243 2020/11/05 09:08:39 ryoon Exp $ 1# $NetBSD: Makefile,v 1.244 2020/11/17 01:55:04 gutteridge Exp $
2 2
3DISTNAME= calibre-3.40.1 3DISTNAME= calibre-3.40.1
4PKGREVISION= 20 4PKGREVISION= 21
5CATEGORIES= misc 5CATEGORIES= misc
6#MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=calibre/} 6#MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=calibre/}
7MASTER_SITES= http://download.calibre-ebook.com/${PKGVERSION_NOREV}/ 7MASTER_SITES= http://download.calibre-ebook.com/${PKGVERSION_NOREV}/
8EXTRACT_SUFX= .tar.xz 8EXTRACT_SUFX= .tar.xz
9DISTFILES= ${DISTNAME}${EXTRACT_SUFX} 9DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
10 10
11MAINTAINER= pkgsrc-users@NetBSD.org 11MAINTAINER= pkgsrc-users@NetBSD.org
12HOMEPAGE= https://www.calibre-ebook.com/ 12HOMEPAGE= https://www.calibre-ebook.com/
13COMMENT= E-book library management application 13COMMENT= E-book library management application
14LICENSE= gnu-gpl-v3 14LICENSE= gnu-gpl-v3
15 15
16DEPENDS+= ${PYPKGPREFIX}-apsw>=3.7.17:../../databases/py-apsw 16DEPENDS+= ${PYPKGPREFIX}-apsw>=3.7.17:../../databases/py-apsw
17DEPENDS+= ${PYPKGPREFIX}-beautifulsoup4-[0-9]*:../../www/py-beautifulsoup4 17DEPENDS+= ${PYPKGPREFIX}-beautifulsoup4-[0-9]*:../../www/py-beautifulsoup4
@@ -32,27 +32,27 @@ DEPENDS+= ${PYPKGPREFIX}-Pillow>=2.7.0:. @@ -32,27 +32,27 @@ DEPENDS+= ${PYPKGPREFIX}-Pillow>=2.7.0:.
32DEPENDS+= ${PYPKGPREFIX}-psutil>=0.6.1:../../sysutils/py-psutil 32DEPENDS+= ${PYPKGPREFIX}-psutil>=0.6.1:../../sysutils/py-psutil
33DEPENDS+= ${PYPKGPREFIX}-pygments-[0-9]*:../../textproc/py-pygments 33DEPENDS+= ${PYPKGPREFIX}-pygments-[0-9]*:../../textproc/py-pygments
34DEPENDS+= ${PYPKGPREFIX}-regex-[0-9]*:../../textproc/py-regex 34DEPENDS+= ${PYPKGPREFIX}-regex-[0-9]*:../../textproc/py-regex
35DEPENDS+= ${PYPKGPREFIX}-six-[0-9]*:../../lang/py-six 35DEPENDS+= ${PYPKGPREFIX}-six-[0-9]*:../../lang/py-six
36DEPENDS+= ${PYPKGPREFIX}-soupsieve-[0-9]*:../../www/py-soupsieve 36DEPENDS+= ${PYPKGPREFIX}-soupsieve-[0-9]*:../../www/py-soupsieve
37DEPENDS+= ${PYPKGPREFIX}-sqlite3-[0-9]*:../../databases/py-sqlite3 37DEPENDS+= ${PYPKGPREFIX}-sqlite3-[0-9]*:../../databases/py-sqlite3
38# for installation 38# for installation
39BUILD_DEPENDS+= xdg-utils>=1.0.2:../../misc/xdg-utils 39BUILD_DEPENDS+= xdg-utils>=1.0.2:../../misc/xdg-utils
40 40
41EXTRACT_USING= bsdtar 41EXTRACT_USING= bsdtar
42 42
43PYTHON_VERSIONS_ACCEPTED= 27 # as of 3.16.0 43PYTHON_VERSIONS_ACCEPTED= 27 # as of 3.16.0
44 44
45USE_LANGUAGES= c c++ 45USE_LANGUAGES= c99 c++
46USE_LIBTOOL= yes 46USE_LIBTOOL= yes
47USE_TOOLS+= pkg-config pax 47USE_TOOLS+= pkg-config pax
48PYSETUPOPTARGS= # empty 48PYSETUPOPTARGS= # empty
49PYSETUPINSTALLARGS= --prefix=${PREFIX} --root=${DESTDIR:Q}${PREFIX} 49PYSETUPINSTALLARGS= --prefix=${PREFIX} --root=${DESTDIR:Q}${PREFIX}
50 50
51INSTALLATION_DIRS= share/applications 51INSTALLATION_DIRS= share/applications
52INSTALLATION_DIRS+= share/icons 52INSTALLATION_DIRS+= share/icons
53INSTALLATION_DIRS+= share/calibre/recipes 53INSTALLATION_DIRS+= share/calibre/recipes
54 54
55FIX_PYTHON_FILES+= *.py 55FIX_PYTHON_FILES+= *.py
56FIX_PYTHON_FILES+= recipes/*.recipe 56FIX_PYTHON_FILES+= recipes/*.recipe
57FIX_PYTHON_FILES+= */*.py 57FIX_PYTHON_FILES+= */*.py
58FIX_PYTHON_FILES+= */*/*.py 58FIX_PYTHON_FILES+= */*/*.py
@@ -118,27 +118,26 @@ BUILDLINK_API_DEPENDS.libmtp+= libmtp>=1 @@ -118,27 +118,26 @@ BUILDLINK_API_DEPENDS.libmtp+= libmtp>=1
118.include "../../devel/zlib/buildlink3.mk" 118.include "../../devel/zlib/buildlink3.mk"
119BUILDLINK_API_DEPENDS.libusb+= libusb>=0.1.12 119BUILDLINK_API_DEPENDS.libusb+= libusb>=0.1.12
120.include "../../mk/libusb.buildlink3.mk" 120.include "../../mk/libusb.buildlink3.mk"
121.include "../../fonts/fontconfig/buildlink3.mk" 121.include "../../fonts/fontconfig/buildlink3.mk"
122.include "../../graphics/libwebp/buildlink3.mk" 122.include "../../graphics/libwebp/buildlink3.mk"
123.include "../../graphics/libwmf/buildlink3.mk" 123.include "../../graphics/libwmf/buildlink3.mk"
124.include "../../mk/jpeg.buildlink3.mk" 124.include "../../mk/jpeg.buildlink3.mk"
125.include "../../graphics/png/buildlink3.mk" 125.include "../../graphics/png/buildlink3.mk"
126.include "../../lang/python/egg.mk" 126.include "../../lang/python/egg.mk"
127_PYSETUPTOOLSINSTALLARGS= # empty 127_PYSETUPTOOLSINSTALLARGS= # empty
128# Get rid of --root=${DESTDIR}, use our own version from above instead. 128# Get rid of --root=${DESTDIR}, use our own version from above instead.
129# because the setup.py is not the standard one and behaves differently. 129# because the setup.py is not the standard one and behaves differently.
130_PYSETUPINSTALLARGS= ${PYSETUPINSTALLARGS} ${PYSETUPOPTARGS} ${_PYSETUPTOOLSINSTALLARGS} 130_PYSETUPINSTALLARGS= ${PYSETUPINSTALLARGS} ${PYSETUPOPTARGS} ${_PYSETUPTOOLSINSTALLARGS}
131BUILDLINK_API_DEPENDS.podofo+= podofo>=0.8.2 
132.include "../../print/podofo/buildlink3.mk" 131.include "../../print/podofo/buildlink3.mk"
133BUILDLINK_API_DEPENDS.poppler+= poppler>=0.20.2 132BUILDLINK_API_DEPENDS.poppler+= poppler>=0.20.2
134.include "../../print/poppler-includes/buildlink3.mk" 133.include "../../print/poppler-includes/buildlink3.mk"
135.include "../../print/poppler/buildlink3.mk" 134.include "../../print/poppler/buildlink3.mk"
136.include "../../print/poppler-qt5/buildlink3.mk" 135.include "../../print/poppler-qt5/buildlink3.mk"
137.include "../../sysutils/desktop-file-utils/desktopdb.mk" 136.include "../../sysutils/desktop-file-utils/desktopdb.mk"
138.include "../../sysutils/hal/buildlink3.mk" 137.include "../../sysutils/hal/buildlink3.mk"
139BUILDLINK_API_DEPENDS.py-dbus+= ${PYPKGPREFIX}-dbus>=0.82.2 138BUILDLINK_API_DEPENDS.py-dbus+= ${PYPKGPREFIX}-dbus>=0.82.2
140.include "../../sysutils/py-dbus/buildlink3.mk" 139.include "../../sysutils/py-dbus/buildlink3.mk"
141.include "../../textproc/icu/buildlink3.mk" 140.include "../../textproc/icu/buildlink3.mk"
142.include "../../databases/shared-mime-info/mimedb.mk" 141.include "../../databases/shared-mime-info/mimedb.mk"
143.include "../../x11/py-sip/buildlink3.mk" 142.include "../../x11/py-sip/buildlink3.mk"
144.include "../../x11/qt5-qtbase/buildlink3.mk" 143.include "../../x11/qt5-qtbase/buildlink3.mk"

cvs diff -r1.105 -r1.106 pkgsrc/misc/calibre/distinfo (expand / switch to unified diff)

--- pkgsrc/misc/calibre/distinfo 2020/07/05 12:09:08 1.105
+++ pkgsrc/misc/calibre/distinfo 2020/11/17 01:55:04 1.106
@@ -1,11 +1,13 @@ @@ -1,11 +1,13 @@
1$NetBSD: distinfo,v 1.105 2020/07/05 12:09:08 rhialto Exp $ 1$NetBSD: distinfo,v 1.106 2020/11/17 01:55:04 gutteridge Exp $
2 2
3SHA1 (calibre-3.40.1.tar.xz) = 12cea0bed963dde2b58c9cdd4c3c25c735d6d15a 3SHA1 (calibre-3.40.1.tar.xz) = 12cea0bed963dde2b58c9cdd4c3c25c735d6d15a
4RMD160 (calibre-3.40.1.tar.xz) = 72bf801e4164dcebec22ba36162fe034c9edad54 4RMD160 (calibre-3.40.1.tar.xz) = 72bf801e4164dcebec22ba36162fe034c9edad54
5SHA512 (calibre-3.40.1.tar.xz) = 1333c24e384ccae79d264055e1e84b8a13919e68d9290a277e07bb7f3b4579d15090859b50945672c155a438a2bf9e5f088f094bc30781af7c5d0d9ccd7226f4 5SHA512 (calibre-3.40.1.tar.xz) = 1333c24e384ccae79d264055e1e84b8a13919e68d9290a277e07bb7f3b4579d15090859b50945672c155a438a2bf9e5f088f094bc30781af7c5d0d9ccd7226f4
6Size (calibre-3.40.1.tar.xz) = 38365300 bytes 6Size (calibre-3.40.1.tar.xz) = 38365300 bytes
7SHA1 (patch-setup_build.py) = f309c8f01af375fce1d09bf5c4bac9610cf4e0c5 7SHA1 (patch-setup_build.py) = f309c8f01af375fce1d09bf5c4bac9610cf4e0c5
8SHA1 (patch-setup_build__environment.py) = dd6160233c717e935205649ee685e71df3f1858e 8SHA1 (patch-setup_build__environment.py) = dd6160233c717e935205649ee685e71df3f1858e
9SHA1 (patch-src_calibre_headless_fontconfig_database.cpp) = d794a9f1c94c85d3406384bf25ade4be8d2f8a1c 9SHA1 (patch-src_calibre_headless_fontconfig_database.cpp) = d794a9f1c94c85d3406384bf25ade4be8d2f8a1c
10SHA1 (patch-src_calibre_headless_headless__integration.cpp) = 62ab6f5aaf6bd8bcbb875ab56eac1a474d8b446b 10SHA1 (patch-src_calibre_headless_headless__integration.cpp) = 62ab6f5aaf6bd8bcbb875ab56eac1a474d8b446b
11SHA1 (patch-src_calibre_linux.py) = 16c3122a612ec9996f774c5c2c9d40a475723662 11SHA1 (patch-src_calibre_linux.py) = 16c3122a612ec9996f774c5c2c9d40a475723662
 12SHA1 (patch-src_calibre_utils_icu.c) = fd0172000b9ab5d52730f9e4a5c8cc6c2253d69b
 13SHA1 (patch-src_calibre_utils_matcher.c) = 1041dc748cec86c18f2438d284608f42f66fc282

File Added: pkgsrc/misc/calibre/patches/patch-src_calibre_utils_icu.c
$NetBSD: patch-src_calibre_utils_icu.c,v 1.1 2020/11/17 01:55:04 gutteridge Exp $

Fix build with ICU 68.

--- src/calibre/utils/icu.c.orig	2019-03-08 06:09:34.000000000 +0000
+++ src/calibre/utils/icu.c
@@ -243,14 +243,14 @@ icu_Collator_contains(icu_Collator *self
 
     a = python_to_icu(a_, &asz);
     if (a == NULL) goto end;
-    if (asz == 0) { found = TRUE; goto end; }
+    if (asz == 0) { found = true; goto end; }
     b = python_to_icu(b_, &bsz);
     if (b == NULL) goto end;
 
     search = usearch_openFromCollator(a, asz, b, bsz, self->collator, NULL, &status);
     if (U_SUCCESS(status)) {
         pos = usearch_first(search, &status);
-        if (pos != USEARCH_DONE) found = TRUE;
+        if (pos != USEARCH_DONE) found = true;
     }
 end:
     if (search != NULL) usearch_close(search);

File Added: pkgsrc/misc/calibre/patches/Attic/patch-src_calibre_utils_matcher.c
$NetBSD: patch-src_calibre_utils_matcher.c,v 1.1 2020/11/17 01:55:04 gutteridge Exp $

Fix build with ICU 68.

--- src/calibre/utils/matcher.c.orig	2019-03-08 06:09:34.000000000 +0000
+++ src/calibre/utils/matcher.c
@@ -15,9 +15,6 @@
 #define inline
 #endif
 
-typedef unsigned char bool;
-#define TRUE 1
-#define FALSE 0
 #define MAX(x, y) ((x > y) ? x : y)
 #define nullfree(x) if(x != NULL) free(x); x = NULL;
 
@@ -240,10 +237,10 @@ static bool create_searches(UStringSearc
         U16_FWD_1(needle, i, needle_len);
         if (pos == i) break;
         searches[pos] = usearch_openFromCollator(needle + pos, i - pos, haystack, haystack_len, collator, NULL, &status);
-        if (U_FAILURE(status)) { PyErr_SetString(PyExc_ValueError, u_errorName(status)); searches[pos] = NULL; return FALSE; }
+        if (U_FAILURE(status)) { PyErr_SetString(PyExc_ValueError, u_errorName(status)); searches[pos] = NULL; return false; }
     }
 
-    return TRUE;
+    return true;
 }
 
 static void free_searches(UStringSearch **searches, int32_t count) {
@@ -259,14 +256,14 @@ static bool match(UChar **items, int32_t
     int32_t i = 0, maxhl = 0;
     int32_t r = 0, *positions = NULL;
     MatchInfo *matches = NULL;
-    bool ok = FALSE;
+    bool ok = false;
     MemoryItem ***memo = NULL;
     int32_t needle_len = u_strlen(needle);
     UStringSearch **searches = NULL;
 
     if (needle_len <= 0 || item_count <= 0) {
         for (i = 0; i < (int32_t)item_count; i++) match_results[i].score = 0.0;
-        ok = TRUE;
+        ok = true;
         goto end;
     }
 
@@ -289,7 +286,7 @@ static bool match(UChar **items, int32_t
 
     if (maxhl <= 0) {
         for (i = 0; i < (int32_t)item_count; i++) match_results[i].score = 0.0;
-        ok = TRUE;
+        ok = true;
         goto end;
     }
 
@@ -308,7 +305,7 @@ static bool match(UChar **items, int32_t
         convert_positions(positions, final_positions + i * needle_char_len, matches[i].haystack, needle_char_len, needle_len, match_results[i].score);
     }
 
-    ok = TRUE;
+    ok = true;
 end:
     nullfree(positions);
     nullfree(stack.items);
@@ -401,7 +398,7 @@ static PyObject *
 Matcher_calculate_scores(Matcher *self, PyObject *args) {
     int32_t *final_positions = NULL, *p;
     Match *matches = NULL;
-    bool ok = FALSE;
+    bool ok = false;
     uint32_t i = 0, needle_char_len = 0, j = 0;
     PyObject *items = NULL, *score = NULL, *positions = NULL, *pneedle = NULL;
     UChar *needle = NULL;