/[packages]/cauldron/ghostscript/current/SPECS/ghostscript.spec
ViewVC logotype

Contents of /cauldron/ghostscript/current/SPECS/ghostscript.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1745507 - (show annotations) (download)
Wed Sep 15 14:31:47 2021 UTC (2 years, 7 months ago) by ns80
File size: 13488 byte(s)
- add patch from Ubuntu for CVE-2021-3781 (mga#29453)

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

  ViewVC Help
Powered by ViewVC 1.1.30