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