1 |
%define _disable_ld_no_undefined 1 |
2 |
%define rel 11 |
3 |
|
4 |
%define gsver 9.07 |
5 |
%define ijsver 0.35 |
6 |
%define ijsreloffset 86 |
7 |
%define ijsrelno %(echo $((%{rel} + %{ijsreloffset}))) |
8 |
%define ijsrel %mkrel %{ijsrelno} |
9 |
|
10 |
%define ijsmajor 1 |
11 |
%define libijs %mklibname ijs %{ijsmajor} |
12 |
%define libijs_devel %mklibname -d ijs |
13 |
|
14 |
%define gsmajor 9 |
15 |
%define libgs %mklibname gs %{gsmajor} |
16 |
%define libgs_devel %mklibname -d gs |
17 |
|
18 |
%define bootstrap 0 |
19 |
|
20 |
%define GSx11SVGAmodule 1 |
21 |
%define withcupsfilters 1 |
22 |
%define debug 0 |
23 |
%if %{bootstrap} |
24 |
%global withcupsfilters 0 |
25 |
%endif |
26 |
|
27 |
Summary: PostScript/PDF interpreter and renderer (Main executable) |
28 |
Name: ghostscript |
29 |
Version: %{gsver} |
30 |
Release: %mkrel %{rel} |
31 |
License: AGPLv3+ |
32 |
Group: Publishing |
33 |
URL: http://www.ghostscript.com/awki/Index |
34 |
Source0: http://downloads.ghostscript.com/public/ghostscript-%{gsver}.tar.gz |
35 |
Source2: ps2pdfpress.bz2 |
36 |
Source3: http://www.linuxprinting.org/download/printing/sipixa6.upp.bz2 |
37 |
|
38 |
# Fedora patches |
39 |
# Fix ijs-config not to have multilib conflicts (bug #192672) |
40 |
Patch1: ghostscript-multilib.patch |
41 |
# Fix some shell scripts |
42 |
Patch2: ghostscript-scripts.patch |
43 |
# Build igcref.c with -O0 to work around bug #150771. |
44 |
Patch3: ghostscript-noopt.patch |
45 |
# Define .runlibfileifexists. |
46 |
Patch5: ghostscript-runlibfileifexists.patch |
47 |
# Fixed missing error check when setting ICC profile. |
48 |
Patch6: ghostscript-icc-missing-check.patch |
49 |
# Install CUPS filter convs files in the correct place. |
50 |
Patch10: ghostscript-cups-filters.patch |
51 |
# Restored Fontmap.local patch, incorrectly dropped after |
52 |
# ghostscript-8.15.4-3 (bug #610301). |
53 |
# Note: don't use -b here to avoid the backup file ending up in the |
54 |
# package manifest. |
55 |
Patch27: ghostscript-Fontmap.local.patch |
56 |
# Don't assume %%rom%% device is available for initial ICC profile dir. |
57 |
Patch28: ghostscript-iccprofiles-initdir.patch |
58 |
# gdevcups: don't use uninitialized variables in debugging output. |
59 |
Patch29: ghostscript-gdevcups-debug-uninit.patch |
60 |
|
61 |
Patch100: 0001-Fix-hang-in-gstoraster-if-gs-fails-bug-693336.patch |
62 |
|
63 |
Patch200: ghostscript-9.06-CVE-2012-4405.diff |
64 |
|
65 |
Patch300: ghostscript-9.05-x11_shared.diff |
66 |
Patch301: ghostscript-9.06-automake-1.13.patch |
67 |
|
68 |
%if !%{bootstrap} |
69 |
BuildRequires: gtk+3-devel |
70 |
BuildRequires: cups-devel |
71 |
BuildRequires: fontconfig-devel |
72 |
%endif |
73 |
BuildRequires: bison |
74 |
BuildRequires: flex |
75 |
BuildRequires: libtool |
76 |
BuildRequires: unzip |
77 |
BuildRequires: gettext-devel |
78 |
BuildRequires: glibc-devel |
79 |
BuildRequires: jbig2dec-devel |
80 |
BuildRequires: jpeg-devel |
81 |
BuildRequires: libpaper-devel |
82 |
BuildRequires: netpbm-devel |
83 |
BuildRequires: tiff-devel |
84 |
BuildRequires: pkgconfig(freetype2) |
85 |
BuildRequires: pkgconfig(ice) |
86 |
BuildRequires: pkgconfig(jasper) |
87 |
BuildRequires: pkgconfig(lcms2) |
88 |
BuildRequires: pkgconfig(libidn) |
89 |
BuildRequires: pkgconfig(libpng) |
90 |
BuildRequires: pkgconfig(libxml-2.0) |
91 |
BuildRequires: pkgconfig(sm) |
92 |
BuildRequires: pkgconfig(x11) |
93 |
BuildRequires: pkgconfig(xext) |
94 |
BuildRequires: pkgconfig(xt) |
95 |
BuildRequires: pkgconfig(zlib) |
96 |
|
97 |
Requires: ghostscript-common |
98 |
Requires: update-alternatives |
99 |
%if !%{GSx11SVGAmodule} |
100 |
%rename ghostscript-module-X ghostscript-module-SVGALIB |
101 |
%endif |
102 |
|
103 |
%description |
104 |
Ghostscript is a set of software tools that provide a PostScript(TM) |
105 |
interpreter, a set of C procedures (the Ghostscript library, which |
106 |
implements the graphics capabilities in the PostScript language) and |
107 |
an interpreter for Portable Document Format (PDF) files. Ghostscript |
108 |
translates PostScript code into many common, bitmapped and vector |
109 |
formats, like those understood by your printer or screen. Ghostscript |
110 |
is normally used to display PostScript files and to print PostScript |
111 |
files to non-PostScript printers. |
112 |
|
113 |
You should install ghostscript if you need to display PostScript or |
114 |
PDF files, or if you have a non-PostScript printer. |
115 |
|
116 |
%package dvipdf |
117 |
Summary: PostScript/PDF interpreter and renderer (DVI-to-PDF converter) |
118 |
Group: Publishing |
119 |
Requires: ghostscript |
120 |
Requires: coreutils |
121 |
Requires: dvips |
122 |
Provides: dvipdf = %{version}-%{release} |
123 |
|
124 |
%description dvipdf |
125 |
Tool to convert the DVI format of TeX into the PDF format. There are |
126 |
more such tools (for different quality levels) in the dvipdfm |
127 |
package. All these tools use dvips of TeX to convert the DVI file to |
128 |
PostScript, then they use GhostScript to generate the PDF file. |
129 |
|
130 |
%package common |
131 |
Summary: PostScript/PDF interpreter and renderer (Common files) |
132 |
Group: Publishing |
133 |
Requires: urw-fonts >= 1.1 |
134 |
Requires: ghostscript-fonts |
135 |
|
136 |
%description common |
137 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
138 |
PostScript and PDF files to devices which include X window, many |
139 |
printer formats, and popular graphics file formats. |
140 |
|
141 |
This package contains the common data files needed by GhostScript. |
142 |
|
143 |
%package X |
144 |
Summary: PostScript/PDF interpreter and renderer (with X11 screen display) |
145 |
Group: Publishing |
146 |
Requires: ghostscript-common |
147 |
Requires: update-alternatives |
148 |
|
149 |
%description X |
150 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
151 |
PostScript and PDF files to devices which include X window, many |
152 |
printer formats, and popular graphics file formats. |
153 |
|
154 |
This package contains a GhostScript executable with GTK-based X |
155 |
display support ("display" device, default, so it displays files by |
156 |
simply entering "gs <file>" on the command line). It makes use of the |
157 |
GhostScript shared library. |
158 |
|
159 |
%if %{GSx11SVGAmodule} |
160 |
%package module-X |
161 |
Summary: PostScript/PDF interpreter and renderer (Additional support for X) |
162 |
Group: Publishing |
163 |
Requires: ghostscript-common |
164 |
|
165 |
%description module-X |
166 |
Ghostscript is a PostScript/PDF interpreter. It can render both |
167 |
PostScript and PDF files to devices which include X window, many |
168 |
printer formats, and popular graphics file formats. |
169 |
|
170 |
This package enhances Ghostscript with X window support |
171 |
%endif |
172 |
|
173 |
%package -n %libgs |
174 |
Summary: PostScript/PDF interpreter and renderer (GhostScript shared library) |
175 |
Group: Publishing |
176 |
|
177 |
%description -n %libgs |
178 |
This is the API library for programs which use the PostScript and/or |
179 |
PDF interpreters of GhostScript. |
180 |
|
181 |
%package -n %libgs_devel |
182 |
Summary: Headers and links to compile against the "%{libgs}" library |
183 |
Group: Development/C |
184 |
Requires: %libgs >= %{gsver} |
185 |
Provides: %{name}-devel = %{gsver} |
186 |
Provides: libgs-devel = %{gsver} |
187 |
Obsoletes: %{_lib}gs9-devel < %{gsver} |
188 |
Obsoletes: %{_lib}gs8-devel < %{gsver} |
189 |
|
190 |
%description -n %libgs_devel |
191 |
This package contains the static library and the header files needed |
192 |
to compile applications using the GhostScript shared library. |
193 |
|
194 |
%package -n %{libijs} |
195 |
Version: %{ijsver} |
196 |
Release: %{ijsrel} |
197 |
Summary: Dynamic library for the IJS printer driver plug-in interface |
198 |
Group: Publishing |
199 |
URL: http://www.linuxprinting.org/ijs/ |
200 |
Provides: libijs = %{ijsver}-%{ijsrel} |
201 |
|
202 |
%description -n %{libijs} |
203 |
This is the API library for programs using the IJS printer driver |
204 |
plug-in interface. Printer drivers using this interface can be added |
205 |
to GhostScript (6.53 or newer) without needing to rebuild |
206 |
GhostScript. Application programs providing an IJS interface can make |
207 |
use of IJS printer drivers directly, without needing GhostScript. |
208 |
|
209 |
%package -n %{libijs_devel} |
210 |
Version: %{ijsver} |
211 |
Release: %{ijsrel} |
212 |
Summary: Headers and links for compiling against the "%{libijs}" library |
213 |
Group: Development/C |
214 |
URL: http://www.linuxprinting.org/ijs/ |
215 |
Requires: %{libijs} >= %{ijsver} |
216 |
Requires: multiarch-utils |
217 |
Provides: libijs-devel = %{ijsver}-%{ijsrel} |
218 |
Provides: ijs-devel = %{ijsver}-%{ijsrel} |
219 |
Obsoletes: %{_lib}ijs1-devel < %{ijsver}-%{ijsrel} |
220 |
|
221 |
%description -n %{libijs_devel} |
222 |
This package contains the static library and the header files needed |
223 |
to compile applications using the IJS library. |
224 |
|
225 |
%package doc |
226 |
Summary: Documentation for GhostScript |
227 |
Group: Publishing |
228 |
BuildArch: noarch |
229 |
|
230 |
%description doc |
231 |
This package contains documentation for GhostScript. |
232 |
|
233 |
%prep |
234 |
%setup -q |
235 |
%apply_patches |
236 |
# Don't ship backup files |
237 |
find . -name "*.*~" |xargs rm -f |
238 |
|
239 |
# prevent building and using bundled libs |
240 |
rm -rf jasper jbig2dec libpng jpeg tiff expat zlib lcms* freetype |
241 |
|
242 |
# Convert manual pages to UTF-8 |
243 |
from8859_1() { |
244 |
iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_" |
245 |
mv "${1}_" "$1" |
246 |
} |
247 |
for i in man/de/*.1; do from8859_1 "$i"; done |
248 |
|
249 |
# Stuff for shared library support to ghostscript. |
250 |
%if %{GSx11SVGAmodule} |
251 |
# build a small README describing the features available. |
252 |
cat <<EOF >README.shared.%{_vendor} |
253 |
This version of ghostscript support shared modules dynamically loaded |
254 |
at run time. |
255 |
|
256 |
There are currently two modules compiled with the %{distribution} version of |
257 |
ghostscript, one to support all X11 devices (typically used by gv) and |
258 |
another to support the svgalib devices. Look at the |
259 |
ghostscript-module-??? packages. |
260 |
|
261 |
There is no configuration needed, just can add (or remove) the package |
262 |
to add (or remove) the devices concerned in ghostscript. |
263 |
EOF |
264 |
%endif |
265 |
|
266 |
# ps2pdfpress |
267 |
bzcat %{SOURCE2} > ps2pdfpress |
268 |
|
269 |
# UPP file for SiPix Pocket Printer A6 |
270 |
bzcat %{SOURCE3} > sipixa6.upp |
271 |
|
272 |
%build |
273 |
|
274 |
# Change compiler flags for debugging when in debug mode |
275 |
%if %debug |
276 |
export DONT_STRIP=1 |
277 |
export CFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
278 |
export CXXFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
279 |
export RPM_OPT_FLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
280 |
%endif |
281 |
|
282 |
pushd ijs* |
283 |
%configure2_5x \ |
284 |
%ifarch %{ix86} |
285 |
--disable-sse2 \ |
286 |
%endif |
287 |
--enable-shared \ |
288 |
--disable-static |
289 |
|
290 |
%make |
291 |
popd |
292 |
|
293 |
# We have a Subversion version, so we must re-generate "configure" |
294 |
./autogen.sh |
295 |
|
296 |
%configure2_5x \ |
297 |
--enable-dynamic \ |
298 |
%if !%{bootstrap} |
299 |
--enable-fontconfig \ |
300 |
%endif |
301 |
%ifarch %{ix86} |
302 |
--disable-sse2 \ |
303 |
%endif |
304 |
--with-drivers=ALL,opvp \ |
305 |
--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" \ |
306 |
--with-ijs \ |
307 |
--with-omni \ |
308 |
--with-x \ |
309 |
--disable-compile-inits \ |
310 |
--with-system-libtiff \ |
311 |
--with-install-cups |
312 |
|
313 |
# Drivers which do not compile: |
314 |
# Needs newsiop/lbp.h: nwp533 |
315 |
# Needs sys/ioccom.h: sparc |
316 |
# Needs unbdev/lpviio.h: sparc |
317 |
|
318 |
# Set documentation dir |
319 |
perl -p -i -e 's|^(docdir=).*$|$1\$\(datadir\)/doc/%{name}-doc-%{gsver}|' Makefile |
320 |
|
321 |
# Fix references to X11 libraries |
322 |
perl -p -i -e "s|(/usr/X11R6)/lib\b|\1/%{_lib}|g" Makefile base/*.mak |
323 |
|
324 |
# Correct paths for CJK fonts |
325 |
perl -p -i -e "s:/usr/share/ghostscript/:/usr/share/ghostscript/Resource/:g" Resource/Init/gs_res.ps |
326 |
perl -p -i -e "s:ghostscript/Resource/fonts:ghostscript/Resource/Font:g" Resource/Init/gs_res.ps |
327 |
|
328 |
# Do not use "-ansi" in gcc calls |
329 |
perl -p -i -e "s:-ansi::g" Makefile |
330 |
|
331 |
# bork |
332 |
perl -p -i -e "s|^EXTRALIBS=|EXTRALIBS=-L/%{_lib} -lz |g" Makefile |
333 |
|
334 |
# The RPM macro for make is not used here, as parallelization of the build |
335 |
# process does not work. |
336 |
%if %{GSx11SVGAmodule} |
337 |
#make soobj/X11.so BUILDPREFIX=so |
338 |
make obj/X11.so |
339 |
%endif |
340 |
make so |
341 |
#make pcl3opts |
342 |
make cups |
343 |
|
344 |
%install |
345 |
rm -rf %{buildroot} |
346 |
|
347 |
# Change compiler flags for debugging when in debug mode |
348 |
%if %debug |
349 |
export DONT_STRIP=1 |
350 |
export CFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
351 |
export CXXFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
352 |
export RPM_OPT_FLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`" |
353 |
%endif |
354 |
|
355 |
# Make directories |
356 |
install -d %{buildroot}%{_bindir} |
357 |
install -d %{buildroot}%{_libdir} |
358 |
install -d %{buildroot}%{_includedir} |
359 |
install -d %{buildroot}%{_sysconfdir} |
360 |
install -d %{buildroot}%{_mandir}/man1 |
361 |
%if !%{bootstrap} |
362 |
install -d %{buildroot}%{_prefix}/lib/cups |
363 |
install -d %{buildroot}%{_datadir}/cups/model |
364 |
install -d %{buildroot}%{_sysconfdir}/cups |
365 |
%endif |
366 |
|
367 |
pushd ijs* |
368 |
%configure2_5x \ |
369 |
--enable-shared \ |
370 |
--prefix=%{buildroot}%{_prefix} \ |
371 |
--libdir=%{buildroot}%{_libdir} |
372 |
|
373 |
# Work around bug in "configure" script |
374 |
perl -p -i -e 's/\@OBJEXT\@/o/g' Makefile |
375 |
perl -p -i -e 's/\@EXEEXT\@//g' Makefile |
376 |
%makeinstall |
377 |
# Fix prefixes in scripts |
378 |
perl -p -i -e "s:%{buildroot}::g" %{buildroot}%{_bindir}/ijs-config |
379 |
perl -p -i -e "s:%{buildroot}::g" %{buildroot}%{_libdir}/pkgconfig/ijs.pc |
380 |
popd |
381 |
|
382 |
##### GHOSTSCRIPT |
383 |
mkdir -p %{buildroot}%{_docdir}/ghostscript-doc-%{gsver} |
384 |
|
385 |
%if !%{bootstrap} |
386 |
make \ |
387 |
prefix=%{_prefix} \ |
388 |
DESTDIR=%{buildroot} \ |
389 |
gssharedir=%{_libdir}/ghostscript/%{gsver} \ |
390 |
docdir=%{_docdir}/ghostscript-doc-%{gsver} \ |
391 |
bindir=%{_bindir} \ |
392 |
mandir=%{_mandir} \ |
393 |
install-cups |
394 |
%endif |
395 |
|
396 |
make \ |
397 |
prefix=%{_prefix} \ |
398 |
DESTDIR=%{buildroot} \ |
399 |
gssharedir=%{_libdir}/ghostscript/%{gsver} \ |
400 |
docdir=%{_docdir}/ghostscript-doc-%{gsver} \ |
401 |
bindir=%{_bindir} \ |
402 |
libdir=%{_libdir} \ |
403 |
mandir=%{_mandir} \ |
404 |
soinstall |
405 |
|
406 |
%if %{GSx11SVGAmodule} |
407 |
make \ |
408 |
prefix=%{_prefix} \ |
409 |
DESTDIR=%{buildroot} \ |
410 |
gssharedir=%{_libdir}/ghostscript/%{gsver} \ |
411 |
docdir=%{_docdir}/ghostscript-doc-%{gsver} \ |
412 |
bindir=%{_bindir} \ |
413 |
libdir=%{_libdir} \ |
414 |
mandir=%{_mandir} \ |
415 |
install-shared |
416 |
%endif |
417 |
|
418 |
ln -sf gs.1%{_extension} %{buildroot}%{_mandir}/man1/ghostscript.1%{_extension} |
419 |
|
420 |
# ps2pdfpress |
421 |
install -m 755 ps2pdfpress %{buildroot}%{_bindir} |
422 |
|
423 |
# UPP file for SiPix Pocket Printer A6 |
424 |
#mkdir -p %{buildroot}%{_datadir}/ghostscript/%{gsver}/lib |
425 |
install -m 644 sipixa6.upp %{buildroot}%{_datadir}/ghostscript/%{gsver}/lib/ |
426 |
|
427 |
# why? |
428 |
mv %{buildroot}%{_datadir}/cups/mime/gstoraster.convs %{buildroot}%{_sysconfdir}/cups/gstoraster.convs |
429 |
|
430 |
# Correct permissions for all documentation files |
431 |
chmod -R a+rX %{buildroot}%{_docdir} |
432 |
chmod -R go-w %{buildroot}%{_docdir} |
433 |
chmod -R u+w %{buildroot}%{_docdir} |
434 |
|
435 |
# remove libtool archive |
436 |
rm -f %{buildroot}%{_libdir}/libijs.la |
437 |
|
438 |
%post |
439 |
# Set up update-alternatives entries |
440 |
%{_sbindir}/update-alternatives --install %{_bindir}/gs gs %{_bindir}/gsc 200 |
441 |
|
442 |
%post X |
443 |
# Set up update-alternatives entries |
444 |
%{_sbindir}/update-alternatives --install %{_bindir}/gs gs %{_bindir}/gsx 100 |
445 |
|
446 |
%post common |
447 |
# Initialize japanese fonts |
448 |
if test -f /usr/share/fonts/ttf/japanese/cidinst; then |
449 |
sh /usr/share/fonts/ttf/japanese/cidinst |
450 |
fi |
451 |
|
452 |
%preun |
453 |
if [ "$1" = 0 ]; then |
454 |
# Remove update-alternatives entry |
455 |
%{_sbindir}/update-alternatives --remove gs %{_bindir}/gsc |
456 |
fi |
457 |
|
458 |
%preun X |
459 |
if [ "$1" = 0 ]; then |
460 |
# Remove update-alternatives entry |
461 |
%{_sbindir}/update-alternatives --remove gs %{_bindir}/gsx |
462 |
fi |
463 |
|
464 |
%files |
465 |
%{_bindir}/gsc |
466 |
|
467 |
%files X |
468 |
%{_bindir}/gsx |
469 |
|
470 |
%files common |
471 |
%dir %{_datadir}/ghostscript |
472 |
%{_datadir}/ghostscript/%{gsver} |
473 |
%{_mandir}/man1/* |
474 |
%lang(de) %{_mandir}/de/man1/* |
475 |
#%{_bindir}/[a-c]* |
476 |
%{_bindir}/[e-f]* |
477 |
#{_bindir}/gs-common |
478 |
%{_bindir}/gs[a-b]* |
479 |
%{_bindir}/gs[d-n]* |
480 |
%{_bindir}/[j-l]* |
481 |
%{_bindir}/[n-z]* |
482 |
%if %{withcupsfilters} |
483 |
# "pstoraster" wrapper script to make GhostScript being used as the |
484 |
# cups-internal RIP |
485 |
%attr(0755,root,root) %{_prefix}/lib*/cups/filter/* |
486 |
%{_datadir}/cups/model/* |
487 |
%config(noreplace) %{_sysconfdir}/cups/gstoraster.convs |
488 |
%endif |
489 |
|
490 |
%files doc |
491 |
%doc %{_docdir}/ghostscript-doc-%{gsver} |
492 |
|
493 |
%files dvipdf |
494 |
%{_bindir}/dvipdf |
495 |
|
496 |
%if %{GSx11SVGAmodule} |
497 |
%files module-X |
498 |
%doc README.shared.%{_vendor} |
499 |
%dir %{_libdir}/ghostscript/%{gsver} |
500 |
%{_libdir}/ghostscript/%{gsver}/X11.so |
501 |
%endif |
502 |
|
503 |
%files -n %{libgs} |
504 |
%{_libdir}/libgs.so.*%{gsmajor}* |
505 |
|
506 |
%files -n %{libgs_devel} |
507 |
%{_libdir}/libgs.so |
508 |
%{_includedir}/ghostscript |
509 |
|
510 |
%files -n %{libijs} |
511 |
%{_libdir}/libijs-%{ijsver}.so |
512 |
|
513 |
%files -n %{libijs_devel} |
514 |
%doc ijs/README |
515 |
%{_libdir}/libijs.so |
516 |
%{_libdir}/pkgconfig/ijs.pc |
517 |
%{_includedir}/ijs |
518 |
%{_bindir}/ijs_client_example |
519 |
%{_bindir}/ijs_server_example |
520 |
%{_bindir}/ijs-config |