2 # TODO: - rewrite generate-tarball.sh script to provide locales.zip handling (if needed)
3 # - make separate server package with init-scripts, etc...
4 # - -locales.patch needs love
7 # Upstream packages some unfree fonts which we cannot redistribute,
8 # so when upgrading calibre we should download upstream tarball by hand from
9 # http://downloads.sourceforge.net/calibre and run generate-tarball.sh script
10 # included as SourceX.
12 Summary: E-book converter and library management
13 Summary(pl.UTF-8): Konwerter oraz biblioteka dla e-booków
18 Group: Applications/Multimedia
19 Source0: %{name}-%{version}-nofonts.tar.xz
20 # Source0-md5: b2e63ecac0c28b456f17702cc984bdcd
21 Source1: generate-tarball.sh
22 Source2: %{name}-mount-helper
23 Patch0: %{name}-prefix.patch
24 Patch1: %{name}-no-update.patch
25 Patch2: %{name}-env_module.patch
26 Patch3: %{name}-locales.patch
27 Patch4: shebang-python-fix.patch
28 Patch5: imagemagick-6.8.patch
29 Patch6: qt4-private.patch
30 URL: http://www.calibre-ebook.com/
31 %define baeutifulsoup_ver 3.0.5
33 %define pyqt5_ver 5.3.1
34 %define apsw_ver 3.8.0.1
35 %define cssselect_ver 0.7.1
36 %define cssutils_ver 1:0.9.9
37 %define dateutil_ver 1.4.1
39 %define lxml_ver 2.2.1
40 %define mechanize_ver 0.1.11
41 %define netifaces_ver 0.8
42 %define psutil_ver 0.6.1
43 BuildRequires: ImageMagick-devel >= 6.6.4.7
44 BuildRequires: Qt5Core-devel
45 BuildRequires: Qt5DBus-devel
46 BuildRequires: Qt5Gui-devel
47 BuildRequires: Qt5PlatformSupport-devel
48 BuildRequires: chmlib-devel >= 0.40
49 BuildRequires: libicu-devel
50 BuildRequires: libmtp-devel >= 1.1.5
51 BuildRequires: libwmf-devel >= 0.2.8
52 BuildRequires: pkgconfig
53 BuildRequires: podofo-devel >= 0.8.2
54 BuildRequires: poppler-Qt-devel >= 0.20.2
55 BuildRequires: poppler-glib-devel >= 0.20.2
56 BuildRequires: python-BeautifulSoup >= %{baeutifulsoup_ver}
57 BuildRequires: python-PIL >= %{pil_ver}
58 BuildRequires: python-PyQt5 >= %{pyqt4_ver}
59 BuildRequires: python-PyQt5-devel >= %{pyqt4_ver}
60 BuildRequires: python-PyQt5-devel-tools >= %{pyqt4_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: rpm-pythonprov
75 BuildRequires: rpmbuild(macros) >= 1.586
76 BuildRequires: sed >= 4.0
77 BuildRequires: sqlite3-devel
78 BuildRequires: tar >= 1:1.22
80 BuildRequires: xdg-utils
81 BuildRequires: xz >= 1:4.999.7
82 Requires: python-BeautifulSoup >= %{baeutifulsoup_ver}
83 Requires: python-PIL >= %{pil_ver}
84 Requires: python-PyQt5 >= %{pyqt5_ver}
85 Requires: python-apsw >= %{apsw_ver}
86 Requires: python-cssselect >= %{cssselect_ver}
87 Requires: python-cssutils >= %{cssutils_ver}
88 Requires: python-dateutil >= %{dateutil_ver}
89 Requires: python-dns >= %{dns_ver}
90 Requires: python-genshi
91 Requires: python-lxml >= %{lxml_ver}
92 Requires: python-mechanize >= %{mechanize_ver}
93 Requires: python-modules-sqlite
94 Requires: python-netifaces >= %{netifaces_ver}
95 Requires: python-psutil >= %{psutil_ver}
96 Suggests: ImageMagick-coder-jpeg
97 Suggests: ImageMagick-coder-png
98 ### FIXME: libunrar.so is needed for rar-packed files
99 Suggests: libunrar-devel
100 Suggests: poppler-progs
101 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
104 Calibre is meant to be a complete e-library solution. It includes
105 library management, format conversion, news feeds to ebook conversion
106 as well as e-book reader sync features.
108 Calibre is primarily a ebook cataloging program. It manages your ebook
109 collection for you. It is designed around the concept of the logical
110 book, i.e. a single entry in the database that may correspond to
111 ebooks in several formats. It also supports conversion to and from a
112 dozen different ebook formats.
114 Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML,
115 CBR, CBZ, RTF, TXT, PDF and LRS.
117 %description -l pl.UTF-8
118 Calibre to bardzo dobry i darmowy program do czytania e-książek.
120 Calibre umożliwia zarówno czytanie e-książek jak i konwersję wielu
121 formatów do ich postaci. Program obsługuje następujące typy plików:
122 import: LRF, PDF, LIT, RTF, OPF, MOBI, PRC, EPUB, FB2, IMP, RB i HTML
123 eksport: Mobi, LRF i EPUB oraz do aplikacji iPhone-reader i Stanza.
125 Ten czytnik e-książek oferuje również pobieranie okładek, komiksów i
126 najnowszych wiadomości z serwisów poświęconym e-książkom. Twórcy
127 dołączyli również aplikację, którą użytkownik może wykorzystać jako
128 swój własny serwer darmowych książek.
130 %package -n bash-completion-calibre
131 Summary: bash-completion for calibre
132 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla calibre
133 Group: Applications/Shells
134 Requires: %{name} = %{version}-%{release}
135 Requires: bash-completion
136 %if "%{_rpmversion}" >= "5"
140 %description -n bash-completion-calibre
141 bash-completion for calibre.
143 %description -n bash-completion-calibre -l pl.UTF-8
144 Pakiet ten dostarcza bashowe uzupełnianie nazw dla calibre.
146 %package -n zsh-completion-calibre
147 Summary: zsh-completion for calibre
148 Summary(pl.UTF-8): uzupełnianie nazw dla calibre w powłoce zsh
149 Group: Applications/Shells
150 Requires: %{name} = %{version}-%{release}
151 Requires: bash-completion
153 %description -n zsh-completion-calibre
154 zsh-completion for calibre.
156 %description -n zsh-completion-calibre -l pl.UTF-8
157 Pakiet ten dostarcza uzupełnianie nazw dla calibre w powłoce zsh.
169 # 64bit target build fix
170 %{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
172 # upstream decides to store locale files in a single zip file but we prefer separate .mo
173 mkdir resources/localization/locales
174 unzip resources/localization/locales.zip -d resources/localization/locales
175 chmod 755 resources/localization/locales/*
176 rm -f resources/localization/locales.zip
181 OVERRIDE_CFLAGS="%{rpmcflags}" \
182 OVERRIDE_LDFLAGS="%{rpmldflags}" \
183 %{__python} setup.py build
186 rm -rf $RPM_BUILD_ROOT
187 # create directories for xdg-utils
188 install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
189 $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/usr/share/zsh/site-functions}
191 XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
192 XDG_UTILS_INSTALL_MODE="system" \
193 LIBPATH="%{_libdir}" \
194 %{__python} setup.py install \
195 --root=$RPM_BUILD_ROOT \
196 --libdir="%{_libdir}"
198 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
199 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
201 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
202 %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
203 %py_postclean %{_libdir}/%{name}
205 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
207 # set proper filenames for locales (TODO: switch to patch if possible)
208 for file in $RPM_BUILD_ROOT%{_localedir}/*; do
209 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
210 mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
211 mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
212 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
214 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
215 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
216 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
217 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
219 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
220 lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
221 mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
222 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
225 %{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
228 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ber
229 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv
230 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg
231 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en_AU
233 install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
235 %find_lang %{name} --all-name
238 rm -rf $RPM_BUILD_ROOT
241 %update_desktop_database
242 %update_mime_database
243 %update_icon_cache hicolor
246 if [ $1 -eq 0 ] ; then
247 %update_desktop_database
248 %update_mime_database
249 %update_icon_cache hicolor
252 %files -f %{name}.lang
253 %defattr(644,root,root,755)
254 %doc Changelog.yaml COPYRIGHT README.md
255 %attr(755,root,root) %{_bindir}/calibre
256 %attr(755,root,root) %{_bindir}/calibre-complete
257 %attr(755,root,root) %{_bindir}/calibre-customize
258 %attr(755,root,root) %{_bindir}/calibre-debug
259 %attr(755,root,root) %{_bindir}/calibre-mount-helper
260 %attr(755,root,root) %{_bindir}/calibre-parallel
261 %attr(755,root,root) %{_bindir}/calibre-server
262 %attr(755,root,root) %{_bindir}/calibre-smtp
263 %attr(755,root,root) %{_bindir}/calibredb
264 %attr(755,root,root) %{_bindir}/ebook-convert
265 %attr(755,root,root) %{_bindir}/ebook-device
266 %attr(755,root,root) %{_bindir}/ebook-edit
267 %attr(755,root,root) %{_bindir}/ebook-meta
268 %attr(755,root,root) %{_bindir}/ebook-polish
269 %attr(755,root,root) %{_bindir}/ebook-viewer
270 %attr(755,root,root) %{_bindir}/fetch-ebook-metadata
271 %attr(755,root,root) %{_bindir}/lrf2lrs
272 %attr(755,root,root) %{_bindir}/lrfviewer
273 %attr(755,root,root) %{_bindir}/lrs2lrf
274 %attr(755,root,root) %{_bindir}/markdown-calibre
275 %attr(755,root,root) %{_bindir}/web2disk
278 %{_desktopdir}/calibre-ebook-edit.desktop
279 %{_desktopdir}/calibre-ebook-viewer.desktop
280 %{_desktopdir}/calibre-gui.desktop
281 %{_desktopdir}/calibre-lrfviewer.desktop
282 %{_iconsdir}/hicolor/*/*/*.png
283 %{_datadir}/mime/application/*.xml
284 %{_datadir}/mime/text/*.xml
285 %{_datadir}/mime/packages/calibre-mimetypes.xml
286 %{_pixmapsdir}/%{name}-gui.png
287 %{_pixmapsdir}/calibre-viewer.png
289 %files -n bash-completion-calibre
290 %defattr(644,root,root,755)
291 %{_sysconfdir}/bash_completion.d/*
293 %files -n zsh-completion-calibre
294 %defattr(644,root,root,755)
295 %{_datadir}/zsh/site-functions/*