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 some unfree 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: 04874af0b24403457e04a7616ec4a75f
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-cssselect >= %{cssselect_ver}
66 BuildRequires: python-cssutils >= %{cssutils_ver}
67 BuildRequires: python-dateutil >= %{dateutil_ver}
68 BuildRequires: python-devel >= 1:2.7.1
69 BuildRequires: python-dns >= %{dns_ver}
70 BuildRequires: python-genshi
71 BuildRequires: python-html5-parser
72 BuildRequires: python-lxml >= %{lxml_ver}
73 BuildRequires: python-mechanize >= %{mechanize_ver}
74 BuildRequires: python-modules-sqlite
75 BuildRequires: python-msgpack
76 BuildRequires: python-netifaces >= %{netifaces_ver}
77 BuildRequires: python-psutil >= %{psutil_ver}
78 BuildRequires: python-regex
79 BuildRequires: python-sip-devel
80 BuildRequires: qt5-build
81 BuildRequires: qt5-qmake
82 BuildRequires: rpm-pythonprov
83 BuildRequires: rpmbuild(macros) >= 1.710
84 BuildRequires: sed >= 4.0
85 BuildRequires: sqlite3-devel
86 BuildRequires: sip-PyQt5
87 BuildRequires: tar >= 1:1.22
89 BuildRequires: xdg-utils
90 BuildRequires: xz >= 1:4.999.7
93 Requires: python-BeautifulSoup >= %{baeutifulsoup_ver}
94 Requires: python-PIL >= %{pil_ver}
95 Requires: python-PyQt5 >= %{pyqt5_ver}
96 Requires: python-apsw >= %{apsw_ver}
97 Requires: python-cssselect >= %{cssselect_ver}
98 Requires: python-cssutils >= %{cssutils_ver}
99 Requires: python-dateutil >= %{dateutil_ver}
100 Requires: python-dns >= %{dns_ver}
101 Requires: python-genshi
102 Requires: python-html5-parser
103 Requires: python-lxml >= %{lxml_ver}
104 Requires: python-mechanize >= %{mechanize_ver}
105 Requires: python-modules-sqlite
106 Requires: python-msgpack
107 Requires: python-netifaces >= %{netifaces_ver}
108 Requires: python-psutil >= %{psutil_ver}
109 Requires: python-regex
110 Suggests: ImageMagick-coder-jpeg
111 Suggests: ImageMagick-coder-png
112 ### FIXME: libunrar.so is needed for rar-packed files
113 Suggests: libunrar-devel
114 Suggests: poppler-progs
115 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
118 Calibre is meant to be a complete e-library solution. It includes
119 library management, format conversion, news feeds to ebook conversion
120 as well as e-book reader sync features.
122 Calibre is primarily a ebook cataloging program. It manages your ebook
123 collection for you. It is designed around the concept of the logical
124 book, i.e. a single entry in the database that may correspond to
125 ebooks in several formats. It also supports conversion to and from a
126 dozen different ebook formats.
128 Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML,
129 CBR, CBZ, RTF, TXT, PDF and LRS.
131 %description -l pl.UTF-8
132 Calibre to bardzo dobry i darmowy program do czytania e-książek.
134 Calibre umożliwia zarówno czytanie e-książek jak i konwersję wielu
135 formatów do ich postaci. Program obsługuje następujące typy plików:
136 import: LRF, PDF, LIT, RTF, OPF, MOBI, PRC, EPUB, FB2, IMP, RB i HTML
137 eksport: Mobi, LRF i EPUB oraz do aplikacji iPhone-reader i Stanza.
139 Ten czytnik e-książek oferuje również pobieranie okładek, komiksów i
140 najnowszych wiadomości z serwisów poświęconym e-książkom. Twórcy
141 dołączyli również aplikację, którą użytkownik może wykorzystać jako
142 swój własny serwer darmowych książek.
144 %package -n bash-completion-calibre
145 Summary: bash-completion for calibre
146 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla calibre
147 Group: Applications/Shells
148 Requires: %{name} = %{version}-%{release}
149 Requires: bash-completion
150 %if "%{_rpmversion}" >= "5"
154 %description -n bash-completion-calibre
155 bash-completion for calibre.
157 %description -n bash-completion-calibre -l pl.UTF-8
158 Pakiet ten dostarcza bashowe uzupełnianie nazw dla calibre.
160 %package -n zsh-completion-calibre
161 Summary: zsh-completion for calibre
162 Summary(pl.UTF-8): uzupełnianie nazw dla calibre w powłoce zsh
163 Group: Applications/Shells
164 Requires: %{name} = %{version}-%{release}
165 Requires: bash-completion
167 %description -n zsh-completion-calibre
168 zsh-completion for calibre.
170 %description -n zsh-completion-calibre -l pl.UTF-8
171 Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh.
181 # 64bit target build fix
182 %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
184 # upstream decides to store locale files in a single zip file but we prefer separate .mo
185 mkdir resources/localization/locales
186 unzip resources/localization/locales.zip -d resources/localization/locales
187 chmod 755 resources/localization/locales/*
188 rm -f resources/localization/locales.zip
193 OVERRIDE_CFLAGS="%{rpmcflags}" \
194 OVERRIDE_LDFLAGS="%{rpmldflags}" \
195 QMAKE="%{_bindir}/qmake-qt5" \
196 %{__python} setup.py build
199 rm -rf $RPM_BUILD_ROOT
200 # create directories for xdg-utils
201 install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
202 $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/usr/share/zsh/site-functions}
204 XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
205 XDG_UTILS_INSTALL_MODE="system" \
206 LIBPATH="%{_libdir}" \
207 %{__python} setup.py install \
209 --prefix=%{_prefix} \
210 --root=$RPM_BUILD_ROOT \
213 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
214 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
216 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
217 %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
218 %py_postclean %{_libdir}/%{name}
220 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
222 # set proper filenames for locales (TODO: switch to patch if possible)
223 for file in $RPM_BUILD_ROOT%{_localedir}/*; do
224 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
225 mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
226 mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
227 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
229 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
230 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
231 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
232 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
234 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
235 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
236 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
237 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
239 for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.pickle; do
240 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/lcdata.pickle:\1:')
241 mv $RPM_BUILD_ROOT%{_localedir}/$lang/lcdata.pickle \
242 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_lcdata.pickle
245 %{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
248 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/bn_BD
249 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv
250 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg
251 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/sl_SI
253 install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
255 %find_lang %{name} --all-name
256 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/%{name}_lcdata.pickle; do
257 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
258 echo $file | %{__sed} "s:$RPM_BUILD_ROOT\(.*\):%lang($lang) \1:" >>%{name}.lang
262 rm -rf $RPM_BUILD_ROOT
265 %update_desktop_database
266 %update_mime_database
267 %update_icon_cache hicolor
270 if [ $1 -eq 0 ] ; then
271 %update_desktop_database
272 %update_mime_database
273 %update_icon_cache hicolor
276 %files -f %{name}.lang
277 %defattr(644,root,root,755)
278 %doc Changelog.yaml COPYRIGHT README.md
279 %attr(755,root,root) %{_bindir}/calibre
280 %attr(755,root,root) %{_bindir}/calibre-complete
281 %attr(755,root,root) %{_bindir}/calibre-customize
282 %attr(755,root,root) %{_bindir}/calibre-debug
283 %attr(755,root,root) %{_bindir}/calibre-mount-helper
284 %attr(755,root,root) %{_bindir}/calibre-parallel
285 %attr(755,root,root) %{_bindir}/calibre-server
286 %attr(755,root,root) %{_bindir}/calibre-smtp
287 %attr(755,root,root) %{_bindir}/calibredb
288 %attr(755,root,root) %{_bindir}/ebook-convert
289 %attr(755,root,root) %{_bindir}/ebook-device
290 %attr(755,root,root) %{_bindir}/ebook-edit
291 %attr(755,root,root) %{_bindir}/ebook-meta
292 %attr(755,root,root) %{_bindir}/ebook-polish
293 %attr(755,root,root) %{_bindir}/ebook-viewer
294 %attr(755,root,root) %{_bindir}/fetch-ebook-metadata
295 %attr(755,root,root) %{_bindir}/lrf2lrs
296 %attr(755,root,root) %{_bindir}/lrfviewer
297 %attr(755,root,root) %{_bindir}/lrs2lrf
298 %attr(755,root,root) %{_bindir}/markdown-calibre
299 %attr(755,root,root) %{_bindir}/web2disk
301 %{_datadir}/metainfo/calibre-ebook-edit.appdata.xml
302 %{_datadir}/metainfo/calibre-ebook-viewer.appdata.xml
303 %{_datadir}/metainfo/calibre-gui.appdata.xml
305 %{_desktopdir}/calibre-ebook-edit.desktop
306 %{_desktopdir}/calibre-ebook-viewer.desktop
307 %{_desktopdir}/calibre-gui.desktop
308 %{_desktopdir}/calibre-lrfviewer.desktop
309 %{_iconsdir}/hicolor/*/*/*.png
310 %{_datadir}/mime/application/*.xml
311 %{_datadir}/mime/text/*.xml
312 %{_datadir}/mime/packages/calibre-mimetypes.xml
313 %{_pixmapsdir}/%{name}-gui.png
314 %{_pixmapsdir}/calibre-viewer.png
316 %files -n bash-completion-calibre
317 %defattr(644,root,root,755)
318 %{bash_compdir}/calibre
320 %files -n zsh-completion-calibre
321 %defattr(644,root,root,755)
322 %{_datadir}/zsh/site-functions/*