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 # http://downloads.sourceforge.net/calibre 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: bfd48e59aa9d650a2d305e456a857fe0
20 Source1: generate-tarball.sh
21 Source2: %{name}-mount-helper
22 Patch0: %{name}-prefix.patch
23 Patch1: %{name}-no-update.patch
24 Patch2: %{name}-env_module.patch
25 Patch3: %{name}-locales.patch
26 Patch4: shebang-python-fix.patch
27 Patch5: desktop-integration.patch
28 URL: http://www.calibre-ebook.com/
29 %define baeutifulsoup_ver 3.0.5
31 %define pyqt5_ver 5.3.1
32 %define apsw_ver 3.8.0.1
33 %define cssselect_ver 0.7.1
34 %define cssutils_ver 1:0.9.9
35 %define dateutil_ver 1.4.1
37 %define lxml_ver 2.2.1
38 %define mechanize_ver 0.1.11
39 %define netifaces_ver 0.8
40 %define psutil_ver 0.6.1
41 BuildRequires: ImageMagick-devel >= 6.6.4.7
42 BuildRequires: Qt5Core-devel
43 BuildRequires: Qt5DBus-devel
44 BuildRequires: Qt5Gui-devel
45 BuildRequires: Qt5PlatformSupport-devel
46 BuildRequires: Qt5Widgets-devel
47 BuildRequires: chmlib-devel >= 0.40
48 BuildRequires: libicu-devel
49 BuildRequires: libmtp-devel >= 1.1.5
50 BuildRequires: libwmf-devel >= 0.2.8
51 BuildRequires: mtdev-devel
52 BuildRequires: pkgconfig
53 BuildRequires: podofo-devel >= 0.8.2
54 BuildRequires: poppler-qt5-devel >= 0.28.1
55 BuildRequires: poppler-glib-devel >= 0.28.1
56 BuildRequires: python-BeautifulSoup >= %{baeutifulsoup_ver}
57 BuildRequires: python-PIL >= %{pil_ver}
58 BuildRequires: python-PyQt5 >= %{pyqt5_ver}
59 BuildRequires: python-PyQt5-devel-tools >= %{pyqt5_ver}
60 BuildRequires: python-PyQt5-uic >= %{pyqt5_ver}
61 BuildRequires: python-apsw >= %{apsw_ver}
62 BuildRequires: python-cssselect >= %{cssselect_ver}
63 BuildRequires: python-cssutils >= %{cssutils_ver}
64 BuildRequires: python-dateutil >= %{dateutil_ver}
65 BuildRequires: python-devel >= 1:2.7.1
66 BuildRequires: python-dns >= %{dns_ver}
67 BuildRequires: python-genshi
68 BuildRequires: python-lxml >= %{lxml_ver}
69 BuildRequires: python-mechanize >= %{mechanize_ver}
70 BuildRequires: python-modules-sqlite
71 BuildRequires: python-netifaces >= %{netifaces_ver}
72 BuildRequires: python-psutil >= %{psutil_ver}
73 BuildRequires: python-sip-devel
74 BuildRequires: qt5-build
75 BuildRequires: qt5-qmake
76 BuildRequires: rpm-pythonprov
77 BuildRequires: rpmbuild(macros) >= 1.586
78 BuildRequires: sed >= 4.0
79 BuildRequires: sqlite3-devel
80 BuildRequires: sip-PyQt5
81 BuildRequires: tar >= 1:1.22
83 BuildRequires: xdg-utils
84 BuildRequires: xz >= 1:4.999.7
87 Requires: python-BeautifulSoup >= %{baeutifulsoup_ver}
88 Requires: python-PIL >= %{pil_ver}
89 Requires: python-PyQt5 >= %{pyqt5_ver}
90 Requires: python-apsw >= %{apsw_ver}
91 Requires: python-cssselect >= %{cssselect_ver}
92 Requires: python-cssutils >= %{cssutils_ver}
93 Requires: python-dateutil >= %{dateutil_ver}
94 Requires: python-dns >= %{dns_ver}
95 Requires: python-genshi
96 Requires: python-lxml >= %{lxml_ver}
97 Requires: python-mechanize >= %{mechanize_ver}
98 Requires: python-modules-sqlite
99 Requires: python-netifaces >= %{netifaces_ver}
100 Requires: python-psutil >= %{psutil_ver}
101 Suggests: ImageMagick-coder-jpeg
102 Suggests: ImageMagick-coder-png
103 ### FIXME: libunrar.so is needed for rar-packed files
104 Suggests: libunrar-devel
105 Suggests: poppler-progs
106 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
109 Calibre is meant to be a complete e-library solution. It includes
110 library management, format conversion, news feeds to ebook conversion
111 as well as e-book reader sync features.
113 Calibre is primarily a ebook cataloging program. It manages your ebook
114 collection for you. It is designed around the concept of the logical
115 book, i.e. a single entry in the database that may correspond to
116 ebooks in several formats. It also supports conversion to and from a
117 dozen different ebook formats.
119 Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML,
120 CBR, CBZ, RTF, TXT, PDF and LRS.
122 %description -l pl.UTF-8
123 Calibre to bardzo dobry i darmowy program do czytania e-książek.
125 Calibre umożliwia zarówno czytanie e-książek jak i konwersję wielu
126 formatów do ich postaci. Program obsługuje następujące typy plików:
127 import: LRF, PDF, LIT, RTF, OPF, MOBI, PRC, EPUB, FB2, IMP, RB i HTML
128 eksport: Mobi, LRF i EPUB oraz do aplikacji iPhone-reader i Stanza.
130 Ten czytnik e-książek oferuje również pobieranie okładek, komiksów i
131 najnowszych wiadomości z serwisów poświęconym e-książkom. Twórcy
132 dołączyli również aplikację, którą użytkownik może wykorzystać jako
133 swój własny serwer darmowych książek.
135 %package -n bash-completion-calibre
136 Summary: bash-completion for calibre
137 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla calibre
138 Group: Applications/Shells
139 Requires: %{name} = %{version}-%{release}
140 Requires: bash-completion
141 %if "%{_rpmversion}" >= "5"
145 %description -n bash-completion-calibre
146 bash-completion for calibre.
148 %description -n bash-completion-calibre -l pl.UTF-8
149 Pakiet ten dostarcza bashowe uzupełnianie nazw dla calibre.
151 %package -n zsh-completion-calibre
152 Summary: zsh-completion for calibre
153 Summary(pl.UTF-8): uzupełnianie nazw dla calibre w powłoce zsh
154 Group: Applications/Shells
155 Requires: %{name} = %{version}-%{release}
156 Requires: bash-completion
158 %description -n zsh-completion-calibre
159 zsh-completion for calibre.
161 %description -n zsh-completion-calibre -l pl.UTF-8
162 Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh.
167 #%patch1 -p1 Patch does not apply, not removed completly since spec update is in progress
173 # 64bit target build fix
174 %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
176 # upstream decides to store locale files in a single zip file but we prefer separate .mo
177 mkdir resources/localization/locales
178 unzip resources/localization/locales.zip -d resources/localization/locales
179 chmod 755 resources/localization/locales/*
180 rm -f resources/localization/locales.zip
185 OVERRIDE_CFLAGS="%{rpmcflags}" \
186 OVERRIDE_LDFLAGS="%{rpmldflags}" \
187 QMAKE="%{_bindir}/qmake-qt5" \
188 %{__python} setup.py build
191 rm -rf $RPM_BUILD_ROOT
192 # create directories for xdg-utils
193 install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
194 $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/usr/share/zsh/site-functions}
196 XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
197 XDG_UTILS_INSTALL_MODE="system" \
198 LIBPATH="%{_libdir}" \
199 %{__python} setup.py install \
200 --root=$RPM_BUILD_ROOT \
201 --libdir="%{_libdir}"
203 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
204 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
206 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
207 %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
208 %py_postclean %{_libdir}/%{name}
210 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
212 # set proper filenames for locales (TODO: switch to patch if possible)
213 for file in $RPM_BUILD_ROOT%{_localedir}/*; do
214 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
215 mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
216 mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
217 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
219 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
220 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
221 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
222 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
224 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
225 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
226 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
227 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
229 for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.pickle; do
230 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/lcdata.pickle:\1:')
231 mv $RPM_BUILD_ROOT%{_localedir}/$lang/lcdata.pickle \
232 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_lcdata.pickle
235 %{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
238 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/bn_BD
239 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv
240 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg
241 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/sl_SI
243 install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
245 %find_lang %{name} --all-name
246 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/%{name}_lcdata.pickle; do
247 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
248 echo $file | %{__sed} "s:$RPM_BUILD_ROOT\(.*\):%lang($lang) \1:" >>%{name}.lang
252 rm -rf $RPM_BUILD_ROOT
255 %update_desktop_database
256 %update_mime_database
257 %update_icon_cache hicolor
260 if [ $1 -eq 0 ] ; then
261 %update_desktop_database
262 %update_mime_database
263 %update_icon_cache hicolor
266 %files -f %{name}.lang
267 %defattr(644,root,root,755)
268 %doc Changelog.yaml COPYRIGHT README.md
269 %attr(755,root,root) %{_bindir}/calibre
270 %attr(755,root,root) %{_bindir}/calibre-complete
271 %attr(755,root,root) %{_bindir}/calibre-customize
272 %attr(755,root,root) %{_bindir}/calibre-debug
273 %attr(755,root,root) %{_bindir}/calibre-mount-helper
274 %attr(755,root,root) %{_bindir}/calibre-parallel
275 %attr(755,root,root) %{_bindir}/calibre-server
276 %attr(755,root,root) %{_bindir}/calibre-smtp
277 %attr(755,root,root) %{_bindir}/calibredb
278 %attr(755,root,root) %{_bindir}/ebook-convert
279 %attr(755,root,root) %{_bindir}/ebook-device
280 %attr(755,root,root) %{_bindir}/ebook-edit
281 %attr(755,root,root) %{_bindir}/ebook-meta
282 %attr(755,root,root) %{_bindir}/ebook-polish
283 %attr(755,root,root) %{_bindir}/ebook-viewer
284 %attr(755,root,root) %{_bindir}/fetch-ebook-metadata
285 %attr(755,root,root) %{_bindir}/lrf2lrs
286 %attr(755,root,root) %{_bindir}/lrfviewer
287 %attr(755,root,root) %{_bindir}/lrs2lrf
288 %attr(755,root,root) %{_bindir}/markdown-calibre
289 %attr(755,root,root) %{_bindir}/web2disk
291 %{_datadir}/appdata/calibre-ebook-edit.appdata.xml
292 %{_datadir}/appdata/calibre-ebook-viewer.appdata.xml
293 %{_datadir}/appdata/calibre-gui.appdata.xml
295 %{_desktopdir}/calibre-ebook-edit.desktop
296 %{_desktopdir}/calibre-ebook-viewer.desktop
297 %{_desktopdir}/calibre-gui.desktop
298 %{_desktopdir}/calibre-lrfviewer.desktop
299 %{_iconsdir}/hicolor/*/*/*.png
300 %{_datadir}/mime/application/*.xml
301 %{_datadir}/mime/text/*.xml
302 %{_datadir}/mime/packages/calibre-mimetypes.xml
303 %{_pixmapsdir}/%{name}-gui.png
304 %{_pixmapsdir}/calibre-viewer.png
306 %files -n bash-completion-calibre
307 %defattr(644,root,root,755)
308 %{bash_compdir}/calibre
310 %files -n zsh-completion-calibre
311 %defattr(644,root,root,755)
312 %{_datadir}/zsh/site-functions/*