Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/calibre/
Date: Fri, 01 Apr 2022 17:10:11
Message-Id: 1648832996.fa4dcf5c1b2c31485ad6b3a17b85511b80eb6d80.zmedico@gentoo
1 commit: fa4dcf5c1b2c31485ad6b3a17b85511b80eb6d80
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 1 17:09:17 2022 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 1 17:09:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa4dcf5c
7
8 app-text/calibre: add 5.40.0
9
10 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
11
12 app-text/calibre/Manifest | 1 +
13 app-text/calibre/calibre-5.40.0.ebuild | 316 +++++++++++++++++++++++++++++++++
14 2 files changed, 317 insertions(+)
15
16 diff --git a/app-text/calibre/Manifest b/app-text/calibre/Manifest
17 index 16d61dca0738..c838f1c5c378 100644
18 --- a/app-text/calibre/Manifest
19 +++ b/app-text/calibre/Manifest
20 @@ -1,3 +1,4 @@
21 DIST calibre-5.16.0-SIP-v4.patch.xz 6768 BLAKE2B b939233266c7cab0fa71ccdeb748bbcffbf16248081ccf0ab313420fe3898954da71e0796b3d6c44e93c636113221f95fa6affc6be97bf41f4086a909b2849f9 SHA512 eb19e6bb328f60eb4af2c38d54c3d2a09989d41d71d27de10ab5ae443af902c3c12fc70042d4735dd785573cb63bb7d7a10ae5f7ed72afc1e1a9c6aacaf64aec
22 DIST calibre-5.16.1.tar.xz 36757204 BLAKE2B 71114eed723180142f5428a680d8c5ceabcd007acbc6a70a9298e45a9f21fc793f0ef86bf60b36c96bbd15e9e3f8d8638d179872fb6ff1f9b9f5e31a93e65ba1 SHA512 41cf29cc32c7af08215baf80609f8f099d44f2b82d34181451cbf3ed1648e07d64712dba9ff0ddec5bad3d342c7d8bde40bb822f6bd5fb93a4b29d25cf188aae
23 DIST calibre-5.39.1.tar.xz 38375212 BLAKE2B c9205b84180cdf3e98ca30729815f0c3f6b490e1df855119b3032689417b4218d26ce4c6f56d93d040fd5b88924fc432102c00af3286f85b7d5a72a536ab1ece SHA512 47a3be38a24b9e690102108abd1f2385d792721adec637f6de1cc8504df8cc0e3577786add3f48a10c2bc995320d65370d002afaea6ea13b6131b8b6767f27fa
24 +DIST calibre-5.40.0.tar.xz 38395684 BLAKE2B ff5289d9042dd114a41b90a0b91a84cba30a79d6778d0b59d2115d03dca93151ce4cd0de5fbe8cc94eb89c6cbaf8268d54680d4a1981be33f94bf332b7afb243 SHA512 06d973a6945cdca6b9eb252c656a4fe5dab15201e4c77f81a1174bdfceeaed1d64d50bde5ea7cfb4e462bb7e32d30ae0bfe166c80b2a3b765641da574fd8ed46
25
26 diff --git a/app-text/calibre/calibre-5.40.0.ebuild b/app-text/calibre/calibre-5.40.0.ebuild
27 new file mode 100644
28 index 000000000000..ec684bf96296
29 --- /dev/null
30 +++ b/app-text/calibre/calibre-5.40.0.ebuild
31 @@ -0,0 +1,316 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +PYTHON_COMPAT=( python3_{8..9} )
38 +PYTHON_REQ_USE="ipv6(+),sqlite,ssl"
39 +
40 +inherit toolchain-funcs python-single-r1 qmake-utils xdg-utils
41 +
42 +DESCRIPTION="Ebook management application"
43 +HOMEPAGE="https://calibre-ebook.com/"
44 +SRC_URI="https://download.calibre-ebook.com/${PV}/${P}.tar.xz"
45 +
46 +LICENSE="
47 + GPL-3+
48 + GPL-3
49 + GPL-2+
50 + GPL-2
51 + GPL-1+
52 + LGPL-3+
53 + LGPL-2.1+
54 + LGPL-2.1
55 + BSD
56 + MIT
57 + Old-MIT
58 + Apache-2.0
59 + public-domain
60 + || ( Artistic GPL-1+ )
61 + CC-BY-3.0
62 + OFL-1.1
63 + PSF-2
64 +"
65 +KEYWORDS="~amd64 ~arm ~x86"
66 +SLOT="0"
67 +IUSE="ios +udisks"
68 +
69 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
70 +
71 +COMMON_DEPEND="${PYTHON_DEPS}
72 + >=app-text/hunspell-1.7:=
73 + >=app-text/podofo-0.9.6_pre20171027:=
74 + >=app-text/poppler-0.26.5[qt5]
75 + dev-libs/glib:2=
76 + dev-libs/hyphen:=
77 + >=dev-libs/icu-57.1:=
78 + dev-libs/libinput:=
79 + >=dev-libs/dbus-glib-0.106
80 + dev-libs/snowball-stemmer:=
81 + >=sys-apps/dbus-1.10.8
82 + $(python_gen_cond_dep '
83 + app-accessibility/speech-dispatcher[python,${PYTHON_USEDEP}]
84 + >=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}]
85 + dev-python/beautifulsoup4[${PYTHON_USEDEP}]
86 + dev-python/cchardet[${PYTHON_USEDEP}]
87 + >=dev-python/chardet-3.0.3[${PYTHON_USEDEP}]
88 + >=dev-python/cssselect-0.7.1[${PYTHON_USEDEP}]
89 + >=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}]
90 + >=dev-python/dbus-python-1.2.4[${PYTHON_USEDEP}]
91 + dev-python/dnspython[${PYTHON_USEDEP}]
92 + >=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}]
93 + >=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}]
94 + >=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}]
95 + dev-python/jeepney[${PYTHON_USEDEP}]
96 + >=dev-python/lxml-3.8.0[${PYTHON_USEDEP}]
97 + >=dev-python/markdown-3.0.1[${PYTHON_USEDEP}]
98 + >=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}]
99 + >=dev-python/msgpack-0.6.2[${PYTHON_USEDEP}]
100 + >=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}]
101 + >=dev-python/pillow-3.2.0[${PYTHON_USEDEP}]
102 + >=dev-python/psutil-4.3.0[${PYTHON_USEDEP}]
103 + >=dev-python/pychm-0.8.6[${PYTHON_USEDEP}]
104 + dev-python/pycryptodome[${PYTHON_USEDEP}]
105 + >=dev-python/pygments-2.3.1[${PYTHON_USEDEP}]
106 + >=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}]
107 + >=dev-python/PyQt5-5.15.5_pre2107091435[gui,svg,widgets,network,printsupport,${PYTHON_USEDEP}]
108 + >=dev-python/PyQt-builder-1.10.3[${PYTHON_USEDEP}]
109 + >=dev-python/PyQtWebEngine-5.15.5_pre2108100905[${PYTHON_USEDEP}]
110 + dev-python/regex[${PYTHON_USEDEP}]
111 + dev-python/zeroconf[${PYTHON_USEDEP}]
112 + ')
113 + dev-qt/qtcore:5=
114 + dev-qt/qtdbus:5=
115 + dev-qt/qtgui:5=[jpeg]
116 + >=dev-qt/qtwebengine-5.12
117 + dev-qt/qtwidgets:5=
118 + dev-util/desktop-file-utils
119 + dev-util/gtk-update-icon-cache
120 + media-fonts/liberation-fonts
121 + media-libs/fontconfig:=
122 + >=media-libs/freetype-2:=
123 + >=media-libs/libmtp-1.1.11:=
124 + >=media-libs/libwmf-0.2.8
125 + >=media-gfx/optipng-0.7.6
126 + >=sys-libs/zlib-1.2.11:=
127 + virtual/libusb:1=
128 + x11-libs/libxkbcommon:=
129 + x11-libs/libX11:=
130 + x11-libs/libXext:=
131 + x11-libs/libXrender:=
132 + x11-misc/shared-mime-info
133 + >=x11-misc/xdg-utils-1.0.2-r2
134 + ios? (
135 + >=app-pda/usbmuxd-1.0.8
136 + >=app-pda/libimobiledevice-1.2.0
137 + )
138 + udisks? ( virtual/libudev )"
139 +RDEPEND="${COMMON_DEPEND}
140 + udisks? ( sys-fs/udisks:2 )"
141 +DEPEND="${COMMON_DEPEND}"
142 +BDEPEND="$(python_gen_cond_dep '
143 + >=dev-python/setuptools-23.1.0[${PYTHON_USEDEP}]
144 + >=dev-python/sip-5[${PYTHON_USEDEP}]
145 + ')
146 + >=virtual/podofo-build-0.9.6_pre20171027
147 + virtual/pkgconfig"
148 +
149 +PATCHES=(
150 + # Don't prompt the user for updates - they've installed via
151 + # an ebuild.
152 + "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch"
153 +
154 + # Skip calling a binary (JxrDecApp) from libjxr which is used for tests
155 + # We don't (yet?) package libjxr and it seems to be dead upstream
156 + # (last commit in 2017)
157 + "${FILESDIR}/${PN}-5.35.0-jxr-test.patch"
158 +
159 + # TODO:
160 + # test_qt tries to load a bunch of images using Qt and it currently fails
161 + # due to some presumably missing dependencies. This is important and
162 + # we need to look into it, but at time of writing, none of the tests
163 + # are even bring run, so I'd like to return to this later.
164 + # We don't want to skip test_qt entirely, so just skip this particular
165 + # assert for now.
166 + "${FILESDIR}/${PN}-5.31.0-qt-image-test.patch"
167 +)
168 +
169 +pkg_pretend() {
170 + if [[ ${MERGE_TYPE} != binary ]] && tc-is-gcc && [[ $(gcc-major-version) -lt 6 ]]; then
171 + eerror "Calibre cannot be built with this version of gcc."
172 + eerror "You need at least gcc-6.0"
173 + die "Your C compiler is too old for this package."
174 + fi
175 +}
176 +
177 +src_prepare() {
178 + default
179 +
180 + # Warning:
181 + #
182 + # While it might be rather tempting to add yet another sed here,
183 + # please don't. There have been several bugs in Gentoo's packaging
184 + # of calibre from seds-which-become-stale. Please consider
185 + # creating a patch instead, but in any case, run the test suite
186 + # and ensure it passes.
187 + #
188 + # If in doubt about a problem, checking Fedora or Arch Linux's packaging
189 + # is recommended, as Arch Linux's PKGBUILD is maintained by a Calibre
190 + # contributor. Or just ask them.
191 +
192 + # Fix outdated version constant.
193 + #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \
194 + # -i src/calibre/constants.py || \
195 + # die "sed failed to patch constants.py"
196 +
197 + # Avoid sandbox violation in /usr/share/gnome/apps when linux.py
198 + # calls xdg-* (bug #258938).
199 + sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \
200 + -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
201 + -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \
202 + -e "s|, PreserveMIMEDefaults():|:|" \
203 + -e "s|'xdg-icon-resource', 'install'|\\0, '--mode', 'user'|" \
204 + -e "s|cmd\[2\]|cmd[4]|" \
205 + -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \
206 + -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \
207 + -i src/calibre/linux.py || die "sed failed to patch linux.py"
208 +
209 + # Disable unnecessary privilege dropping for bug #287067.
210 + sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \
211 + -i setup/install.py || die "sed failed to patch install.py"
212 + sed -e "/^ os.chdir(os.path.join(src_dir, 'build'))$/a\
213 +\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \
214 +'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \
215 +'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \
216 +'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \
217 +'-i', os.path.join(os.path.basename(src_dir), 'Makefile')])" \
218 + -e "s|open(self.j(bdir, '.qmake.conf'), 'wb').close()|open(self.j(bdir, '.qmake.conf'), 'wb').write(b'QMAKE_LFLAGS += ${LDFLAGS}')|" \
219 + -i setup/build.py || die "sed failed to patch build.py"
220 +}
221 +
222 +src_compile() {
223 + # TODO: get qmake called by setup.py to respect CC and CXX too
224 + tc-export CC CXX
225 +
226 + # bug 821871
227 + local MY_LIBDIR="${ESYSROOT}/usr/$(get_libdir)"
228 + export FT_LIB_DIR="${MY_LIBDIR}" HUNSPELL_LIB_DIR="${MY_LIBDIR}" PODOFO_LIB_DIR="${MY_LIBDIR}"
229 +
230 + PATH="${T}/bin:$(qt5_get_bindir):${PATH}" ${EPYTHON} setup.py build || die
231 +}
232 +
233 +src_test() {
234 + # Skipped tests:
235 + # - 7z (unpackaged Python dependency: py7zr)
236 + # - test_unrar (unpackaged Python dependency: unrardll)
237 + #
238 + # Note that we currently have a hack to skip one part of test_qt!
239 + # See PATCHES for more.
240 + CALIBRE_PY3_PORT=1 ${PYTHON} setup.py test \
241 + --exclude-test-name 7z \
242 + --exclude-test-name test_mem_leaks \
243 + --exclude-test-name test_searching \
244 + --exclude-test-name test_unrar || die
245 +}
246 +
247 +src_install() {
248 + # calibre works with python 3, so remove the python 2 constraint
249 + export CALIBRE_PY3_PORT=1
250 +
251 + # Bypass kbuildsycoca and update-mime-database in order to
252 + # avoid sandbox violations if xdg-mime tries to call them.
253 + mkdir "${T}/bin" || die
254 + cat - > "${T}/bin/kbuildsycoca" <<-EOF
255 + #!${BASH}
256 + echo $0 : $@
257 + exit 0
258 + EOF
259 +
260 + cp "${T}"/bin/{kbuildsycoca,update-mime-database} || die
261 + chmod +x "${T}"/bin/{kbuildsycoca,update-mime-database} || die
262 +
263 + export QMAKE="$(qt5_get_bindir)/qmake"
264 +
265 + # Unset DISPLAY in order to prevent xdg-mime from triggering a sandbox
266 + # violation with kbuildsycoca as in bug #287067, comment #13.
267 + export -n DISPLAY
268 +
269 + # Bug #352625 - Some LANGUAGE values can trigger the following ValueError:
270 + # File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale
271 + # return _parse_localename(localename)
272 + # File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename
273 + # raise ValueError, 'unknown locale: %s' % localename
274 + #ValueError: unknown locale: 46
275 + export -n LANG LANGUAGE ${!LC_*}
276 + export LC_ALL=C.utf8 #709682
277 +
278 + # Bug #295672 - Avoid sandbox violation in ~/.config by forcing
279 + # variables to point to our fake temporary $HOME.
280 + export HOME="${T}/fake_homedir"
281 + export XDG_CONFIG_HOME="${HOME}/.config"
282 + export XDG_DATA_HOME="${HOME}/.local/share"
283 + export CALIBRE_CONFIG_DIRECTORY="${XDG_CONFIG_HOME}/calibre"
284 + mkdir -p "${XDG_DATA_HOME}" "${CALIBRE_CONFIG_DIRECTORY}" || die
285 +
286 + tc-export CC CXX
287 + # Bug #334243 - respect LDFLAGS when building extensions
288 + export OVERRIDE_CFLAGS="$CFLAGS" OVERRIDE_LDFLAGS="$LDFLAGS"
289 + local libdir=$(get_libdir)
290 + [[ -n $libdir ]] || die "get_libdir returned an empty string"
291 +
292 + addpredict /dev/dri #665310
293 +
294 + PATH=${T}/bin:${PATH} PYTHONPATH=${S}/src${PYTHONPATH:+:}${PYTHONPATH} \
295 + "${PYTHON}" setup.py install \
296 + --root="${D}" \
297 + --prefix="${EPREFIX}/usr" \
298 + --libdir="${EPREFIX}/usr/${libdir}" \
299 + --staging-root="${ED}/usr" \
300 + --staging-libdir="${ED}/usr/${libdir}" || die
301 +
302 + find "${ED}"/usr/share -type d -empty -delete
303 +
304 + cd "${ED}"/usr/share/calibre/fonts/liberation || die
305 + local x
306 + for x in * ; do
307 + [[ -f ${EPREFIX}/usr/share/fonts/liberation-fonts/${x} ]] || continue
308 + ln -sf "../../../fonts/liberation-fonts/${x}" "${x}" || die
309 + done
310 +
311 + einfo "Converting python shebangs"
312 + python_fix_shebang --force "${ED}"
313 +
314 + einfo "Compiling python modules"
315 + python_optimize "${ED}"/usr/$(get_libdir)/calibre "${D}/$(python_get_sitedir)"
316 +
317 + newinitd "${FILESDIR}"/calibre-server-3.init calibre-server
318 + newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server
319 +}
320 +
321 +pkg_preinst() {
322 + # Indentify stray directories from upstream's "Binary install"
323 + # method (see bug 622728).
324 + CALIBRE_LIB_DIR=/usr/$(get_libdir)/calibre
325 + CALIBRE_LIB_CONTENT=$(for x in "${ED}${CALIBRE_LIB_DIR}"/*; do
326 + printf -- "${x##*/} "; done) || die "Failed to list ${ED}${CALIBRE_LIB_DIR}"
327 +}
328 +
329 +pkg_postinst() {
330 + [[ -n ${CALIBRE_LIB_DIR} ]] || die "CALIBRE_LIB_DIR is unset"
331 + local x
332 + for x in "${EROOT}${CALIBRE_LIB_DIR}"/*; do
333 + if [[ " ${CALIBRE_LIB_CONTENT} " != *" ${x##*/} "* ]]; then
334 + elog "Purging '${x}'"
335 + rm -rf "${x}"
336 + fi
337 + done
338 + xdg_desktop_database_update
339 + xdg_mimeinfo_database_update
340 + xdg_icon_cache_update
341 +}
342 +
343 +pkg_postrm() {
344 + xdg_desktop_database_update
345 + xdg_mimeinfo_database_update
346 + xdg_icon_cache_update
347 +}