]> git.pld-linux.org Git - packages/calibre.git/blob - calibre.spec
- up to 3.23.0
[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 some unfree 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:        3.23.0
15 Release:        1
16 License:        GPL v3+
17 Group:          Applications/Multimedia
18 Source0:        %{name}-%{version}-nofonts.tar.xz
19 # Source0-md5:  a723c37703e72fdff6a365e762829191
20 Source1:        generate-tarball.sh
21 Source2:        %{name}-mount-helper
22 Patch0:         %{name}-prefix.patch
23 Patch1:         %{name}-env_module.patch
24 Patch2:         %{name}-locales.patch
25 Patch3:         shebang-python-fix.patch
26 Patch4:         desktop-integration.patch
27 URL:            http://www.calibre-ebook.com/
28 %define         baeutifulsoup_ver 3.0.5
29 %define         pil_ver 1.1.6
30 %define         pyqt5_ver 5.3.1
31 %define         apsw_ver 3.8.0.1
32 %define         cssselect_ver 0.7.1
33 %define         cssutils_ver 1:0.9.9
34 %define         dateutil_ver 1.4.1
35 %define         dns_ver 1.6.0
36 %define         lxml_ver 2.2.1
37 %define         mechanize_ver 0.1.11
38 %define         netifaces_ver 0.8
39 %define         psutil_ver 0.6.1
40 BuildRequires:  ImageMagick-devel >= 6.6.4.7
41 BuildRequires:  Qt5Core-devel
42 BuildRequires:  Qt5DBus-devel
43 BuildRequires:  Qt5EventDispatcherSupport-devel
44 BuildRequires:  Qt5FontDatabaseSupport-devel
45 BuildRequires:  Qt5Gui-devel
46 BuildRequires:  Qt5ServiceSupport-devel
47 BuildRequires:  Qt5ThemeSupport-devel
48 BuildRequires:  Qt5Widgets-devel
49 BuildRequires:  chmlib-devel >= 0.40
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-qt5-devel >= 0.28.1
58 BuildRequires:  poppler-glib-devel >= 0.28.1
59 BuildRequires:  python-BeautifulSoup >= %{baeutifulsoup_ver}
60 BuildRequires:  python-PIL >= %{pil_ver}
61 BuildRequires:  python-PyQt5 >= %{pyqt5_ver}
62 BuildRequires:  python-PyQt5-devel-tools >= %{pyqt5_ver}
63 BuildRequires:  python-PyQt5-uic >= %{pyqt5_ver}
64 BuildRequires:  python-apsw >= %{apsw_ver}
65 BuildRequires:  python-cssselect >= %{cssselect_ver}
66 BuildRequires:  python-cssutils >= %{cssutils_ver}
67 BuildRequires:  python-dateutil >= %{dateutil_ver}
68 BuildRequires:  python-devel >= 1:2.7.1
69 BuildRequires:  python-dns >= %{dns_ver}
70 BuildRequires:  python-genshi
71 BuildRequires:  python-html5-parser
72 BuildRequires:  python-lxml >= %{lxml_ver}
73 BuildRequires:  python-mechanize >= %{mechanize_ver}
74 BuildRequires:  python-modules-sqlite
75 BuildRequires:  python-msgpack
76 BuildRequires:  python-netifaces >= %{netifaces_ver}
77 BuildRequires:  python-psutil >= %{psutil_ver}
78 BuildRequires:  python-regex
79 BuildRequires:  python-sip-devel
80 BuildRequires:  qt5-build
81 BuildRequires:  qt5-qmake
82 BuildRequires:  rpm-pythonprov
83 BuildRequires:  rpmbuild(macros) >= 1.710
84 BuildRequires:  sed >= 4.0
85 BuildRequires:  sqlite3-devel
86 BuildRequires:  sip-PyQt5
87 BuildRequires:  tar >= 1:1.22
88 BuildRequires:  unzip
89 BuildRequires:  xdg-utils
90 BuildRequires:  xz >= 1:4.999.7
91 Requires:       Qt5Svg
92 Requires:       Qt5WebKit
93 Requires:       python-BeautifulSoup >= %{baeutifulsoup_ver}
94 Requires:       python-PIL >= %{pil_ver}
95 Requires:       python-PyQt5 >= %{pyqt5_ver}
96 Requires:       python-apsw >= %{apsw_ver}
97 Requires:       python-cssselect >= %{cssselect_ver}
98 Requires:       python-cssutils >= %{cssutils_ver}
99 Requires:       python-dateutil >= %{dateutil_ver}
100 Requires:       python-dns >= %{dns_ver}
101 Requires:       python-genshi
102 Requires:       python-html5-parser
103 Requires:       python-lxml >= %{lxml_ver}
104 Requires:       python-mechanize >= %{mechanize_ver}
105 Requires:       python-modules-sqlite
106 Requires:       python-msgpack
107 Requires:       python-netifaces >= %{netifaces_ver}
108 Requires:       python-psutil >= %{psutil_ver}
109 Requires:       python-regex
110 Suggests:       ImageMagick-coder-jpeg
111 Suggests:       ImageMagick-coder-png
112 ### FIXME: libunrar.so is needed for rar-packed files
113 Suggests:       libunrar-devel
114 Suggests:       poppler-progs
115 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
116
117 %description
118 Calibre is meant to be a complete e-library solution. It includes
119 library management, format conversion, news feeds to ebook conversion
120 as well as e-book reader sync features.
121
122 Calibre is primarily a ebook cataloging program. It manages your ebook
123 collection for you. It is designed around the concept of the logical
124 book, i.e. a single entry in the database that may correspond to
125 ebooks in several formats. It also supports conversion to and from a
126 dozen different ebook formats.
127
128 Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML,
129 CBR, CBZ, RTF, TXT, PDF and LRS.
130
131 %description -l pl.UTF-8
132 Calibre to bardzo dobry i darmowy program do czytania e-książek.
133
134 Calibre umożliwia zarówno czytanie e-książek jak i konwersję wielu
135 formatów do ich postaci. Program obsługuje następujące typy plików:
136 import: LRF, PDF, LIT, RTF, OPF, MOBI, PRC, EPUB, FB2, IMP, RB i HTML
137 eksport: Mobi, LRF i EPUB oraz do aplikacji iPhone-reader i Stanza.
138
139 Ten czytnik e-książek oferuje również pobieranie okładek, komiksów i
140 najnowszych wiadomości z serwisów poświęconym e-książkom. Twórcy
141 dołączyli również aplikację, którą użytkownik może wykorzystać jako
142 swój własny serwer darmowych książek.
143
144 %package -n bash-completion-calibre
145 Summary:        bash-completion for calibre
146 Summary(pl.UTF-8):      bashowe uzupełnianie nazw dla calibre
147 Group:          Applications/Shells
148 Requires:       %{name} = %{version}-%{release}
149 Requires:       bash-completion
150 %if "%{_rpmversion}" >= "5"
151 BuildArch:      noarch
152 %endif
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-qt5" \
196 %{__python} 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},/usr/share/zsh/site-functions}
203
204 XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
205 XDG_UTILS_INSTALL_MODE="system" \
206 LIBPATH="%{_libdir}" \
207 %{__python} setup.py install \
208         --no-compile \
209         --prefix=%{_prefix} \
210         --root=$RPM_BUILD_ROOT \
211         --libdir=%{_libdir}
212
213 cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
214 cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
215
216 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
217 %py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
218 %py_postclean %{_libdir}/%{name}
219
220 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
221
222 # set proper filenames for locales (TODO: switch to patch if possible)
223 for file in $RPM_BUILD_ROOT%{_localedir}/*; do
224         lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
225         mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
226         mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
227                 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
228 done;
229 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
230         lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
231         mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
232                 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
233 done;
234 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
235         lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
236         mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
237                 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
238 done;
239 for file in $RPM_BUILD_ROOT%{_localedir}/*/lcdata.pickle; do
240         lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/lcdata.pickle:\1:')
241         mv $RPM_BUILD_ROOT%{_localedir}/$lang/lcdata.pickle \
242                 $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_lcdata.pickle
243 done;
244
245 %{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
246
247 # unsupported
248 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/bn_BD
249 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv
250 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg
251 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/sl_SI
252
253 install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
254
255 %find_lang %{name} --all-name
256 for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/%{name}_lcdata.pickle; do
257         lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\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.yaml 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 %{_datadir}/%{name}
301 %{_datadir}/metainfo/calibre-ebook-edit.appdata.xml
302 %{_datadir}/metainfo/calibre-ebook-viewer.appdata.xml
303 %{_datadir}/metainfo/calibre-gui.appdata.xml
304 %{_libdir}/%{name}
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/*/*/*.png
310 %{_datadir}/mime/application/*.xml
311 %{_datadir}/mime/text/*.xml
312 %{_datadir}/mime/packages/calibre-mimetypes.xml
313 %{_pixmapsdir}/%{name}-gui.png
314 %{_pixmapsdir}/calibre-viewer.png
315
316 %files -n bash-completion-calibre
317 %defattr(644,root,root,755)
318 %{bash_compdir}/calibre
319
320 %files -n zsh-completion-calibre
321 %defattr(644,root,root,755)
322 %{_datadir}/zsh/site-functions/*
This page took 0.082177 seconds and 3 git commands to generate.