blob: 363567a2633242e44283f7be2c9ead2577e196fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Jelle van der Waa <jelle@vdwaa.nl>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Petrov Roman <nwhisper@gmail.com>
# Contributor: Andrea Fagiani <andfagiani _at_ gmail dot com>
# Contributor: Larry Hajali <larryhaja@gmail.com>
# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
pkgbase=calibre-git
pkgname=calibre-git
pkgver=5.3.0.r35.g40e5b7124f
pkgrel=1
_dictionaries_commit="libreoffice-6.4.0.0.beta1"
pkgdesc="Ebook management application"
arch=('i686' 'x86_64')
url="https://calibre-ebook.com/"
license=('GPL3')
_py_deps=('apsw' 'beautifulsoup4' 'cssselect' 'css-parser' 'dateutil' 'dbus' 'dnspython'
'feedparser' 'html2text' 'html5-parser' 'lxml' 'markdown' 'mechanize' 'msgpack'
'netifaces' 'unrardll' 'pillow' 'psutil' 'pychm' 'pygments' 'pyqt5'
'pyqtwebengine' 'regex' 'zeroconf')
depends=('hunspell' 'hyphen' 'icu' 'jxrlib' 'libmtp' 'libusb'
'libwmf' 'mathjax' 'mtdev' 'optipng' 'podofo'
"${_py_deps[@]/#/python-}" 'qt5-svg' 'udisks2')
makedepends=('git' 'qt5-x11extras' 'sip5' 'pyqt-builder' 'xdg-utils' 'rapydscript-ng' 'python-sphinx')
checkdepends=('xorg-server-xvfb')
optdepends=('poppler: required for converting pdf to html')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}" 'calibre-common' 'calibre-python3')
replaces=('calibre-common-git' 'calibre-python3-git')
source=("git+https://github.com/kovidgoyal/${pkgbase%-git}.git?signed"
"git+https://github.com/kovidgoyal/${pkgbase%-git}-translations.git?signed"
"dictionaries-${_dictionaries_commit}.tar.gz::https://github.com/LibreOffice/dictionaries/archive/${_dictionaries_commit}.tar.gz"
"user-agent-data.json")
sha256sums=('SKIP'
'SKIP'
'ccfdb3ba622d59c99b305abfdc824a8e2f96f1930fe6f4e7f183297bc80ad3e8'
'd17a1fff7bf441db8d1ec826afd8661352869ec4e5edd2a17f917ef2fbf01043')
validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) <kovid@kovidgoyal.net>
pkgver() {
cd "${srcdir}/${pkgbase%-git}"
git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare(){
cd "${srcdir}/${pkgbase%-git}"
python setup.py git_version
# Link translations to build dir
ln -sfT ../calibre-translations translations
# Desktop integration (e.g. enforce arch defaults)
# Use uppercase naming scheme, don't delete config files under fakeroot.
sed -e "/import config_dir/,/os.rmdir(config_dir)/d" \
-e "s/^Name=calibre/Name=Calibre/g" \
-i src/calibre/linux.py
}
build() {
cd "${srcdir}/${pkgbase%-git}"
# Don't use the bootstrapper, since it tries to checkout/pull the
# translations repo and generally touch the internet. Instead call each
# *needed* subcommmand.
# LANG='en_US.UTF-8' python2 setup.py bootstrap
LANG='en_US.UTF-8' python setup.py build
LANG='en_US.UTF-8' python setup.py iso639
LANG='en_US.UTF-8' python setup.py iso3166
LANG='en_US.UTF-8' python setup.py translations
LANG='en_US.UTF-8' python setup.py gui
LANG='en_US.UTF-8' python setup.py resources \
--path-to-mathjax /usr/share/mathjax --system-mathjax \
--path-to-hyphenation "${srcdir}"/dictionaries-${_dictionaries_commit}
LANG='en_US.UTF-8' python setup.py man_pages
# This tries to download new user-agent data, so pre-seed a
# recently-generated copy to allow offline builds.
cp ../user-agent-data.json resources/
LANG='en_US.UTF-8' python setup.py recent_uas || true
}
check() {
cd "${srcdir}/${pkgbase%-git}"
# without xvfb-run this fails with much "Control socket failed to recv(), resetting"
# ERROR: test_websocket_perf (calibre.srv.tests.web_sockets.WebSocketTest)
# one or two tests are a bit flaky, but the python3 build seems to succeed more often
#
# test_ajax_book segfaults on qt >=5.15.1 inside of qt itself, but only in nspawn containers
# see https://github.com/kovidgoyal/calibre/commit/28ef780d9911d598314d98bdfc3b1c88a94681df
LANG='en_US.UTF-8' xvfb-run python setup.py test --exclude-test-name=test_ajax_book
}
package() {
cd "${srcdir}/${pkgbase%-git}"
# If this directory doesn't exist, zsh completion won't install.
install -d "${pkgdir}/usr/share/zsh/site-functions"
LANG='en_US.UTF-8' python setup.py install \
--staging-root="${pkgdir}/usr" \
--prefix=/usr
cp -a man-pages/ "${pkgdir}/usr/share/man"
# not needed at runtime
rm -r "${pkgdir}"/usr/share/calibre/rapydscript/
while read -rd '' _file; do
_destdir="$(dirname "${_file#${pkgdir}}")"
python3 -m compileall -d "${_destdir}" "${_file}"
python3 -O -m compileall -d "${_destdir}" "${_file}"
done < <(find "${pkgdir}"/usr/lib/ -name '*.py' -print0)
}
|