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