2 # TODO: - rewrite generate-tarball.sh script to provide locales.zip handling (if needed)
3 # - make separate server package with init-scripts, etc...
6 # Upstream packages contain some non-free fonts which we cannot redistribute,
7 # so when upgrading calibre we should download upstream tarball by hand from
8 # https://download.calibre-ebook.com/ and run generate-tarball.sh script
11 Summary: E-book converter and library management
12 Summary(pl.UTF-8): Konwerter oraz biblioteka dla e-booków
17 Group: Applications/Multimedia
18 Source0: %{name}-%{version}-nofonts.tar.xz
19 # Source0-md5: 9aa5823e828ad0e7ff29d8178080e449
20 Source1: generate-tarball.sh
21 Source2: %{name}-mount-helper
22 Patch0: %{name}-prefix.patch
23 Patch1: %{name}-env_module.patch
24 Patch2: %{name}-locales.patch
25 Patch3: shebang-python-fix.patch
26 Patch4: desktop-integration.patch
27 URL: http://www.calibre-ebook.com/
28 %define baeutifulsoup_ver 3.0.5
30 %define pyqt5_ver 5.3.1
31 %define apsw_ver 3.8.0.1
32 %define cssselect_ver 0.7.1
33 %define cssutils_ver 1:0.9.9
34 %define dateutil_ver 1.4.1
36 %define lxml_ver 2.2.1
37 %define mechanize_ver 0.1.11
38 %define netifaces_ver 0.8
39 %define psutil_ver 0.6.1
40 BuildRequires: ImageMagick-devel >= 6.6.4.7
41 BuildRequires: Qt5Core-devel
42 BuildRequires: Qt5DBus-devel
43 BuildRequires: Qt5EventDispatcherSupport-devel
44 BuildRequires: Qt5FontDatabaseSupport-devel
45 BuildRequires: Qt5Gui-devel
46 BuildRequires: Qt5ServiceSupport-devel
47 BuildRequires: Qt5ThemeSupport-devel
48 BuildRequires: Qt5Widgets-devel
49 BuildRequires: chmlib-devel >= 0.40
50 BuildRequires: libicu-devel
51 BuildRequires: libinput-devel
52 BuildRequires: libmtp-devel >= 1.1.5
53 BuildRequires: libwmf-devel >= 0.2.8
54 BuildRequires: mtdev-devel
55 BuildRequires: pkgconfig
56 BuildRequires: podofo-devel >= 0.8.2
57 BuildRequires: poppler-qt5-devel >= 0.28.1
58 BuildRequires: poppler-glib-devel >= 0.28.1
59 BuildRequires: python-BeautifulSoup >= %{baeutifulsoup_ver}
60 BuildRequires: python-PIL >= %{pil_ver}
61 BuildRequires: python-PyQt5 >= %{pyqt5_ver}
62 BuildRequires: python-PyQt5-devel-tools >= %{pyqt5_ver}
63 BuildRequires: python-PyQt5-uic >= %{pyqt5_ver}
64 BuildRequires: python-apsw >= %{apsw_ver}
65 BuildRequires: python-bs4
66 BuildRequires: python-cssselect >= %{cssselect_ver}
67 BuildRequires: python-css_parser
68 BuildRequires: python-cssutils >= %{cssutils_ver}
69 BuildRequires: python-dateutil >= %{dateutil_ver}
70 BuildRequires: python-devel >= 1:2.7.1
71 BuildRequires: python-dns >= %{dns_ver}
72 BuildRequires: python-genshi
73 BuildRequires: python-html5-parser
74 BuildRequires: python-lxml >= %{lxml_ver}
75 BuildRequires: python-mechanize >= %{mechanize_ver}
76 BuildRequires: python-modules-sqlite
77 BuildRequires: python-msgpack
78 BuildRequires: python-netifaces >= %{netifaces_ver}
79 BuildRequires: python-psutil >= %{psutil_ver}
80 BuildRequires: python-regex
81 BuildRequires: python-sip-devel
82 BuildRequires: qt5-build
83 BuildRequires: qt5-qmake
84 BuildRequires: rpm-pythonprov
85 BuildRequires: rpmbuild(macros) >= 1.710
86 BuildRequires: sed >= 4.0
87 BuildRequires: sqlite3-devel
88 BuildRequires: sip-PyQt5
89 BuildRequires: tar >= 1:1.22
91 BuildRequires: xdg-utils
92 BuildRequires: xz >= 1:4.999.7
95 Requires: python-BeautifulSoup >= %{baeutifulsoup_ver}
96 Requires: python-PIL >= %{pil_ver}
97 Requires: python-PyQt5 >= %{pyqt5_ver}
98 Requires: python-apsw >= %{apsw_ver}
100 Requires: python-cssselect >= %{cssselect_ver}
101 Requires: python-css_parser
102 Requires: python-cssutils >= %{cssutils_ver}
103 Requires: python-dateutil >= %{dateutil_ver}
104 Requires: python-dns >= %{dns_ver}
105 Requires: python-genshi
106 Requires: python-html5-parser
107 Requires: python-lxml >= %{lxml_ver}
108 Requires: python-mechanize >= %{mechanize_ver}
109 Requires: python-modules-sqlite
110 Requires: python-msgpack
111 Requires: python-netifaces >= %{netifaces_ver}
112 Requires: python-psutil >= %{psutil_ver}
113 Requires: python-regex
114 Suggests: ImageMagick-coder-jpeg
115 Suggests: ImageMagick-coder-png
116 ### FIXME: libunrar.so is needed for rar-packed files
117 Suggests: libunrar-devel
118 Suggests: poppler-progs
119 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
122 Calibre is meant to be a complete e-library solution. It includes
123 library management, format conversion, news feeds to ebook conversion
124 as well as e-book reader sync features.
126 Calibre is primarily a ebook cataloging program. It manages your ebook
127 collection for you. It is designed around the concept of the logical
128 book, i.e. a single entry in the database that may correspond to
129 ebooks in several formats. It also supports conversion to and from a
130 dozen different ebook formats.
132 Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML,
133 CBR, CBZ, RTF, TXT, PDF and LRS.
135 %description -l pl.UTF-8
136 Calibre to bardzo dobry i darmowy program do czytania e-książek.
138 Calibre umożliwia zarówno czytanie e-książek jak i konwersję wielu
139 formatów do ich postaci. Program obsługuje następujące typy plików:
140 import: LRF, PDF, LIT, RTF, OPF, MOBI, PRC, EPUB, FB2, IMP, RB i HTML
141 eksport: Mobi, LRF i EPUB oraz do aplikacji iPhone-reader i Stanza.
143 Ten czytnik e-książek oferuje również pobieranie okładek, komiksów i
144 najnowszych wiadomości z serwisów poświęconym e-książkom. Twórcy
145 dołączyli również aplikację, którą użytkownik może wykorzystać jako
146 swój własny serwer darmowych książek.
148 %package -n bash-completion-calibre
149 Summary: bash-completion for calibre
150 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla calibre
151 Group: Applications/Shells
152 Requires: %{name} = %{version}-%{release}
153 Requires: bash-completion
154 %if "%{_rpmversion}" >= "5"
158 %description -n bash-completion-calibre
159 bash-completion for calibre.
161 %description -n bash-completion-calibre -l pl.UTF-8
162 Pakiet ten dostarcza bashowe uzupełnianie nazw dla calibre.
164 %package -n zsh-completion-calibre
165 Summary: zsh-completion for calibre
166 Summary(pl.UTF-8): uzupełnianie nazw dla calibre w powłoce zsh
167 Group: Applications/Shells
168 Requires: %{name} = %{version}-%{release}
169 Requires: bash-completion
171 %description -n zsh-completion-calibre
172 zsh-completion for calibre.
174 %description -n zsh-completion-calibre -l pl.UTF-8
175 Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh.
185 # 64bit target build fix
186 %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
188 # upstream decides to store locale files in a single zip file but we prefer separate .mo
189 mkdir resources/localization/locales
190 unzip resources/localization/locales.zip -d resources/localization/locales
191 chmod 755 resources/localization/locales/*
192 rm -f resources/localization/locales.zip
197 OVERRIDE_CFLAGS="%{rpmcflags}" \
198 OVERRIDE_LDFLAGS="%{rpmldflags}" \
199 QMAKE="%{_bindir}/qmake-qt5" \
200 %{__python} setup.py build
203 rm -rf $RPM_BUILD_ROOT
204 # create directories for xdg-utils
205 install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
206 $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/usr/share/zsh/site-functions}
208 export XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}"
209 export XDG_UTILS_INSTALL_MODE="system"
210 export LIBPATH="%{_libdir}"
211 %{__python} setup.py install \
213 --root=$RPM_BUILD_ROOT \
214 --prefix=%{_prefix} \
215 --bindir=%{_bindir} \
216 --libdir=%{_libdir} \
217 --sharedir=%{_datadir}
219 %{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_bindir}/*
221 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
222 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
224 %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
225 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
226 %py_postclean %{_libdir}/%{name}
228 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
230 # set proper filenames for locales (TODO: switch to patch if possible)
231 for file in $RPM_BUILD_ROOT%{_localedir}/*; do
232 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
233 mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
234 %{__mv} $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
235 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
237 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
238 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
239 %{__mv} $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
240 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
242 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
243 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
244 %{__mv} $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
245 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
248 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/{km_KH,km}
249 # duplicates of bn,sl
250 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/{bn_BD,sl_SI}
252 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/{jv,ltg}
254 install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
256 %find_lang %{name} --all-name
257 for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.calibre_msgpack; do
258 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/.*:\1:')
259 echo $file | %{__sed} "s:$RPM_BUILD_ROOT\(.*\):%lang($lang) \1:" >>%{name}.lang
263 rm -rf $RPM_BUILD_ROOT
266 %update_desktop_database
267 %update_mime_database
268 %update_icon_cache hicolor
271 if [ $1 -eq 0 ] ; then
272 %update_desktop_database
273 %update_mime_database
274 %update_icon_cache hicolor
277 %files -f %{name}.lang
278 %defattr(644,root,root,755)
279 %doc Changelog.yaml COPYRIGHT README.md
280 %attr(755,root,root) %{_bindir}/calibre
281 %attr(755,root,root) %{_bindir}/calibre-complete
282 %attr(755,root,root) %{_bindir}/calibre-customize
283 %attr(755,root,root) %{_bindir}/calibre-debug
284 %attr(755,root,root) %{_bindir}/calibre-mount-helper
285 %attr(755,root,root) %{_bindir}/calibre-parallel
286 %attr(755,root,root) %{_bindir}/calibre-server
287 %attr(755,root,root) %{_bindir}/calibre-smtp
288 %attr(755,root,root) %{_bindir}/calibredb
289 %attr(755,root,root) %{_bindir}/ebook-convert
290 %attr(755,root,root) %{_bindir}/ebook-device
291 %attr(755,root,root) %{_bindir}/ebook-edit
292 %attr(755,root,root) %{_bindir}/ebook-meta
293 %attr(755,root,root) %{_bindir}/ebook-polish
294 %attr(755,root,root) %{_bindir}/ebook-viewer
295 %attr(755,root,root) %{_bindir}/fetch-ebook-metadata
296 %attr(755,root,root) %{_bindir}/lrf2lrs
297 %attr(755,root,root) %{_bindir}/lrfviewer
298 %attr(755,root,root) %{_bindir}/lrs2lrf
299 %attr(755,root,root) %{_bindir}/markdown-calibre
300 %attr(755,root,root) %{_bindir}/web2disk
303 %{_datadir}/metainfo/calibre-ebook-edit.appdata.xml
304 %{_datadir}/metainfo/calibre-ebook-viewer.appdata.xml
305 %{_datadir}/metainfo/calibre-gui.appdata.xml
306 %{_desktopdir}/calibre-ebook-edit.desktop
307 %{_desktopdir}/calibre-ebook-viewer.desktop
308 %{_desktopdir}/calibre-gui.desktop
309 %{_desktopdir}/calibre-lrfviewer.desktop
310 %{_iconsdir}/hicolor/*x*/apps/calibre-*.png
311 %{_iconsdir}/hicolor/*x*/mimetypes/application-lrf.png
312 %{_iconsdir}/hicolor/*x*/mimetypes/application-x-kindle-application.png
313 %{_iconsdir}/hicolor/*x*/mimetypes/application-x-mobi8-ebook.png
314 %{_iconsdir}/hicolor/*x*/mimetypes/application-x-mobipocket-ebook.png
315 %{_iconsdir}/hicolor/*x*/mimetypes/application-x-topaz-ebook.png
316 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-lrf.png
317 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-x-kindle-application.png
318 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-x-mobi8-ebook.png
319 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-x-mobipocket-ebook.png
320 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-application-x-topaz-ebook.png
321 %{_iconsdir}/hicolor/*x*/mimetypes/gnome-mime-text-lrs.png
322 %{_iconsdir}/hicolor/*x*/mimetypes/text-lrs.png
323 %{_datadir}/mime/packages/calibre-mimetypes.xml
324 %{_pixmapsdir}/calibre-gui.png
325 %{_pixmapsdir}/calibre-viewer.png
327 %files -n bash-completion-calibre
328 %defattr(644,root,root,755)
329 %{bash_compdir}/calibre
331 %files -n zsh-completion-calibre
332 %defattr(644,root,root,755)
333 %{_datadir}/zsh/site-functions/_calibre