1 |
%define _disable_ld_no_undefined 1 |
2 |
|
3 |
%define rel 3 |
4 |
|
5 |
%define gsverdir 10030 |
6 |
%define gsver 10.03.0 |
7 |
%define ijsver 0.35 |
8 |
# This is the offset of the previous version. Seems like the BS |
9 |
# increases this automatically |
10 |
%define ijsreloffset 177 |
11 |
%define ijsrelno %(echo $((%{rel} + %{ijsreloffset}))) |
12 |
%define ijsrel %mkrel %{ijsrelno} |
13 |
|
14 |
%define ijsmajor 1 |
15 |
%define libijs %mklibname ijs %{ijsmajor} |
16 |
%define libijs_devel %mklibname -d ijs |
17 |
|
18 |
%define gsmajor 10 |
19 |
%define libgs %mklibname gs %{gsmajor} |
20 |
%define libgs_devel %mklibname -d gs |
21 |
|
22 |
%define bootstrap 0 |
23 |
|
24 |
%define GSx11SVGAmodule 1 |
25 |
|
26 |
Summary: PostScript/PDF interpreter and renderer (Main executable) |
27 |
Name: ghostscript |
28 |
Version: %{gsver} |
29 |
Release: %mkrel %{rel} |
30 |
License: AGPLv3+ |
31 |
Group: Publishing |
32 |
URL: https://www.ghostscript.com/ |
33 |
Source0: https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs%gsverdir/ghostscript-%gsver.tar.xz |
34 |
Source2: ps2pdfpress.bz2 |
35 |
Source3: https://www.openprinting.org/download/printing/sipixa6.upp.bz2 |
36 |
|
37 |
# Don't define static openjpeg2, breaks linking |
38 |
Patch0: ghostscript-9.51-openjpeg2-non-static.patch |
39 |
# Fix some shell scripts |
40 |
Patch1: ghostscript-scripts.patch |
41 |
# Build igcref.c with -O0 to work around bug #150771. |
42 |
Patch2: ghostscript-noopt.patch |
43 |
# Define .runlibfileifexists. |
44 |
Patch3: ghostscript-runlibfileifexists.patch |
45 |
# Restored Fontmap.local patch, incorrectly dropped after |
46 |
# ghostscript-8.15.4-3 (bug #610301). |
47 |
# Note: don't use -b here to avoid the backup file ending up in the |
48 |
# package manifest. |
49 |
Patch4: ghostscript-Fontmap.local.patch |
50 |
|
51 |
# From Deb |
52 |
Patch20: 1004_enable_spot_devices.patch |
53 |
|
54 |
# From git upstream (https://github.com/ArtifexSoftware/ghostpdl), starting from 100. |
55 |
|
56 |
|
57 |
%if !%{bootstrap} |
58 |
BuildRequires: pkgconfig(gtk+-3.0) |
59 |
BuildRequires: cups-devel |
60 |
BuildRequires: pkgconfig(fontconfig) |
61 |
%endif |
62 |
BuildRequires: bison |
63 |
BuildRequires: docbook-utils-pdf |
64 |
BuildRequires: flex |
65 |
BuildRequires: libtool |
66 |
BuildRequires: unzip |
67 |
BuildRequires: gettext-devel |
68 |
BuildRequires: glibc-devel |
69 |
BuildRequires: jbig2dec-devel >= 0.19-3 |
70 |
BuildRequires: pkgconfig(libjpeg) |
71 |
BuildRequires: libpaper-devel |
72 |
BuildRequires: netpbm-devel |
73 |
BuildRequires: pkgconfig(libtiff-4) |
74 |
BuildRequires: pkgconfig(freetype2) |
75 |
BuildRequires: pkgconfig(ice) |
76 |
BuildRequires: pkgconfig(jasper) |
77 |
BuildRequires: pkgconfig(lcms2) >= 2.5 |
78 |
BuildRequires: pkgconfig(libidn) |
79 |
BuildRequires: pkgconfig(libopenjp2) |
80 |
BuildRequires: pkgconfig(libpng) |
81 |
BuildRequires: pkgconfig(libxml-2.0) |
82 |
BuildRequires: pkgconfig(sm) |
83 |
BuildRequires: pkgconfig(x11) |
84 |
BuildRequires: pkgconfig(xext) |
85 |
BuildRequires: pkgconfig(xt) |
86 |
BuildRequires: pkgconfig(zlib) |
87 |
|
88 |
Requires: ghostscript-common |
89 |
Requires: update-alternatives |
90 |
%if !%{GSx11SVGAmodule} |
91 |
%rename ghostscript-module-X ghostscript-module-SVGALIB |
92 |
%endif |
93 |
|
94 |
%description |
95 |
Ghostscript is a set of software tools that provide a PostScript(TM) |
96 |
interpreter, a set of C procedures (the Ghostscript library, which |
97 |
implements the graphics capabilities in the PostScript language) and |
98 |
an interpreter for Portable Document Format (PDF) files. Ghostscript |
99 |
translates PostScript code into many common, bitmapped and vector |
100 |
formats, like those understood by your printer or screen. Ghostscript |
101 |
is normally used to display PostScript files and to print PostScript |
102 |
files to non-PostScript printers. |
103 |
|
104 |
You should install ghostscript if you need to display PostScript or |
105 |
PDF files, or if you have a non-PostScript printer. |
106 |
|
107 |
%package dvipdf |
108 |
Summary: PostScript/PDF interpreter and renderer (DVI-to-PDF converter) |
109 |
Group: Publishing |
110 |
Requires: ghostscript |
111 |
Requires: coreutils |
112 |
Requires: dvips |
113 |
Provides: dvipdf = %{version}-%{release} |
114 |
|
115 |
%description dvipdf |
116 |
Tool to convert the DVI format of TeX into the PDF format. There are |
117 |
more such tools (for different quality levels) in the dvipdfm |
118 |
package. All these tools use dvips of TeX to convert the DVI file to |
119 |
PostScript, then they use GhostScript to generate the PDF file. |
120 |
|
121 |
%package common |
122 |
Summary: PostScript/PDF interpreter and renderer (Common files) |
123 |
Group: Publishing |
124 |
Requires: urw-fonts >= 1.1 |
125 |
Requires: ghostscript-fonts |
126 |
|
127 |
%description common |
128 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
129 |
PostScript and PDF files to devices which include X window, many |
130 |
printer formats, and popular graphics file formats. |
131 |
|
132 |
This package contains the common data files needed by GhostScript. |
133 |
|
134 |
%package X |
135 |
Summary: PostScript/PDF interpreter and renderer (with X11 screen display) |
136 |
Group: Publishing |
137 |
Requires: ghostscript-common |
138 |
Requires: update-alternatives |
139 |
|
140 |
%description X |
141 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
142 |
PostScript and PDF files to devices which include X window, many |
143 |
printer formats, and popular graphics file formats. |
144 |
|
145 |
This package contains a GhostScript executable with GTK-based X |
146 |
display support ("display" device, default, so it displays files by |
147 |
simply entering "gs <file>" on the command line). It makes use of the |
148 |
GhostScript shared library. |
149 |
|
150 |
%if %{GSx11SVGAmodule} |
151 |
%package module-X |
152 |
Summary: PostScript/PDF interpreter and renderer (Additional support for X) |
153 |
Group: Publishing |
154 |
Requires: ghostscript-common |
155 |
|
156 |
%description module-X |
157 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
158 |
PostScript and PDF files to devices which include X window, many |
159 |
printer formats, and popular graphics file formats. |
160 |
|
161 |
This package enhances Ghostscript with X window support |
162 |
%endif |
163 |
|
164 |
%package -n %libgs |
165 |
Summary: PostScript/PDF interpreter and renderer (GhostScript shared library) |
166 |
Group: Publishing |
167 |
|
168 |
%description -n %libgs |
169 |
This is the API library for programs which use the PostScript and/or |
170 |
PDF interpreters of GhostScript. |
171 |
|
172 |
%package -n %libgs_devel |
173 |
Summary: Headers and links to compile against the "%{libgs}" library |
174 |
Group: Development/C |
175 |
Requires: %libgs >= %{gsver} |
176 |
Provides: %{name}-devel = %{gsver} |
177 |
Provides: libgs-devel = %{gsver} |
178 |
Obsoletes: %{_lib}gs9-devel < %{gsver} |
179 |
Obsoletes: %{_lib}gs8-devel < %{gsver} |
180 |
|
181 |
%description -n %libgs_devel |
182 |
This package contains the static library and the header files needed |
183 |
to compile applications using the GhostScript shared library. |
184 |
|
185 |
%package -n %{libijs} |
186 |
Version: %{ijsver} |
187 |
Release: %{ijsrel} |
188 |
Summary: Dynamic library for the IJS printer driver plug-in interface |
189 |
Group: Publishing |
190 |
URL: https://www.openprinting.org/download/ijs/ |
191 |
Provides: libijs = %{ijsver}-%{ijsrel} |
192 |
|
193 |
%description -n %{libijs} |
194 |
This is the API library for programs using the IJS printer driver |
195 |
plug-in interface. Printer drivers using this interface can be added |
196 |
to GhostScript (6.53 or newer) without needing to rebuild |
197 |
GhostScript. Application programs providing an IJS interface can make |
198 |
use of IJS printer drivers directly, without needing GhostScript. |
199 |
|
200 |
%package -n %{libijs_devel} |
201 |
Version: %{ijsver} |
202 |
Release: %{ijsrel} |
203 |
Summary: Headers and links for compiling against the "%{libijs}" library |
204 |
Group: Development/C |
205 |
URL: https://www.openprinting.org/download/ijs/ |
206 |
Requires: %{libijs} >= %{ijsver} |
207 |
Requires: multiarch-utils |
208 |
Provides: libijs-devel = %{ijsver}-%{ijsrel} |
209 |
Provides: ijs-devel = %{ijsver}-%{ijsrel} |
210 |
Obsoletes: %{_lib}ijs1-devel < %{ijsver}-%{ijsrel} |
211 |
|
212 |
%description -n %{libijs_devel} |
213 |
This package contains the static library and the header files needed |
214 |
to compile applications using the IJS library. |
215 |
|
216 |
%package doc |
217 |
Summary: Documentation for GhostScript |
218 |
Group: Publishing |
219 |
BuildArch: noarch |
220 |
|
221 |
%description doc |
222 |
This package contains documentation for GhostScript. |
223 |
|
224 |
%prep |
225 |
%setup -qn ghostscript-%gsver |
226 |
rm -rf expat freetype icclib jasper jpeg jpegxr lcms2 libpng openjpeg zlib cups/libs |
227 |
%autopatch -p1 |
228 |
|
229 |
# Don't ship backup files |
230 |
find . -name "*.*~" |xargs rm -f |
231 |
|
232 |
# Prevent building and using bundled libs |
233 |
rm -rf jasper libpng jpeg tiff expat zlib lcms* freetype |
234 |
|
235 |
# Beware that starting from ghostscript-10.0 the jbig2dec sources seems not distributed anymore as standalone |
236 |
# archive, but they are just bundled into the ghostscript sources. |
237 |
# See https://github.com/ArtifexSoftware/ghostpdl/commits/master/jbig2dec for a changelog. You should merge |
238 |
# the the changes into our jbig2dec standalone package if you want to continue to use the external jbig2dec |
239 |
# system library with ghostscript, instead of the bundled one! |
240 |
# |
241 |
# (Prevent using bundled jbig2dec) |
242 |
rm -rf jbig2dec |
243 |
|
244 |
# Stuff for shared library support to ghostscript. |
245 |
%if %{GSx11SVGAmodule} |
246 |
# build a small README describing the features available. |
247 |
cat <<EOF >README.shared.%{_vendor} |
248 |
This version of ghostscript support shared modules dynamically loaded |
249 |
at run time. |
250 |
|
251 |
There are currently two modules compiled with the %{distribution} version of |
252 |
ghostscript, one to support all X11 devices (typically used by gv) and |
253 |
another to support the svgalib devices. Look at the |
254 |
ghostscript-module-??? packages. |
255 |
|
256 |
There is no configuration needed, just can add (or remove) the package |
257 |
to add (or remove) the devices concerned in ghostscript. |
258 |
EOF |
259 |
%endif |
260 |
|
261 |
# ps2pdfpress |
262 |
bzcat %{SOURCE2} > ps2pdfpress |
263 |
|
264 |
# UPP file for SiPix Pocket Printer A6 |
265 |
bzcat %{SOURCE3} > sipixa6.upp |
266 |
|
267 |
%build |
268 |
# We have a Subversion version, so we must re-generate "configure" |
269 |
./autogen.sh |
270 |
|
271 |
%if %{GSx11SVGAmodule} |
272 |
export CFLAGS="%{optflags} -fPIC" |
273 |
%endif |
274 |
|
275 |
%configure \ |
276 |
%if %{GSx11SVGAmodule} |
277 |
--enable-dynamic \ |
278 |
--disable-hidden-visibility \ |
279 |
%endif |
280 |
%if !%{bootstrap} |
281 |
--enable-fontconfig \ |
282 |
%endif |
283 |
%ifarch %{ix86} |
284 |
--disable-sse2 \ |
285 |
%endif |
286 |
%ifarch %{arm} |
287 |
--without-tesseract \ |
288 |
%endif |
289 |
--with-drivers=ALL \ |
290 |
--with-fontpath="/usr/share/fonts/default/ghostscript:/usr/share/fonts/default/type1:/usr/share/ghostscript/fonts:/usr/share/ghostscript/%{gsver}/Resource:/usr/share/ghostscript/Resource:/usr/share/ghostscript/CIDFont:/usr/share/fonts/ttf:/usr/share/fonts/type1:/usr/share/fonts/default/Type1" \ |
291 |
--with-ijs \ |
292 |
--with-x \ |
293 |
--disable-compile-inits \ |
294 |
--with-system-libtiff \ |
295 |
|
296 |
# Build IJS |
297 |
pushd ijs |
298 |
./autogen.sh |
299 |
%configure \ |
300 |
%ifarch %{ix86} |
301 |
--disable-sse2 \ |
302 |
%endif |
303 |
--enable-shared \ |
304 |
--disable-static |
305 |
|
306 |
%make_build |
307 |
popd |
308 |
|
309 |
# Set documentation dir |
310 |
perl -p -i -e 's|^(docdir=).*$|$1\$\(datadir\)/doc/%{name}-doc-%{gsver}|' Makefile |
311 |
|
312 |
# Fix references to X11 libraries |
313 |
perl -p -i -e "s|(/usr/X11R6)/lib\b|\1/%{_lib}|g" Makefile base/*.mak |
314 |
|
315 |
# Correct paths for CJK fonts |
316 |
perl -p -i -e "s:/usr/share/ghostscript/:/usr/share/ghostscript/Resource/:g" Resource/Init/gs_res.ps |
317 |
perl -p -i -e "s:ghostscript/Resource/fonts:ghostscript/Resource/Font:g" Resource/Init/gs_res.ps |
318 |
|
319 |
# bork |
320 |
perl -p -i -e "s|^EXTRALIBS=|EXTRALIBS=-L/%{_lib} -lz |g" Makefile |
321 |
|
322 |
%if %{GSx11SVGAmodule} |
323 |
%make_build obj/X11.so |
324 |
%endif |
325 |
%make_build so |
326 |
|
327 |
%install |
328 |
# Make directories |
329 |
install -d %{buildroot}%{_bindir} |
330 |
install -d %{buildroot}%{_libdir} |
331 |
install -d %{buildroot}%{_includedir} |
332 |
install -d %{buildroot}%{_sysconfdir} |
333 |
install -d %{buildroot}%{_mandir}/man1 |
334 |
%if !%{bootstrap} |
335 |
install -d %{buildroot}%{_prefix}/lib/cups |
336 |
install -d %{buildroot}%{_datadir}/cups/model |
337 |
install -d %{buildroot}%{_sysconfdir}/cups |
338 |
%endif |
339 |
|
340 |
pushd ijs* |
341 |
%configure \ |
342 |
--enable-shared \ |
343 |
--prefix=%{buildroot}%{_prefix} \ |
344 |
--libdir=%{buildroot}%{_libdir} |
345 |
|
346 |
# Work around bug in "configure" script |
347 |
perl -p -i -e 's/\@OBJEXT\@/o/g' Makefile |
348 |
perl -p -i -e 's/\@EXEEXT\@//g' Makefile |
349 |
%makeinstall |
350 |
# Fix prefixes in scripts |
351 |
perl -p -i -e "s:%{buildroot}::g" %{buildroot}%{_libdir}/pkgconfig/ijs.pc |
352 |
popd |
353 |
|
354 |
##### GHOSTSCRIPT |
355 |
mkdir -p %{buildroot}%{_docdir}/ghostscript-doc-%{gsver} |
356 |
|
357 |
%if !%{bootstrap} |
358 |
make \ |
359 |
prefix=%{_prefix} \ |
360 |
DESTDIR=%{buildroot} \ |
361 |
gssharedir=%{_libdir}/ghostscript/%{gsver} \ |
362 |
docdir=%{_docdir}/ghostscript-doc-%{gsver} \ |
363 |
bindir=%{_bindir} \ |
364 |
mandir=%{_mandir} \ |
365 |
%endif |
366 |
|
367 |
make \ |
368 |
prefix=%{_prefix} \ |
369 |
DESTDIR=%{buildroot} \ |
370 |
gssharedir=%{_libdir}/ghostscript/%{gsver} \ |
371 |
docdir=%{_docdir}/ghostscript-doc-%{gsver} \ |
372 |
bindir=%{_bindir} \ |
373 |
libdir=%{_libdir} \ |
374 |
mandir=%{_mandir} \ |
375 |
soinstall |
376 |
|
377 |
ln -sf gs.1%{_extension} %{buildroot}%{_mandir}/man1/ghostscript.1%{_extension} |
378 |
|
379 |
# ps2pdfpress |
380 |
install -m 755 ps2pdfpress %{buildroot}%{_bindir} |
381 |
|
382 |
# UPP file for SiPix Pocket Printer A6 |
383 |
#mkdir -p %%{buildroot}%%{_datadir}/ghostscript/%%{gsver}/lib |
384 |
install -m 644 sipixa6.upp %{buildroot}%{_datadir}/ghostscript/%{gsver}/lib/ |
385 |
|
386 |
# Correct permissions for all documentation files |
387 |
chmod -R a+rX %{buildroot}%{_docdir} |
388 |
chmod -R go-w %{buildroot}%{_docdir} |
389 |
chmod -R u+w %{buildroot}%{_docdir} |
390 |
|
391 |
# remove libtool archive |
392 |
rm -f %{buildroot}%{_libdir}/libijs.la |
393 |
|
394 |
# Remove dangling link (mga#22919) |
395 |
rm -f %{buildroot}%{_datadir}/%{name}/%{gsver}/doc |
396 |
|
397 |
%post |
398 |
# Set up update-alternatives entries |
399 |
%{_sbindir}/update-alternatives --install %{_bindir}/gs gs %{_bindir}/gsc 200 |
400 |
|
401 |
%post X |
402 |
# Set up update-alternatives entries |
403 |
%{_sbindir}/update-alternatives --install %{_bindir}/gs gs %{_bindir}/gsx 100 |
404 |
|
405 |
%post common |
406 |
# Initialize japanese fonts |
407 |
if test -f /usr/share/fonts/ttf/japanese/cidinst; then |
408 |
sh /usr/share/fonts/ttf/japanese/cidinst |
409 |
fi |
410 |
|
411 |
%preun |
412 |
if [ "$1" = 0 ]; then |
413 |
# Remove update-alternatives entry |
414 |
%{_sbindir}/update-alternatives --remove gs %{_bindir}/gsc |
415 |
fi |
416 |
|
417 |
%preun X |
418 |
if [ "$1" = 0 ]; then |
419 |
# Remove update-alternatives entry |
420 |
%{_sbindir}/update-alternatives --remove gs %{_bindir}/gsx |
421 |
fi |
422 |
|
423 |
%files |
424 |
%{_bindir}/gsc |
425 |
|
426 |
%files X |
427 |
%{_bindir}/gsx |
428 |
|
429 |
%files common |
430 |
%dir %{_datadir}/ghostscript |
431 |
%{_datadir}/ghostscript/%{gsver} |
432 |
%{_mandir}/man1/* |
433 |
#{_bindir}/[a-c]* |
434 |
%{_bindir}/[e-f]* |
435 |
#{_bindir}/gs-common |
436 |
%{_bindir}/gs[a-b]* |
437 |
%{_bindir}/gs[d-n]* |
438 |
%{_bindir}/[j-l]* |
439 |
%{_bindir}/[n-z]* |
440 |
|
441 |
%files doc |
442 |
%doc %{_docdir}/ghostscript-doc-%{gsver} |
443 |
|
444 |
%files dvipdf |
445 |
%{_bindir}/dvipdf |
446 |
|
447 |
%if %{GSx11SVGAmodule} |
448 |
%files module-X |
449 |
%doc README.shared.%{_vendor} |
450 |
%dir %{_libdir}/ghostscript/%{gsver} |
451 |
%{_libdir}/ghostscript/%{gsver}/X11.so |
452 |
%endif |
453 |
|
454 |
%files -n %{libgs} |
455 |
%{_libdir}/libgs.so.*%{gsmajor}{,.*} |
456 |
|
457 |
%files -n %{libgs_devel} |
458 |
%{_libdir}/libgs.so |
459 |
%{_includedir}/ghostscript |
460 |
|
461 |
%files -n %{libijs} |
462 |
%{_libdir}/libijs-%{ijsver}.so |
463 |
|
464 |
%files -n %{libijs_devel} |
465 |
%doc ijs/README |
466 |
%{_libdir}/libijs.so |
467 |
%{_libdir}/pkgconfig/ijs.pc |
468 |
%{_includedir}/ijs |
469 |
%{_bindir}/ijs_client_example |
470 |
%{_bindir}/ijs_server_example |