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