1 |
%define name calibre |
2 |
%define version 0.8.17 |
3 |
%define release %mkrel 2 |
4 |
|
5 |
Name: %{name} |
6 |
Version: %{version} |
7 |
Release: %{release} |
8 |
Summary: E-book converter and library management |
9 |
Group: Text tools |
10 |
License: GPLv3 |
11 |
URL: http://calibre-ebook.com/ |
12 |
Source0: http://calibre-ebook.googlecode.com/files/%{name}-%{version}.tar.xz |
13 |
Source2: calibre-mount-helper |
14 |
Patch0: %{name}-manpages.patch |
15 |
Patch1: %{name}-no-update-0.8.6.patch |
16 |
Patch2: %{name}-0.7.38-pyPdf-fix.patch |
17 |
Patch3: %{name}-0.7.27-python-fix.patch |
18 |
Patch4: %{name}-python2-env-fix.patch |
19 |
Patch5: %{name}-web-control.patch |
20 |
|
21 |
BuildRequires: python >= 2.6 |
22 |
BuildRequires: python-devel >= 2.6 |
23 |
BuildRequires: imagemagick-devel |
24 |
BuildRequires: python-setuptools |
25 |
BuildRequires: qt4-devel |
26 |
BuildRequires: python-qt4-devel |
27 |
BuildRequires: pkgconfig(poppler-qt4) >= 0.12 |
28 |
BuildRequires: podofo-devel |
29 |
BuildRequires: desktop-file-utils |
30 |
BuildRequires: python-mechanize |
31 |
BuildRequires: python-lxml |
32 |
BuildRequires: python-dateutil |
33 |
BuildRequires: python-imaging |
34 |
BuildRequires: xdg-utils |
35 |
BuildRequires: python-beautifulsoup |
36 |
BuildRequires: chmlib-devel |
37 |
BuildRequires: python-cssutils >= 0.9.6 |
38 |
BuildRequires: sqlite-devel |
39 |
BuildRequires: libicu-devel |
40 |
BuildRequires: unzip |
41 |
BuildRequires: libwmf-devel |
42 |
|
43 |
Requires: python-qt4 |
44 |
Requires: python-pypdf |
45 |
Requires: python-cherrypy |
46 |
Requires: python-cssutils |
47 |
Requires: ImageMagick |
48 |
Requires: python-odf |
49 |
Requires: python-django-tagging |
50 |
Requires: python-lxml |
51 |
Requires: python-imaging |
52 |
Requires: python-mechanize |
53 |
Requires: python-dateutil |
54 |
Requires: python-genshi |
55 |
Requires: python-beautifulsoup |
56 |
# Require the packages of the files which are symlinked by calibre |
57 |
Requires: fonts-ttf-liberation |
58 |
# E-mail functionality requires this package |
59 |
# see https://bugs.launchpad.net/calibre/+bug/739073 |
60 |
Requires: python-dnspython |
61 |
|
62 |
|
63 |
%description |
64 |
Calibre is meant to be a complete e-library solution. It includes library |
65 |
management, format conversion, news feeds to ebook conversion as well as |
66 |
e-book reader sync features. |
67 |
|
68 |
Calibre is primarily a ebook cataloging program. It manages your ebook |
69 |
collection for you. It is designed around the concept of the logical book, |
70 |
i.e. a single entry in the database that may correspond to ebooks in several |
71 |
formats. It also supports conversion to and from a dozen different ebook |
72 |
formats. |
73 |
|
74 |
Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML, CBR, CBZ, |
75 |
RTF, TXT, PDF and LRS. |
76 |
|
77 |
%files -f %{name}.lang |
78 |
%doc COPYRIGHT LICENSE Changelog.yaml |
79 |
%{_bindir}/calibre |
80 |
%{_bindir}/calibre-complete |
81 |
%{_bindir}/calibre-customize |
82 |
%{_bindir}/calibre-debug |
83 |
%{_bindir}/calibre-parallel |
84 |
%{_bindir}/calibre-server |
85 |
%{_bindir}/calibre-smtp |
86 |
%{_bindir}/calibre-mount-helper |
87 |
%{_bindir}/calibredb |
88 |
%{_bindir}/ebook-convert |
89 |
%{_bindir}/ebook-device |
90 |
%{_bindir}/ebook-meta |
91 |
%{_bindir}/ebook-viewer |
92 |
%{_bindir}/epub-fix |
93 |
%{_bindir}/fetch-ebook-metadata |
94 |
%{_bindir}/lrf2lrs |
95 |
%{_bindir}/lrfviewer |
96 |
%{_bindir}/lrs2lrf |
97 |
%{_bindir}/markdown-calibre |
98 |
%{_bindir}/pdfmanipulate |
99 |
%{_bindir}/web2disk |
100 |
%config(noreplace) %{_sysconfdir}/bash_completion.d/%{name} |
101 |
%{_libdir}/%{name} |
102 |
%{_datadir}/%{name} |
103 |
%{_datadir}/pixmaps/* |
104 |
%{_datadir}/applications/*.desktop |
105 |
%{_datadir}/mime/packages/* |
106 |
%{_datadir}/icons/hicolor/scalable/mimetypes/* |
107 |
%{_datadir}/icons/hicolor/scalable/apps/* |
108 |
%{python_sitelib}/init_calibre.py* |
109 |
%{_mandir}/man1/* |
110 |
|
111 |
|
112 |
#-------------------------------------------------------------------- |
113 |
|
114 |
%prep |
115 |
%setup -q -n %{name} |
116 |
|
117 |
# remove redundant / non-free fonts |
118 |
rm -rf resources/fonts/* |
119 |
|
120 |
# don't append calibre1 to the name of the manpages. No need to compress either |
121 |
# upstream won't fix: http://oldbugs.calibre-ebook.com/ticket/3770#comment:7 |
122 |
%patch0 -p1 -b .manpages |
123 |
|
124 |
# don't check for new upstream version (that's what packagers do) |
125 |
# otherwise the plugins are safe to be updated in ~/.config/calibre/plugins/ |
126 |
%patch1 -F 2 -p1 -b .no-update |
127 |
|
128 |
# fix crash on pdf export |
129 |
# https://bugzilla.redhat.com/show_bug.cgi?id=673604 |
130 |
# (use the correct API for the external pyPdf library) |
131 |
%patch2 -p1 -b .pdf-export-fix |
132 |
|
133 |
# libs |
134 |
%patch3 -p1 -b .python-fix |
135 |
|
136 |
# there is no python2 symlink to python2.7 |
137 |
# but just python, as opposed to python3 |
138 |
%patch4 -p1 -b .python2-env-fix |
139 |
|
140 |
# import from QtNetwork, not Qt |
141 |
%patch5 -p1 -b .python-web-control |
142 |
|
143 |
# 0.8.6 was rushed in and reports to be 0.8.5 in the sources |
144 |
# REMOVE THIS IN FUTURE VERSIONS! |
145 |
%{__sed} -i -e 's/numeric_version = (0, 8, 5)/numeric_version = (0, 8, 6)/' src/calibre/constants.py |
146 |
|
147 |
# dos2unix newline conversion |
148 |
%{__sed} -i -e 's/\r//' src/calibre/web/feeds/recipes/* |
149 |
|
150 |
# fix the location of liberation default font |
151 |
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \ |
152 |
src/calibre/library/catalog.py |
153 |
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \ |
154 |
src/calibre/utils/magick/draw.py |
155 |
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \ |
156 |
src/calibre/web/feeds/news.py |
157 |
%{__sed} -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \ |
158 |
recipes/*_ke.recipe |
159 |
|
160 |
# remove shebangs |
161 |
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*/*.py |
162 |
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*/*/*.py |
163 |
%{__sed} -i -e '/^#![ ]*\//, 1d' src/calibre/*/*.py |
164 |
%{__sed} -i -e '/^#!\//, 1d' src/calibre/*.py |
165 |
%{__sed} -i -e '/^#!\//, 1d' src/templite/*.py |
166 |
%{__sed} -i -e '/^#!\//, 1d' resources/default_tweaks.py |
167 |
%{__sed} -i -e '/^#!\//, 1d' recipes/*.recipe |
168 |
|
169 |
%{__chmod} -x src/calibre/*/*/*/*.py |
170 |
%{__chmod} -x src/calibre/*/*/*.py |
171 |
%{__chmod} -x src/calibre/*/*.py |
172 |
%{__chmod} -x src/calibre/*.py |
173 |
%{__chmod} -x recipes/*.recipe |
174 |
|
175 |
%build |
176 |
OVERRIDE_CFLAGS="%{optflags}" python setup.py build |
177 |
|
178 |
%install |
179 |
mkdir -p %{buildroot}%{_datadir} |
180 |
|
181 |
# create directories for xdg-utils |
182 |
mkdir -p %{buildroot}%{_datadir}/icons |
183 |
mkdir -p %{buildroot}%{_datadir}/icons/hicolor |
184 |
mkdir -p %{buildroot}%{_datadir}/packages |
185 |
mkdir -p %{buildroot}%{_datadir}/mime |
186 |
mkdir -p %{buildroot}%{_datadir}/mime/packages |
187 |
mkdir -p %{buildroot}%{_datadir}/applications |
188 |
mkdir -p %{buildroot}%{_datadir}/desktop-directories |
189 |
|
190 |
# create directory for calibre environment module |
191 |
# the install script assumes it's there. |
192 |
mkdir -p %{buildroot}%{python_sitelib} |
193 |
|
194 |
XDG_DATA_DIRS="%{buildroot}%{_datadir}" \ |
195 |
XDG_UTILS_INSTALL_MODE="system" \ |
196 |
LIBPATH="%{_libdir}" \ |
197 |
python setup.py install --root=%{buildroot}%{_prefix} \ |
198 |
--prefix=%{_prefix} \ |
199 |
--libdir=%{_libdir} \ |
200 |
--staging-libdir=%{buildroot}%{_libdir} \ |
201 |
# remove shebang from init_calibre.py here because |
202 |
# it just got spawned by the install script |
203 |
%{__sed} -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/init_calibre.py |
204 |
|
205 |
# icons |
206 |
mkdir -p %{buildroot}%{_datadir}/pixmaps/ |
207 |
cp -p resources/images/library.png \ |
208 |
%{buildroot}%{_datadir}/pixmaps/%{name}-gui.png |
209 |
cp -p resources/images/viewer.png \ |
210 |
%{buildroot}%{_datadir}/pixmaps/calibre-viewer.png |
211 |
|
212 |
# every file is empty here |
213 |
find %{buildroot}%{_datadir}/mime -maxdepth 1 -type f|xargs rm -f |
214 |
|
215 |
# the portable batch (>=0.8.5) is not needed |
216 |
rm -f %{buildroot}%{_bindir}/calibre-portable.bat |
217 |
|
218 |
# packages aren't allowed to register mimetypes like this |
219 |
rm -f %{buildroot}%{_datadir}/applications/defaults.list |
220 |
rm -f %{buildroot}%{_datadir}/applications/mimeinfo.cache |
221 |
|
222 |
desktop-file-validate \ |
223 |
%{buildroot}%{_datadir}/applications/calibre-ebook-viewer.desktop |
224 |
desktop-file-validate \ |
225 |
%{buildroot}%{_datadir}/applications/calibre-gui.desktop |
226 |
desktop-file-validate \ |
227 |
%{buildroot}%{_datadir}/applications/calibre-lrfviewer.desktop |
228 |
|
229 |
|
230 |
mv %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes \ |
231 |
%{buildroot}%{_datadir}/mime/packages/calibre-mimetypes.xml |
232 |
|
233 |
# mimetype icon for lrf |
234 |
rm -rf %{buildroot}%{_datadir}/icons/hicolor/128x128 |
235 |
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable |
236 |
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes |
237 |
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps |
238 |
cp -p resources/images/mimetypes/lrf.png \ |
239 |
%{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-sony-bbeb.png |
240 |
cp -p resources/images/viewer.png \ |
241 |
%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/calibre-viewer.png |
242 |
|
243 |
# don't put bash completions in /usr/etc |
244 |
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d |
245 |
mv %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d |
246 |
rmdir %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d |
247 |
|
248 |
# these are provided as separate packages |
249 |
rm -rf %{buildroot}%{_libdir}/%{name}/{odf,cherrypy,pyPdf,encutils,cssutils} |
250 |
rm -rf %{buildroot}%{_libdir}/%{name}/cal/utils/genshi |
251 |
rm -rf %{buildroot}%{_libdir}/%{name}/cal/trac |
252 |
|
253 |
# link to system fonts after we have deleted the non-free ones |
254 |
# http://oldbugs.calibre-ebook.com/ticket/3832 |
255 |
mkdir -p %{buildroot}%{_datadir}/%{name}/fonts/prs500 |
256 |
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSans-Regular.ttf \ |
257 |
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0003m_.ttf |
258 |
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSerif-Regular.ttf \ |
259 |
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0011m_.ttf |
260 |
ln -s %{_datadir}/fonts/TTF/liberation/LiberationMono-Regular.ttf \ |
261 |
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0419m_.ttf |
262 |
|
263 |
# man pages |
264 |
mkdir -p %{buildroot}%{_mandir}/man1 |
265 |
cp %{buildroot}%{_datadir}/%{name}/man/man1/* %{buildroot}%{_mandir}/man1 |
266 |
|
267 |
# localization has changed since calibre-0.8.5 |
268 |
# locale.zip is treated internally at runtime |
269 |
# so the traditional locale fixes are moot. |
270 |
# locales should still be looked for in the proper place |
271 |
# but under the new localization zip-based schema |
272 |
%{__sed} -i -e 's:localization/locale.zip:%{_datadir}/%{name}/localization/locales.zip:' %{buildroot}%{_libdir}/%{name}/%{name}/utils/localization.py |
273 |
|
274 |
%find_lang %{name} --with-kde --all-name |
275 |
|
276 |
%{__rm} -f %{buildroot}%{_bindir}/%{name}-uninstall |
277 |
|
278 |
cp -a %{SOURCE2} %{buildroot}%{_bindir}/ |
279 |
|