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