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