aboutsummaryrefslogtreecommitdiffstats
path: root/print/ghostscript8-base/files
diff options
context:
space:
mode:
Diffstat (limited to 'print/ghostscript8-base/files')
-rw-r--r--print/ghostscript8-base/files/Makefile.dmprt8
-rw-r--r--print/ghostscript8-base/files/Makefile.drivers_post182
-rw-r--r--print/ghostscript8-base/files/Makefile.epag24
-rw-r--r--print/ghostscript8-base/files/Makefile.pcl336
-rw-r--r--print/ghostscript8-base/files/epag.contrib.mak8
-rw-r--r--print/ghostscript8-base/files/lqx70ch.upp26
-rw-r--r--print/ghostscript8-base/files/lqx70cl.upp26
-rw-r--r--print/ghostscript8-base/files/lqx70cm.upp25
-rw-r--r--print/ghostscript8-base/files/patch-Resource-Init-cidfmap67
-rw-r--r--print/ghostscript8-base/files/patch-Resource-Init-gs_statd.ps23
-rw-r--r--print/ghostscript8-base/files/patch-Resource-Init-gs_ttf.ps24
-rw-r--r--print/ghostscript8-base/files/patch-Resource-Init-pdf_font.ps15
-rw-r--r--print/ghostscript8-base/files/patch-base-Makefile.in132
-rw-r--r--print/ghostscript8-base/files/patch-base-configure.ac57
-rw-r--r--print/ghostscript8-base/files/patch-base-contrib.mak8
-rw-r--r--print/ghostscript8-base/files/patch-base-devs.mak42
-rw-r--r--print/ghostscript8-base/files/patch-base-errors.h10
-rw-r--r--print/ghostscript8-base/files/patch-base-gdevl256.c30
-rw-r--r--print/ghostscript8-base/files/patch-base-gdevperm.c11
-rw-r--r--print/ghostscript8-base/files/patch-base-gdevvglb.c32
-rw-r--r--print/ghostscript8-base/files/patch-base-gs.mak11
-rw-r--r--print/ghostscript8-base/files/patch-base-gsmalloc.c11
-rw-r--r--print/ghostscript8-base/files/patch-base-gxobj.h18
-rw-r--r--print/ghostscript8-base/files/patch-base-ijs.mak20
-rw-r--r--print/ghostscript8-base/files/patch-base-lib.mak26
-rw-r--r--print/ghostscript8-base/files/patch-base-sjpx.c36
-rw-r--r--print/ghostscript8-base/files/patch-base-unix-dll.mak17
-rw-r--r--print/ghostscript8-base/files/patch-base-unix-gcc.mak216
-rw-r--r--print/ghostscript8-base/files/patch-base-unixinst.mak20
-rw-r--r--print/ghostscript8-base/files/patch-contrib-contrib.mak11
-rw-r--r--print/ghostscript8-base/files/patch-contrib__japanese__dmp_site.ps11
-rw-r--r--print/ghostscript8-base/files/patch-contrib__japanese__gdevdmpr.c44
-rw-r--r--print/ghostscript8-base/files/patch-epag-ert.c11
-rw-r--r--print/ghostscript8-base/files/patch-epag__gdevepag.c217
-rw-r--r--print/ghostscript8-base/files/patch-lib-FAPIcidfmap62
-rw-r--r--print/ghostscript8-base/files/patch-lib-FAPIconfig21
-rw-r--r--print/ghostscript8-base/files/patch-lib-pdf2dsc.ps11
-rw-r--r--print/ghostscript8-base/files/patch-libpng15196
-rw-r--r--print/ghostscript8-base/files/patch-lips:gdevlips.c18
-rw-r--r--print/ghostscript8-base/files/patch-lips:gdevlips.h17
-rw-r--r--print/ghostscript8-base/files/patch-psi-zicc.c12
-rw-r--r--print/ghostscript8-base/files/pkg-message.in5
42 files changed, 1797 insertions, 0 deletions
diff --git a/print/ghostscript8-base/files/Makefile.dmprt b/print/ghostscript8-base/files/Makefile.dmprt
new file mode 100644
index 000000000000..6cbc6957f6c3
--- /dev/null
+++ b/print/ghostscript8-base/files/Makefile.dmprt
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+post-install-dmprt:
+ cd ${FILESDIR} && \
+ ${INSTALL_DATA} lqx70ch.upp lqx70cl.upp lqx70cm.upp \
+ ${STAGEDIR}${DATADIR}/lib
+
+post-install: post-install-dmprt
diff --git a/print/ghostscript8-base/files/Makefile.drivers_post b/print/ghostscript8-base/files/Makefile.drivers_post
new file mode 100644
index 000000000000..cdb8a6ccb31f
--- /dev/null
+++ b/print/ghostscript8-base/files/Makefile.drivers_post
@@ -0,0 +1,182 @@
+# $FreeBSD$
+# pre/postprocessing driver variables
+
+# dmprt specific
+.if ${PORT_OPTIONS:MGS_dmprt}
+.include "${MASTERDIR}/files/Makefile.dmprt"
+.endif
+
+# epag specific
+.if ${PORT_OPTIONS:MGS_epag}
+.include "${MASTERDIR}/files/Makefile.epag"
+.endif
+
+EPAG_BASE= epag
+EPAG_SRCS= ${EPAG_BASE}-3.09.tar.gz
+EPAG_NAME= ${EPAG_SRCS:S,.tar.gz$,,}
+
+post-extract-epag:
+ ${TAR} -C ${WRKSRC} -xzf ${DISTDIR}/${DIST_SUBDIR}/${EPAG_SRCS}
+ ${LN} -s -f ${EPAG_NAME} ${WRKSRC}/${EPAG_BASE}
+ ${INSTALL_DATA} ${FILESDIR}/epag.contrib.mak ${WRKSRC}/base/epag.contrib.mak
+
+post-extract: post-extract-epag
+
+# pcl3 specific
+.if ${PORT_OPTIONS:MGS_pcl3}
+.include "${MASTERDIR}/files/Makefile.pcl3"
+.endif
+
+# cups specific
+CUPS_DEVS= cups
+.undef _CUPS_DEVS
+
+.for D in ${CUPS_DEVS}
+.if ${PORT_OPTIONS:MCUPS} && ${PORT_OPTIONS:MGS_${D}}
+_CUPS_DEVS+= ${D}
+.else
+PORT_OPTIONS:= ${PORT_OPTIONS:NGS_${D}}
+.endif
+.endfor
+
+.if defined(_CUPS_DEVS)
+LIB_DEPENDS+= libcupsimage.so:${PORTSDIR}/print/cups-image
+CONFIGURE_ARGS+= --enable-cups
+.else
+CONFIGURE_ARGS+= --disable-cups
+.endif
+
+# vgalib specific
+VGA_DEVS= lvga256 vgalib
+.undef _VGA_DEVS
+
+.for D in ${VGA_DEVS}
+.if ${PORT_OPTIONS:MGS_${D}}
+.if ${ARCH:Mamd64} || ${ARCH:Mi386}
+_VGA_DEVS+= ${D}
+.else
+OPTIONS_UNSET+= ${PORT_OPTIONS:MGS_${D}}
+.endif
+.endif
+.endfor
+
+.if defined(_VGA_DEVS)
+LIB_DEPENDS+= libvga.so:${PORTSDIR}/graphics/svgalib
+.endif
+
+# iconv specific
+ICONV_DEVS= oprp opvp
+.undef _ICONV_DEVS
+
+.for D in ${ICONV_DEVS}
+.if ${PORT_OPTIONS:MICONV} && ${PORT_OPTIONS:MGS_${D}}
+_ICONV_DEVS+= ${D}
+.else
+PORT_OPTIONS:= ${PORT_OPTIONS:NGS_${D}}
+.endif
+.endfor
+
+.if defined(_ICONV_DEVS)
+USES+= iconv
+CONFIGURE_ARGS+=--with-libiconv=maybe
+.else
+CONFIGURE_ARGS+=--with-libiconv=no
+.endif
+
+# cairo specific
+.for D in cairo
+.if ${PORT_OPTIONS:MCAIRO} && ${PORT_OPTIONS:MGS_${D}}
+_CAIRO_DEVS+= ${D}
+.else
+PORT_OPTIONS:= ${PORT_OPTIONS:NGS_${D}}
+.endif
+.endfor
+
+.if defined(_CAIRO_DEVS)
+LIB_DEPENDS+= libcairo.so:${PORTSDIR}/graphics/cairo
+CONFIGURE_ARGS+= --enable-cairo
+.else
+CONFIGURE_ARGS+= --disable-cairo
+.endif
+
+# pre-defined order
+DEVS_LIST= DEVS1 DEVS2 DEVS3 DEVS4 DEVS5 DEVS6 DEVS7 DEVS8 DEVS9 \
+ DEVS10 DEVS11 DEVS12 DEVS13 DEVS14 DEVS15 DEVS16 DEVS17 DEVS18 \
+ DEVS19 DEVS20 DEVS21
+
+DEVICE_DEVS1= bmpmono.dev bmpgray.dev bmpsep1.dev bmpsep8.dev \
+ bmp16.dev bmp256.dev bmp16m.dev bmp32b.dev stcolor.dev
+DEVICE_DEVS2= epson.dev eps9high.dev eps9mid.dev epsonc.dev ibmpro.dev
+DEVICE_DEVS3= deskjet.dev djet500.dev laserjet.dev ljetplus.dev \
+ ljet2p.dev ljet3.dev ljet3d.dev ljet4.dev ljet4d.dev \
+ lj5mono.dev lj5gray.dev cups.dev
+DEVICE_DEVS4= cdeskjet.dev cdjcolor.dev cdjmono.dev cdj550.dev pj.dev \
+ pjxl.dev pjxl300.dev ijs.dev
+DEVICE_DEVS5= uniprint.dev omni.dev
+DEVICE_DEVS6= bj10e.dev bj200.dev bjc600.dev bjc800.dev png48.dev \
+ png16m.dev pnggray.dev pngmono.dev png256.dev png16.dev \
+ pngalpha.dev
+DEVICE_DEVS7= faxg3.dev faxg32d.dev faxg4.dev
+DEVICE_DEVS8= pcxmono.dev pcxgray.dev pcx16.dev pcx256.dev pcx24b.dev \
+ pcxcmyk.dev svgwrite.dev
+DEVICE_DEVS9= pbm.dev pbmraw.dev pgm.dev pgmraw.dev pgnm.dev \
+ pgnmraw.dev pnm.dev pnmraw.dev ppm.dev ppmraw.dev pkm.dev \
+ pkmraw.dev pksm.dev pksmraw.dev
+DEVICE_DEVS10= tiffcrle.dev tiffg3.dev tiffg32d.dev tiffg4.dev \
+ tifflzw.dev tiffpack.dev
+DEVICE_DEVS11= tiff12nc.dev tiff24nc.dev tiff48nc tiffgray.dev \
+ tiff32nc.dev tiff64nc.dev tiffsep.dev tiffsep1.dev
+DEVICE_DEVS12= psmono.dev psgray.dev psrgb.dev bit.dev bitrgb.dev \
+ bitcmyk.dev
+DEVICE_DEVS13=
+DEVICE_DEVS14= jpeg.dev jpeggray.dev jpegcmyk.dev
+DEVICE_DEVS15= pdfwrite.dev pswrite.dev ps2write.dev epswrite.dev \
+ txtwrite.dev pxlmono.dev pxlcolor.dev
+DEVICE_DEVS16= bbox.dev
+DEVICE_DEVS17=
+DEVICE_DEVS18=
+DEVICE_DEVS20= cljet5.dev cljet5c.dev
+DEVICE_DEVS21= spotcmyk.dev devicen.dev xcf.dev psdcmyk.dev psdrgb.dev \
+ pamcmyk32.dev
+
+# DEVS19 is for this port specific
+DEVICE_DEVS19= alc1900.dev alc2000.dev alc4000.dev alc4100.dev \
+ alc8500.dev alc8600.dev ap3250.dev appledmp.dev atx23.dev \
+ atx24.dev atx38.dev bj10v.dev bj10vh.dev bjc880j.dev \
+ bjccmyk.dev bjccolor.dev bjcgray.dev bjcmono.dev cairo.dev \
+ ccr.dev cdj1600.dev cdj500.dev cdj670.dev cdj850.dev \
+ cdj880.dev cdj890.dev cdj970.dev cdnj500.dev cfax.dev \
+ cgm24.dev cgm8.dev cgmmono.dev chp2200.dev cif.dev \
+ cljet5pr.dev coslw2p.dev coslwxl.dev cp50.dev declj250.dev \
+ dfaxhigh.dev dfaxlow.dev display.dev dj505j.dev djet500c.dev \
+ dl2100.dev dmprt.dev dnj650c.dev epag.dev epl2050.dev \
+ epl2050p.dev epl2120.dev epl2500.dev epl2750.dev epl5800.dev \
+ epl5900.dev epl6100.dev eplcolor.dev eplmono.dev escpage.dev \
+ fmlbp.dev fmpr.dev fs600.dev gdi.dev hl1240.dev hl1250.dev \
+ hl7x0.dev imagen.dev imdi.dev inferno.dev iwhi.dev iwlo.dev \
+ iwlq.dev jetp3852.dev jj100.dev jpegcmyk.dev la50.dev la70.dev \
+ la75.dev la75plus.dev lbp310.dev lbp320.dev lbp8.dev \
+ lex2050.dev lex3200.dev lex5700.dev lex7000.dev lips2p.dev \
+ lips3.dev lips4.dev lips4v.dev lj250.dev lj4dith.dev \
+ lj4dithp.dev ljet4pjl.dev ln03.dev lp1800.dev lp1900.dev \
+ lp2000.dev lp2200.dev lp2400.dev lp2500.dev lp2563.dev \
+ lp3000c.dev lp7500.dev lp7700.dev lp7900.dev lp8000.dev \
+ lp8000c.dev lp8100.dev lp8200c.dev lp8300c.dev lp8300f.dev \
+ lp8400f.dev lp8500c.dev lp8600.dev lp8600f.dev lp8700.dev \
+ lp8800c.dev lp8900.dev lp9000b.dev lp9000c.dev lp9100.dev \
+ lp9300.dev lp9400.dev lp9500c.dev lp9600.dev lp9600s.dev \
+ lp9800c.dev lq850.dev lvga256.dev lx5000.dev lxm3200.dev \
+ lxm5700m.dev m8510.dev mag16.dev mag256.dev md1xMono.dev \
+ md2k.dev md50Eco.dev md50Mono.dev md5k.dev mgr4.dev mgr8.dev \
+ mgrgray2.dev mgrgray4.dev mgrgray8.dev mgrmono.dev miff24.dev \
+ mj500c.dev mj6000c.dev mj700v2c.dev mj8000c.dev ml600.dev \
+ necp6.dev npdl.dev oce9050.dev oki182.dev oki4w.dev okiibm.dev \
+ oprp.dev opvp.dev paintjet.dev pam.dev pamcmyk32.dev pcl3.dev \
+ perm.dev photoex.dev picty180.dev pjetxl.dev plan9bm.dev \
+ pr1000.dev pr1000_4.dev pr150.dev pr201.dev r4081.dev rpdl.dev \
+ sgirgb.dev sj48.dev st800.dev sunhmono.dev t4693d2.dev \
+ t4693d4.dev t4693d8.dev tek4696.dev tiff48nc tiff64nc.dev \
+ tiffsep1.dev txtwrite.dev vgalib.dev wtscmyk.dev wtsimdi.dev \
+ x11.dev x11alpha.dev x11cmyk.dev x11cmyk2.dev x11cmyk4.dev \
+ x11cmyk8.dev x11gray2.dev x11gray4.dev x11mono.dev \
+ x11rg16x.dev x11rg32x.dev xcfcmyk.dev xes.dev
diff --git a/print/ghostscript8-base/files/Makefile.epag b/print/ghostscript8-base/files/Makefile.epag
new file mode 100644
index 000000000000..96141325b372
--- /dev/null
+++ b/print/ghostscript8-base/files/Makefile.epag
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+# EPAG - additional driver for Epson ESC/Page printers
+# http://www.humblesoft.com/gdevepag.html
+
+PORTDOCS+= epag
+PORTDOC_FILES+= epag/ert.txt epag/gdevepag.txt epag/ChangeLog \
+ epag/psprint epag/gsepagif.sh
+
+pre-build-epag:
+ ${LN} -s -f ${WRKSRC}/${EPAG_NAME}/gdevepag.c ${WRKSRC}/base
+ ${MKDIR} ${WRKSRC}/contrib/epag
+ ${INSTALL_DATA} ${WRKSRC}/${EPAG_NAME}/* ${WRKSRC}/contrib/epag
+
+post-build-epag:
+ cd ${WRKSRC}/${EPAG_NAME} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} Makefile
+
+post-install-epag:
+ ${INSTALL_PROGRAM} ${WRKSRC}/${EPAG_NAME}/ert ${STAGEDIR}${PREFIX}/bin
+
+pre-build: pre-build-epag
+post-build: post-build-epag
+post-install: post-install-epag
diff --git a/print/ghostscript8-base/files/Makefile.pcl3 b/print/ghostscript8-base/files/Makefile.pcl3
new file mode 100644
index 000000000000..288624b34ab4
--- /dev/null
+++ b/print/ghostscript8-base/files/Makefile.pcl3
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+PORTDOCS+= pcl3
+PORTDOC_FILES+= pcl3/NEWS pcl3/BUGS pcl3/README pcl3/gs-pcl3.html \
+ pcl3/how-to-report.txt pcl3/pcl3opts.html
+
+post-build-pcl3:
+ cd ${WRKSRC} && \
+ ${CC} ${CFLAGS} -I./obj -I./soobj -I./base \
+ -I./contrib/pcl3/eprn -o bin/pcl3opts \
+ contrib/pcl3/src/pcl3opts.c contrib/pcl3/src/pclscan.c \
+ contrib/pcl3/eprn/mediasize.c contrib/pcl3/src/pclsize.c
+
+post-install-pcl3:
+ ${INSTALL_PROGRAM} ${WRKSRC}/bin/pcl3opts ${STAGEDIR}${PREFIX}/bin
+ ${MKDIR} ${STAGEDIR}${DATADIR}/pcl3
+ cd ${WRKSRC}/contrib/pcl3 && \
+ ${INSTALL_DATA} lib/example.mcf lib/if-pcl3 \
+ ps/calign.ps ps/dumppdd.ps ps/levels-test.ps \
+ ps/margins-A4.ps ps/margins-A4Rotated.ps \
+ ps/margins-Env10Rotated.ps \
+ ps/margins-EnvDLRotated.ps \
+ ps/margins-Letter.ps \
+ ps/margins-LetterRotated.ps \
+ ${STAGEDIR}${DATADIR}/pcl3
+ cd ${WRKSRC}/contrib/pcl3/doc && \
+ ${INSTALL_MAN} gs-pcl3.1 pcl3opts.1 \
+ ${STAGEDIR}${MANPREFIX}/man/man1
+
+post-install-docs-pcl3:
+ ${MKDIR} ${WRKSRC}/contrib/pcl3
+ ${INSTALL_DATA} ${WRKSRC}/contrib/pcl3/doc/* ${WRKSRC}/contrib/pcl3
+
+post-build: post-build-pcl3
+post-install: post-install-pcl3
+post-install-docs: post-install-docs-pcl3
diff --git a/print/ghostscript8-base/files/epag.contrib.mak b/print/ghostscript8-base/files/epag.contrib.mak
new file mode 100644
index 000000000000..2e6117ad4b51
--- /dev/null
+++ b/print/ghostscript8-base/files/epag.contrib.mak
@@ -0,0 +1,8 @@
+### ------- Epson ESC/Page printer device ----------------- ###
+epag_=$(GLOBJ)gdevepag.$(OBJ)
+
+$(DD)epag.dev : $(epag_) $(DD)page.dev
+ $(SETPDEV) $(DD)epag $(epag_)
+
+$(GLOBJ)gdevepag.$(OBJ): $(GLSRC)gdevepag.c $(gdevprn_h) $(PDEVH)
+ $(GLCC) $(GLO_)gdevepag.$(OBJ) $(C_) $(GLSRC)gdevepag.c
diff --git a/print/ghostscript8-base/files/lqx70ch.upp b/print/ghostscript8-base/files/lqx70ch.upp
new file mode 100644
index 000000000000..b5d3cd49e912
--- /dev/null
+++ b/print/ghostscript8-base/files/lqx70ch.upp
@@ -0,0 +1,26 @@
+# $ApsCVS: src/apsfilter/uniprint/lqx70ch.upp,v 1.2 2000/04/21 18:48:00 andreas Exp $
+#
+-supModel="Epson LQ-1170 ESC/P2 Dot Matrix, 360x360DpI, Plain Paper"
+-sDEVICE=uniprint
+-dNOPAUSE
+-dSAFER
+-dupColorModel=/DeviceCMYKgenerate
+-dupRendering=/ErrorDiffusion
+-dupOutputFormat=/EscP2
+-r360x360
+-dupMargins="{ 9.0 0.0 9.0 24.0}"
+-dupOutputPins=24
+-dupBeginPageCommand="<
+ 1b40 1b40
+ 1b2847 0100 01
+ 1b2869 0100 01
+ 1b2855 0100 0A
+ 1b5501
+ 1b2865 0200 0002
+ 1b2843 0200 0000
+ 1b2863 0400 0000 0000
+>"
+-dupAdjustPageLengthCommand
+-dupEndPageCommand="(\014)"
+-dupAbortCommand="(\033@\15\12\12\12\12 Printout-Aborted\15\014)"
+
diff --git a/print/ghostscript8-base/files/lqx70cl.upp b/print/ghostscript8-base/files/lqx70cl.upp
new file mode 100644
index 000000000000..91fb1aa89906
--- /dev/null
+++ b/print/ghostscript8-base/files/lqx70cl.upp
@@ -0,0 +1,26 @@
+# $ApsCVS: src/apsfilter/uniprint/lqx70cl.upp,v 1.2 2000/04/21 18:48:00 andreas Exp $
+#
+-supModel="Epson LQ-1170 ESC/P2 Dot Matrix, 180x180DpI, Plain Paper"
+-sDEVICE=uniprint
+-dNOPAUSE
+-dSAFER
+-dupColorModel=/DeviceCMYKgenerate
+-dupRendering=/ErrorDiffusion
+-dupOutputFormat=/EscP2
+-r180x180
+-dupMargins="{ 9.0 0.0 9.0 24.0}"
+-dupOutputPins=24
+-dupBeginPageCommand="<
+ 1b40 1b40
+ 1b2847 0100 01
+ 1b2869 0100 01
+ 1b2855 0100 14
+ 1b5500
+ 1b2865 0200 0002
+ 1b2843 0200 0000
+ 1b2863 0400 0000 0000
+>"
+-dupAdjustPageLengthCommand
+-dupEndPageCommand="(\014)"
+-dupAbortCommand="(\033@\15\12\12\12\12 Printout-Aborted\15\014)"
+
diff --git a/print/ghostscript8-base/files/lqx70cm.upp b/print/ghostscript8-base/files/lqx70cm.upp
new file mode 100644
index 000000000000..895af73aa8d8
--- /dev/null
+++ b/print/ghostscript8-base/files/lqx70cm.upp
@@ -0,0 +1,25 @@
+# $ApsCVS: src/apsfilter/uniprint/lqx70cm.upp,v 1.2 2000/04/21 18:48:00 andreas Exp $
+#
+-supModel="Epson LQ-1170 ESC/P2 Dot Matrix, 360x180DpI, Plain Paper"
+-sDEVICE=uniprint
+-dNOPAUSE
+-dSAFER
+-dupColorModel=/DeviceCMYKgenerate
+-dupRendering=/ErrorDiffusion
+-dupOutputFormat=/EscP2
+-r360x180
+-dupMargins="{ 9.0 24.0 9.0 24.0}"
+-dupOutputPins=24
+-dupBeginPageCommand="<
+ 1b40 1b40
+ 1b2847 0100 01
+ 1b2869 0100 01
+ 1b2855 0100 14
+ 1b5501
+ 1b2843 0200 0000
+ 1b2863 0400 0000 0000
+>"
+-dupAdjustPageLengthCommand
+-dupEndPageCommand="(\014)"
+-dupAbortCommand="(\033@\15\12\12\12\12 Printout-Aborted\15\014)"
+
diff --git a/print/ghostscript8-base/files/patch-Resource-Init-cidfmap b/print/ghostscript8-base/files/patch-Resource-Init-cidfmap
new file mode 100644
index 000000000000..8ed71789f4fe
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-Resource-Init-cidfmap
@@ -0,0 +1,67 @@
+--- Resource/Init/cidfmap.orig 2008-08-08 13:22:38.000000000 +0900
++++ Resource/Init/cidfmap 2009-12-20 03:03:17.000000000 +0900
+@@ -26,3 +26,64 @@
+ % /ShinGo-Bold /HeiseiKakuGo-W5 ;
+ % /Ryumin-Medium << /FileType /TrueType /Path (H:/AuxFiles/Fonts/BATANG.TTC) /SubfontID 3 /CSI [(Japan1) 2] >> ;
+ %
++/Ryumin-Light << /FileType /TrueType /Path (Ryumin-Light) /SubfontID 0 /CSI [(Japan1) 6] >> ;
++/GothicBBB-Medium << /FileType /TrueType /Path (GothicBBB-Medium) /SubfontID 0 /CSI [(Japan1) 6] >> ;
++
++/Ryumin-Medium /Ryumin-Light ;
++/Ryumin-Regular /Ryumin-Light ;
++/RyuminPro-Light /Ryumin-Light ;
++
++/GothicBBBPro-Medium /GothicBBB-Medium ;
++
++/KozGoPro-Bold /GothicBBB-Medium ;
++/KozGoPro-Heavy /GothicBBB-Medium ;
++/KozGoPro-Medium /GothicBBB-Medium ;
++/KozGoPro-Regular /GothicBBB-Medium ;
++
++/KozMinPro-Bold /Ryumin-Light ;
++/KozMinPro-Light /Ryumin-Light ;
++/KozMinPro-Medium /Ryumin-Light ;
++/KozMinPro-Regular /Ryumin-Light ;
++
++/HiraKakuPro-W3 /GothicBBB-Medium ;
++/HiraKakuPro-W6 /GothicBBB-Medium ;
++/HiraKakuStd-W8 /GothicBBB-Medium ;
++
++/HiraMaruPro-W4 /GothicBBB-Medium ;
++
++/HiraMinPro-W3 /Ryumin-Light ;
++
++/HeiseiMin-W3 /Ryumin-Light ;
++/HeiseiKakuGo-W5 /GothicBBB-Medium ;
++
++/FutoMinA101-Bold /Ryumin-Light ;
++/FutoMinA101Pro-Bold /Ryumin-Light ;
++/FutoGoB101-Bold /GothicBBB-Medium ;
++/FutoGoB101Pro-Bold /GothicBBB-Medium ;
++
++/Jun101-Light /Ryumin-Light ;
++/Jun101Pro-Light /Ryumin-Light ;
++
++/MidashiGo-MB31 /GothicBBB-Medium ;
++/MidashiGoPro-MB31 /GothicBBB-Medium ;
++
++/MidashiMinPro-MA31 /Ryumin-Light ;
++
++/MS-Mincho /Ryumin-Light ;
++/MS-PMincho /Ryumin-Light ;
++/MS-Gothic /GothicBBB-Medium ;
++/MS-PGothic /GothicBBB-Medium ;
++
++%/Munhwa-Regular /Munhwa-Regular ;
++%/MunhwaGothic-Regular /MunhwaGothic-Regular ;
++%/Munhwa-Bold /Munhwa-Bold ;
++%/MunhwaGothic-Bold /MunhwaGothic-Bold ;
++
++/HYGoThic-Medium /MunhwaGothic-Regular ;
++/HYSMyeongJo-Medium /Munhwa-Regular ;
++/HYRGoThic-Medium /MunhwaGothic-Bold ;
++
++/STHeiti-Regular << /FileType /TrueType /Path (STHeiti-Regular) /SubfontID 0 /CSI [(CNS1) 5] >> ;
++/STSong-Light << /FileType /TrueType /Path (STSong-Light) /SubfontID 0 /CSI [(GB1) 5] >> ;
++/MSung-Light << /FileType /TrueType /Path (MSung-Light) /SubfontID 0 /CSI [(CNS1) 5] >> ;
++/MHei-Medium << /FileType /TrueType /Path (MHei-Medium) /SubfontID 0 /CSI [(GB1) 5] >> ;
diff --git a/print/ghostscript8-base/files/patch-Resource-Init-gs_statd.ps b/print/ghostscript8-base/files/patch-Resource-Init-gs_statd.ps
new file mode 100644
index 000000000000..ab50080daeb8
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-Resource-Init-gs_statd.ps
@@ -0,0 +1,23 @@
+--- Resource/Init/gs_statd.ps.orig 2009-03-16 07:42:53.000000000 +0900
++++ Resource/Init/gs_statd.ps 2009-12-20 01:35:53.000000000 +0900
+@@ -111,6 +111,12 @@
+ /pa4 {595 792 //.setpagesize exec} bind def
+ % Japanese postcard size, 100mm x 148mm
+ /hagaki {283 420 //.setpagesize exec} bind def
++ /postcard {284 419 //.setpagesize exec} bind def
++ /dbl_postcard {419 568 //.setpagesize exec} bind def
++ /Executive {522 756 //.setpagesize exec} bind def
++ /jenv_you4 {298 666 //.setpagesize exec} bind def
++ /jenv_you2 {324 460 //.setpagesize exec} bind def
++ /jenv_kaku2 {682 942 //.setpagesize exec} bind def
+ % /tabloid {792 1224 //.setpagesize exec} bind def % 11x17 portrait
+ % /csheet {1224 1584 //.setpagesize exec} bind def % ANSI C 17x22
+ % /dsheet {1584 2448 //.setpagesize exec} bind def % ANSI D 22x34
+@@ -127,6 +133,7 @@
+ [ /letter /note %do not change this line, needed by 'setpagetype'
+ /legal /lettersmall
+ /11x17 /ledger
++ /postcard /dbl_postcard /Executive /hagaki /jenv_you4 /jenv_you2 /jenv_kaku2
+ /a4small /a3 /a4
+ STRICT { (%END SIZES) .skipeof } if
+ /a0 /a1 /a2 /a5 /a6 /a7 /a8 /a9 /a10
diff --git a/print/ghostscript8-base/files/patch-Resource-Init-gs_ttf.ps b/print/ghostscript8-base/files/patch-Resource-Init-gs_ttf.ps
new file mode 100644
index 000000000000..0d5a025abe1c
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-Resource-Init-gs_ttf.ps
@@ -0,0 +1,24 @@
+--- Resource/Init/gs_ttf.ps.orig Tue Feb 6 20:07:48 2007
++++ Resource/Init/gs_ttf.ps Sat Mar 24 16:15:49 2007
+@@ -997,10 +997,17 @@
+ } ifelse
+ % Stack: ... /FontInfo mark key1 value1 ...
+ post null ne {
+- /ItalicAngle first_post_string 4 gets32 65536.0 div
+- /isFixedPitch first_post_string 12 getu32 0 ne
+- /UnderlinePosition first_post_string 8 gets16 upem div
+- /UnderlineThickness first_post_string 10 gets16 upem div
++ post type /arraytype eq {
++ % this post table is a big table. /post should be [(...) ...]
++ % data we actually need here should be first one in array.
++ /posttable post 1 get def
++ } {
++ /posttable post def
++ } ifelse
++ /ItalicAngle posttable 4 gets32 65536.0 div
++ /isFixedPitch posttable 12 getu32 0 ne
++ /UnderlinePosition posttable 8 gets16 upem div
++ /UnderlineThickness posttable 10 gets16 upem div
+ } if
+ counttomark 0 ne { .dicttomark } { pop pop } ifelse
+ /XUID [orgXUID 42 curxuid]
diff --git a/print/ghostscript8-base/files/patch-Resource-Init-pdf_font.ps b/print/ghostscript8-base/files/patch-Resource-Init-pdf_font.ps
new file mode 100644
index 000000000000..c966e57fba11
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-Resource-Init-pdf_font.ps
@@ -0,0 +1,15 @@
+--- Resource/Init/pdf_font.ps.orig Tue Aug 31 13:03:30 2004
++++ Resource/Init/pdf_font.ps Wed Sep 15 19:15:00 2004
+@@ -1114,10 +1114,12 @@
+
+ /buildCIDType0 { % <CIDFontType0-font-resource> buildCIDType0 <font>
+ dup /BaseFont get findCIDFont exch pop
++ addCIDmetrics /CIDFont defineresource
+ } bdef
+
+ /buildCIDType2 { % <CIDFontType2-font-resource> buildCIDType2 <font>
+ dup /BaseFont get findCIDFont exch pop
++ addCIDmetrics /CIDFont defineresource
+ } bdef
+
+ /processCIDToGIDMap { % <fontres> <cidfont> processCIDToGIDMap <fontres> <cidfont>
diff --git a/print/ghostscript8-base/files/patch-base-Makefile.in b/print/ghostscript8-base/files/patch-base-Makefile.in
new file mode 100644
index 000000000000..fdfac547a986
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-Makefile.in
@@ -0,0 +1,132 @@
+--- base/Makefile.in.orig 2009-12-18 16:04:10.000000000 +0900
++++ base/Makefile.in 2014-11-23 17:40:23.000000000 +0900
+@@ -47,9 +47,9 @@
+ # the directories also define the default search path for the
+ # initialization files (gs_*.ps) and the fonts.
+
+-INSTALL = $(GLSRCDIR)/instcopy -c
+-INSTALL_PROGRAM = $(INSTALL) -m 755
+-INSTALL_DATA = $(INSTALL) -m 644
++INSTALL_PROGRAM = ${BSD_INSTALL_PROGRAM}
++INSTALL_SCRIPT = ${BSD_INSTALL_SCRIPT}
++INSTALL_DATA = ${BSD_INSTALL_DATA}
+ INSTALL_SHARED = @INSTALL_SHARED@
+
+ prefix = @prefix@
+@@ -156,7 +156,7 @@
+ # some older JPEG streams that violate the standard. If the JPEG
+ # library built from local sources, the patch will be applied.
+
+-SHARE_JPEG=@SHARE_LIBJPEG@
++SHARE_JPEG=1
+ JPEG_NAME=jpeg
+
+ # Define the directory where the PNG library sources are stored,
+@@ -164,12 +164,12 @@
+ # You may need to change this if the libpng version changes.
+ # See libpng.mak for more information.
+
+-SHARE_LIBPNG=@SHARE_LIBPNG@
++SHARE_LIBPNG=1
+ PNGSRCDIR=@LIBPNGDIR@
+ LIBPNG_NAME=png
+
+ # libtiff
+-SHARE_LIBTIFF=@SHARE_LIBTIFF@
++SHARE_LIBTIFF=1
+ TIFFSRCDIR=@LIBTIFFDIR@
+ TIFFPLATFORM=unix
+ TIFFCONFIG_SUFFIX=
+@@ -178,7 +178,7 @@
+ # Define the directory where the zlib sources are stored.
+ # See zlib.mak for more information.
+
+-SHARE_ZLIB=@SHARE_ZLIB@
++SHARE_ZLIB=1
+ ZSRCDIR=@ZLIBDIR@
+ #ZLIB_NAME=gz
+ ZLIB_NAME=z
+@@ -254,7 +254,7 @@
+ # Define the added flags for standard, debugging, profiling
+ # and shared object builds.
+
+-CFLAGS_STANDARD=@OPT_CFLAGS@
++CFLAGS_STANDARD?=@OPT_CFLAGS@
+ CFLAGS_DEBUG=-g -O0
+ CFLAGS_PROFILE=-pg @OPT_CFLAGS@
+ CFLAGS_SO=@DYNAMIC_CFLAGS@
+@@ -299,7 +299,7 @@
+ # Solaris may need -lnsl -lsocket -lposix4.
+ # (Libraries required by individual drivers are handled automatically.)
+
+-EXTRALIBS=@LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@
++EXTRALIBS=@LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ -Wl,-export-dynamic
+
+ # Define the standard libraries to search at the end of linking.
+ # Most platforms require -lpthread for the POSIX threads library;
+@@ -343,7 +343,7 @@
+ # the pthread library. Otherwise use SYNC=nosync
+ #SYNC=posync
+ #SYNC=nosync
+-SYNC=@SYNC@
++SYNC=nosync
+
+ # programs we use
+ RM=rm -f
+@@ -436,27 +436,27 @@
+ #DEVICE_DEVS20=$(DD)cljet5.dev $(DD)cljet5c.dev
+ #DEVICE_DEVS21=$(DD)spotcmyk.dev $(DD)devicen.dev $(DD)xcf.dev $(DD)psdcmyk.dev $(DD)psdrgb.dev
+ DEVICE_DEVS=$(DISPLAY_DEV) @X_DEVS@
+-DEVICE_DEVS1=@FILES@
+-DEVICE_DEVS2=@PRINTERS@
+-DEVICE_DEVS3=@CUPSDEV@
+-DEVICE_DEVS4=@IJSDEVS@
+-DEVICE_DEVS5=@OMNIDEVS@
+-DEVICE_DEVS6=@PNGDEVS@
+-DEVICE_DEVS7=@JBIG2DEVS@
+-DEVICE_DEVS8=$(DD)svgwrite.dev
+-DEVICE_DEVS9=
+-DEVICE_DEVS10=
+-DEVICE_DEVS11=
+-DEVICE_DEVS12=
+-DEVICE_DEVS13=
+-DEVICE_DEVS14=
+-DEVICE_DEVS15=
+-DEVICE_DEVS16=
+-DEVICE_DEVS17=
+-DEVICE_DEVS18=
+-DEVICE_DEVS19=
+-DEVICE_DEVS20=
+-DEVICE_DEVS21=
++#DEVICE_DEVS1=@FILES@
++#DEVICE_DEVS2=@PRINTERS@
++#DEVICE_DEVS3=@CUPSDEV@
++#DEVICE_DEVS4=@IJSDEVS@
++#DEVICE_DEVS5=@OMNIDEVS@
++#DEVICE_DEVS6=@PNGDEVS@
++#DEVICE_DEVS7=@JBIG2DEVS@
++#DEVICE_DEVS8=$(DD)svgwrite.dev
++#DEVICE_DEVS9=
++#DEVICE_DEVS10=
++#DEVICE_DEVS11=
++#DEVICE_DEVS12=
++#DEVICE_DEVS13=
++#DEVICE_DEVS14=
++#DEVICE_DEVS15=
++#DEVICE_DEVS16=
++#DEVICE_DEVS17=
++#DEVICE_DEVS18=
++#DEVICE_DEVS19=
++#DEVICE_DEVS20=
++#DEVICE_DEVS21=
+
+
+ # Shared library target to build.
+@@ -490,6 +490,7 @@
+ # ---------------- End of platform-specific section ---------------- #
+
+ INSTALL_CONTRIB=@INSTALL_CONTRIB@
++include $(GLSRCDIR)/drivers.mak
+ include $(GLSRCDIR)/unixhead.mak
+ include $(GLSRCDIR)/gs.mak
+ # psromfs.mak must precede lib.mak
diff --git a/print/ghostscript8-base/files/patch-base-configure.ac b/print/ghostscript8-base/files/patch-base-configure.ac
new file mode 100644
index 000000000000..955405b1c8e7
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-configure.ac
@@ -0,0 +1,57 @@
+--- base/configure.ac.orig 2009-11-24 17:36:27.000000000 +0900
++++ base/configure.ac 2015-08-21 20:48:08.929511000 +0900
+@@ -402,7 +402,7 @@
+ PNGDEVS="$PNGDEVS_ALL"
+ else
+ AC_MSG_RESULT([no])
+- AC_CHECK_LIB(png, png_check_sig, [
++ AC_CHECK_LIB(png, png_sig_cmp, [
+ AC_CHECK_HEADERS(png.h, [
+ SHARE_LIBPNG=1
+ PNGDEVS="$PNGDEVS_ALL"
+@@ -434,7 +434,7 @@
+ AC_CHECK_LIB(tiff, TIFFOpen,
+ [AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])],
+ [], [-ljpeg])
+- if test -z $LOCAL_LIBTIFF_VERSION && test "x$HAVE_SYSTEM_LIBTIFF" == x; then
++ if test -z $LOCAL_LIBTIFF_VERSION && test "x$HAVE_SYSTEM_LIBTIFF" = x; then
+ AC_MSG_NOTICE([Could not find a copy of libtiff on your system.
+ Disabling tiff output devices.])
+ else
+@@ -758,7 +758,7 @@
+ X_DEVS=""
+ X_LIBS=""
+
+-if test x$no_x != xyes; then
++if test x$with_x != xno; then
+ if test "$x_libraries" = "/usr/lib"; then
+ echo "Ignoring X library directory \"$x_libraries\" requested by configure."
+ x_libraries="NONE"
+@@ -1063,7 +1063,11 @@
+ ;;
+ *BSD)
+ DYNAMIC_CFLAGS="-fPIC"
+- DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
++ if test "x$X_DEVS" != x; then
++ INSTALL_SHARED="install-shared"
++ else
++ DYNAMIC_DEVS=""
++ fi
+ DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
+ DYNAMIC_LDFLAGS="-fPIC -shared"
+ DYNAMIC_LIBS=""
+@@ -1119,11 +1123,11 @@
+ fontpath="${fontpath}:$datadir/fonts/default/TrueType"
+
+ # These font directories are used by IRIX...
+- fontpath="${fontpath}:/usr/lib/DPS/outline/base"
++ # fontpath="${fontpath}:/usr/lib/DPS/outline/base"
+
+ # These font directories are used by Solaris...
+- fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1"
+- fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType"
++ # fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1"
++ # fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType"
+
+ # This font directory is used by CUPS...
+ if test "x$CUPSCONFIG" != x; then
diff --git a/print/ghostscript8-base/files/patch-base-contrib.mak b/print/ghostscript8-base/files/patch-base-contrib.mak
new file mode 100644
index 000000000000..9f9406007bb4
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-contrib.mak
@@ -0,0 +1,8 @@
+--- base/contrib.mak.orig 2008-03-04 06:06:45.000000000 +0900
++++ base/contrib.mak 2008-03-04 06:07:11.000000000 +0900
+@@ -858,3 +858,5 @@
+ $(SETPDEV) $(DD)picty180 $(cdeskjet_)
+
+ #########################################################################
++
++include $(GLSRCDIR)/epag.contrib.mak
diff --git a/print/ghostscript8-base/files/patch-base-devs.mak b/print/ghostscript8-base/files/patch-base-devs.mak
new file mode 100644
index 000000000000..8c7cc96f7620
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-devs.mak
@@ -0,0 +1,42 @@
+--- base/devs.mak.orig 2009-11-12 00:50:28.000000000 +0900
++++ base/devs.mak 2015-08-21 20:37:24.364436000 +0900
+@@ -421,10 +421,10 @@
+ ### NON PORTABLE, ONLY UNIX WITH GCC SUPPORT
+
+ $(GLOBJ)lvga256.so : $(lvga256_)
+- $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)lvga256.so $(lvga256_) -lvga -lvgagl
++ $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)lvga256.so $(lvga256_) -lvga -lvgagl $(XLDFLAGS)
+
+ $(GLOBJ)vgalib.so : $(vgalib_)
+- $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)vgalib.so $(vgalib_) -lvga -lvgagl
++ $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)vgalib.so $(vgalib_) -lvga -lvgagl $(XLDFLAGS)
+
+ ### -------------------------- The X11 device -------------------------- ###
+
+@@ -457,7 +457,7 @@
+ $(GLCCSHARED) $(XINCLUDE) $(GLO_)gdevx.$(OBJ) $(C_) $(GLSRC)gdevx.c
+
+ $(GLOBJ)gdevxcmp.$(OBJ) : $(GLSRC)gdevxcmp.c $(GDEVX) $(math__h)
+- $(GLCC) $(XINCLUDE) $(GLO_)gdevxcmp.$(OBJ) $(C_) $(GLSRC)gdevxcmp.c
++ $(GLCCSHARED) $(XINCLUDE) $(GLO_)gdevxcmp.$(OBJ) $(C_) $(GLSRC)gdevxcmp.c
+
+ $(GLOBJ)gdevxini.$(OBJ) : $(GLSRC)gdevxini.c $(GDEVX) $(memory__h)\
+ $(gserrors_h) $(gsparamx_h) $(gxdevmem_h) $(gdevbbox_h)
+@@ -467,7 +467,7 @@
+ # const/non-const cast required by the X headers that we can't work around.
+ $(GLOBJ)gdevxres.$(OBJ) : $(GLSRC)gdevxres.c $(std_h) $(x__h)\
+ $(gsmemory_h) $(gstypes_h) $(gxdevice_h) $(gdevx_h)
+- $(CC_NO_WARN) $(GLCCFLAGS) $(XINCLUDE) $(GLO_)gdevxres.$(OBJ) $(C_) $(GLSRC)gdevxres.c
++ $(GLCCSHARED) $(XINCLUDE) $(GLO_)gdevxres.$(OBJ) $(C_) $(GLSRC)gdevxres.c
+
+ $(GLOBJ)gdevxxf.$(OBJ) : $(GLSRC)gdevxxf.c $(GDEVX) $(math__h) $(memory__h)\
+ $(gsstruct_h) $(gsutil_h) $(gxxfont_h)
+@@ -527,7 +527,7 @@
+ ### NON PORTABLE, ONLY UNIX WITH GCC SUPPORT
+
+ $(GLOBJ)X11.so : $(x11alt_) $(x11_)
+- $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)X11.so $(x11alt_) $(x11_) -L/usr/X11R6/lib -lXt -lSM -lICE -lXext -lX11 $(XLIBDIRS)
++ $(CCLD) $(LDFLAGS) -shared -o $(GLOBJ)X11.so $(x11alt_) $(x11_) -L$(LOCALBASE)/lib -lXt -lSM -lICE -lXext -lX11 $(XLIBDIRS)
+
+ ###### --------------- Memory-buffered printer devices --------------- ######
+
diff --git a/print/ghostscript8-base/files/patch-base-errors.h b/print/ghostscript8-base/files/patch-base-errors.h
new file mode 100644
index 000000000000..89a493c96120
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-errors.h
@@ -0,0 +1,10 @@
+--- base/errors.h.orig 2007-06-06 07:23:38.000000000 +0900
++++ base/errors.h 2009-03-29 03:53:40.000000000 +0900
+@@ -21,6 +21,6 @@
+ */
+
+ /* We include that file here to backward compatibility */
+-#include "ierrors.h"
++#include "../psi/ierrors.h"
+
+ #endif /* errors_INCLUDED */
diff --git a/print/ghostscript8-base/files/patch-base-gdevl256.c b/print/ghostscript8-base/files/patch-base-gdevl256.c
new file mode 100644
index 000000000000..60be4a072b51
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gdevl256.c
@@ -0,0 +1,30 @@
+--- base/gdevl256.c.orig 2007-09-25 22:31:24.000000000 +0900
++++ base/gdevl256.c 2010-08-01 23:05:56.000000000 +0900
+@@ -143,9 +143,12 @@
+ /* for compatibility with the older display modes: */
+ /* these are indexed as 0.0.R0.G0.B0.R1.G1.B1. */
+ gx_color_index
+-lvga256_map_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
+- gx_color_value b)
++lvga256_map_rgb_color(gx_device * dev, const gx_color_value cv[])
+ {
++ gx_color_value r = cv[0];
++ gx_color_value g = cv[1];
++ gx_color_value b = cv[2];
++
+ #define cv_bits(v,n) (v >> (gx_color_value_bits - n))
+ ushort r5 = cv_bits(r, 5), g5 = cv_bits(g, 5), b5 = cv_bits(b, 5);
+ static const byte cube_bits[32] =
+@@ -301,12 +304,3 @@
+ gl_line(x0, y0, x1, y1, color);
+ return 0;
+ }
+-
+-#ifdef GS_DEVS_SHARED
+-extern void gs_lib_register_device(const gx_device *dev);
+-void
+-gs_shared_init(void)
+-{
+- gs_lib_register_device(&gs_lvga256_device);
+-}
+-#endif
diff --git a/print/ghostscript8-base/files/patch-base-gdevperm.c b/print/ghostscript8-base/files/patch-base-gdevperm.c
new file mode 100644
index 000000000000..94b9020eb2c5
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gdevperm.c
@@ -0,0 +1,11 @@
+--- base/gdevperm.c.orig Tue Sep 25 22:31:24 2007
++++ base/gdevperm.c Sat Nov 24 15:11:12 2007
+@@ -286,7 +286,7 @@
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
+
+ static int
+-perm_get_color_comp_index(const gx_device *pdev, const char *pname,
++perm_get_color_comp_index(gx_device *pdev, const char *pname,
+ int name_size, int component_type)
+ {
+ const gx_device_perm_t * const dev = (const gx_device_perm_t *)pdev;
diff --git a/print/ghostscript8-base/files/patch-base-gdevvglb.c b/print/ghostscript8-base/files/patch-base-gdevvglb.c
new file mode 100644
index 000000000000..b0f061ff3a66
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gdevvglb.c
@@ -0,0 +1,32 @@
+--- base/gdevvglb.c.orig 2007-09-25 22:31:24.000000000 +0900
++++ base/gdevvglb.c 2010-08-01 23:08:53.000000000 +0900
+@@ -149,10 +149,13 @@
+ }
+
+ static gx_color_index
+-vgalib_map_rgb_color(gx_device * dev, gx_color_value red,
+- gx_color_value green, gx_color_value blue)
++vgalib_map_rgb_color(gx_device * dev, const gx_color_value cv[])
+ {
+- return pc_4bit_map_rgb_color(dev, red, green, blue);
++ gx_color_value r = cv[0];
++ gx_color_value g = cv[1];
++ gx_color_value b = cv[2];
++
++ return pc_4bit_map_rgb_color(dev, cv);
+ }
+
+ static int
+@@ -368,12 +371,3 @@
+ }
+ return 0;
+ }
+-
+-#ifdef GS_DEVS_SHARED
+-extern void gs_lib_register_device(const gx_device *dev);
+-void
+-gs_shared_init(void)
+-{
+- gs_lib_register_device(&gs_vgalib_device);
+-}
+-#endif
diff --git a/print/ghostscript8-base/files/patch-base-gs.mak b/print/ghostscript8-base/files/patch-base-gs.mak
new file mode 100644
index 000000000000..ecb6f57e0dd7
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gs.mak
@@ -0,0 +1,11 @@
+--- base/gs.mak.orig 2010-05-23 15:46:23.000000000 +0900
++++ base/gs.mak 2010-05-23 15:57:37.000000000 +0900
+@@ -415,7 +415,7 @@
+ ld_tr=$(GLGENDIR)$(D)ld.tr
+ $(ld_tr) : \
+ $(GS_MAK) $(TOP_MAKEFILES) $(GLSRCDIR)$(D)version.mak $(GENCONF_XE) $(ECHOGS_XE) $(devs_tr) $(DEVS_ALL) $(GLGENDIR)$(D)libcore.dev
+- $(EXP)$(GENCONF_XE) $(devs_tr) -h $(gconfig_h) $(CONFILES) $(CONFLDTR) $(ld_tr)
++ $(EXP)$(GENCONF_XE) $(devs_tr) -h /dev/stdout $(CONFILES) $(CONFLDTR) $(ld_tr) | awk 'BEGIN{j=0; p=1;} /jpeg_device/ {if(j++ > 0) p=0;} // {if(p==1) { print; } else { p=1 } }' > $(gconfig_h)
+ $(EXP)$(ECHOGS_XE) -a $(gconfig_h) $(GCONFIG_EXTRAS)
+
+ $(gconfig_h) : $(ld_tr)
diff --git a/print/ghostscript8-base/files/patch-base-gsmalloc.c b/print/ghostscript8-base/files/patch-base-gsmalloc.c
new file mode 100644
index 000000000000..c4982de93012
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gsmalloc.c
@@ -0,0 +1,11 @@
+--- base/gsmalloc.c.orig 2015-07-24 09:52:39.718916000 +0900
++++ base/gsmalloc.c 2015-07-24 09:54:31.761202000 +0900
+@@ -174,7 +174,7 @@
+ } else {
+ uint added = size + sizeof(gs_malloc_block_t);
+
+- if (mmem->limit - added < mmem->used)
++ if (added <= size || mmem->limit - added < mmem->used)
+ set_msg("exceeded limit");
+ else if ((ptr = (byte *) malloc(added)) == 0)
+ set_msg("failed");
diff --git a/print/ghostscript8-base/files/patch-base-gxobj.h b/print/ghostscript8-base/files/patch-base-gxobj.h
new file mode 100644
index 000000000000..529efe379df2
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-gxobj.h
@@ -0,0 +1,18 @@
+--- base/gxobj.h.orig Tue Mar 14 01:18:19 2006
++++ base/gxobj.h Fri Mar 23 14:41:44 2007
+@@ -109,11 +109,15 @@
+ * required by the hardware, regardless of the value of obj_align_mod.
+ * See gsmemraw.h for more information about this.
+ */
++#if !defined(__ia64__) && !defined(__amd64__)
+ #define obj_align_mod\
+ (((ARCH_ALIGN_MEMORY_MOD - 1) |\
+ (align_bitmap_mod - 1) |\
+ (obj_back_scale - 1)) + 1)
+ /* The only possible values for obj_align_mod are 4, 8, or 16.... */
++#else
++#define obj_align_mod 16
++#endif
+ #if obj_align_mod == 4
+ # define log2_obj_align_mod 2
+ #else
diff --git a/print/ghostscript8-base/files/patch-base-ijs.mak b/print/ghostscript8-base/files/patch-base-ijs.mak
new file mode 100644
index 000000000000..26e407247ede
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-ijs.mak
@@ -0,0 +1,20 @@
+--- base/ijs.mak.orig 2012-06-13 02:06:36.000000000 +0900
++++ base/ijs.mak 2012-06-13 02:07:44.000000000 +0900
+@@ -41,7 +41,7 @@
+ ijs.clean : ijs.config-clean ijs.clean-not-config-clean
+
+ ### WRONG. MUST DELETE OBJ AND GEN FILES SELECTIVELY.
+-ijs.clean-not-config-clean :
++ijs.clean-not-config-clean : $(ECHOGS_XE)
+ # echo $(IJSSRC) $(IJSGEN) $(IJSOBJ) $(IJSO_)
+ $(EXP)$(ECHOGS_XE) $(IJSSRC) $(IJSGEN) $(IJSOBJ) $(IJSO_)
+ $(RM_) $(IJSOBJ)*.$(OBJ)
+@@ -61,7 +61,7 @@
+ ijs_client_h=$(IJSSRC)$(D)ijs_client.h
+ ijs_server_h=$(IJSSRC)$(D)ijs_server.h
+
+-$(IJSOBJ)ijs.$(OBJ) : $(IJSSRC)ijs.c $(IJSDEP) $(ijs_h)
++$(IJSOBJ)ijs.$(OBJ) : $(ECHOGS_XE) $(IJSSRC)ijs.c $(IJSDEP) $(ijs_h)
+ # echo $(IJS_CCFLAGS)
+ $(EXP)$(ECHOGS_XE) $(IJS_CCFLAGS)
+ $(IJS_CC) $(IJSO_)ijs.$(OBJ) $(C_) $(IJSSRC)ijs.c
diff --git a/print/ghostscript8-base/files/patch-base-lib.mak b/print/ghostscript8-base/files/patch-base-lib.mak
new file mode 100644
index 000000000000..037390f44f0d
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-lib.mak
@@ -0,0 +1,26 @@
+--- base/lib.mak.orig 2009-12-30 07:18:01.000000000 +0900
++++ base/lib.mak 2015-08-21 20:39:55.003384000 +0900
+@@ -895,7 +895,7 @@
+ $(GLOBJ)gsparamx.$(OBJ) : $(GLSRC)gsparamx.c $(string__h)\
+ $(gserror_h) $(gserrors_h) $(gsmemory_h) $(gsparam_h) $(gsparamx_h)\
+ $(gstypes_h)
+- $(GLCC) $(GLO_)gsparamx.$(OBJ) $(C_) $(GLSRC)gsparamx.c
++ $(GLCCSHARED) $(GLO_)gsparamx.$(OBJ) $(C_) $(GLSRC)gsparamx.c
+
+ # Future replacement for gsparams.c
+ $(GLOBJ)gsparam2.$(OBJ) : $(GLSRC)gsparam2.c $(GXERR) $(memory__h)\
+@@ -2684,12 +2684,12 @@
+ # This is used to access compressed, compiled-in support files
+ gsiorom_h=$(GLSRC)gsiorom.h
+ romfs_=$(GLOBJ)gsiorom.$(OBJ)
+-$(GLD)romfs1.dev : $(LIB_MAK) $(ECHO_XE) $(romfs_)
++$(GLD)romfs1.dev : $(LIB_MAK) $(ECHOGS_XE) $(romfs_)
+ $(SETMOD) $(GLD)romfs1 $(romfs_)
+ $(ADDMOD) $(GLD)romfs1 -iodev rom
+
+ # A dummy romfs when we aren't using COMPILE_INITS
+-$(GLD)romfs0.dev : $(LIB_MAK) $(ECHO_XE)
++$(GLD)romfs0.dev : $(LIB_MAK) $(ECHOGS_XE)
+ $(SETMOD) $(GLD)romfs0
+
+ $(GLGEN)gsromfs1.c : $(MKROMFS_XE) $(PS_ROMFS_DEPS)
diff --git a/print/ghostscript8-base/files/patch-base-sjpx.c b/print/ghostscript8-base/files/patch-base-sjpx.c
new file mode 100644
index 000000000000..761f1423b700
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-sjpx.c
@@ -0,0 +1,36 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2009-02-11
+Initial Package Version: 8.63 (well, it's needed for 8.63, obviously ex 8.61)
+Upstream Status: unknown
+Origin: fedora
+Description: Allows gnu-ghostscript to compile against external libjasper.
+ To do that, you need to remove the jasper/ directory. The included version
+is 1.701 which is somewhat old. Forward-ported to 8.64 (the structure of
+the file source tree has changed) by km.
+
+diff -Naur ghostscript-8.64.orig/base/sjpx.c ghostscript-8.64/base/sjpx.c
+--- base/sjpx.c 2008-08-21 00:22:49.000000000 +0100
++++ base/sjpx.c 2009-02-10 21:59:41.000000000 +0000
+@@ -34,14 +34,6 @@
+ private_st_jpxd_state(); /* creates a gc object for our state,
+ defined in sjpx.h */
+
+-/* error reporting callback for the jpx library */
+-static void
+-s_jpx_jas_error_cb(jas_error_t err, char *msg)
+-{
+- dprintf2("jasper (code %d) %s", (int)err, msg);
+-}
+-
+-
+ /* initialize the steam.
+ this involves allocating the stream and image structures, and
+ initializing the decoder.
+@@ -59,7 +51,6 @@
+ }
+
+ status = jas_init();
+- jas_set_error_cb(s_jpx_jas_error_cb);
+ #ifdef JPX_DEBUG
+ /* raise the error reporting threshold from the default (0) */
+ jas_setdbglevel(1);
diff --git a/print/ghostscript8-base/files/patch-base-unix-dll.mak b/print/ghostscript8-base/files/patch-base-unix-dll.mak
new file mode 100644
index 000000000000..96876e3bfb15
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-unix-dll.mak
@@ -0,0 +1,17 @@
+--- base/unix-dll.mak.orig 2009-10-20 05:24:53.000000000 +0900
++++ base/unix-dll.mak 2010-04-03 12:22:35.000000000 +0900
+@@ -79,12 +79,11 @@
+ # Build the small Ghostscript loaders, with Gtk+ and without
+
+ $(GSSOC_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
+- $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \
+- $(LDFLAGS) -L$(BINDIR) -l$(GS)
++ $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c -L$(BINDIR) -l$(GS)
+
+ $(GSSOX_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
+ $(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \
+- $(LDFLAGS) -L$(BINDIR) -l$(GS) $(SOC_LIBS)
++ -L$(BINDIR) -l$(GS) $(SOC_LIBS)
+
+ # ------------------------- Recursive make targets ------------------------- #
+
diff --git a/print/ghostscript8-base/files/patch-base-unix-gcc.mak b/print/ghostscript8-base/files/patch-base-unix-gcc.mak
new file mode 100644
index 000000000000..4277ce7ed6c3
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-unix-gcc.mak
@@ -0,0 +1,216 @@
+--- base/unix-gcc.mak.orig 2008-10-03 04:33:22.000000000 +0900
++++ base/unix-gcc.mak 2009-03-29 03:33:35.000000000 +0900
+@@ -21,15 +21,18 @@
+ # source, generated intermediate file, and object directories
+ # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
+
++.CURDIR?=.
+ BINDIR=./bin
+-GLSRCDIR=./base
+-GLGENDIR=./obj
+-GLOBJDIR=./obj
+-PSSRCDIR=./psi
+-PSLIBDIR=./lib
+-PSRESDIR=./Resource
+-PSGENDIR=./obj
+-PSOBJDIR=./obj
++BINDIR=${.CURDIR}/bin
++GLSRCDIR=${.CURDIR}/base
++GLGENDIR=${.CURDIR}/obj
++GLOBJDIR=${.CURDIR}/obj
++PSSRCDIR=${.CURDIR}/psi
++PSLIBDIR=${.CURDIR}/lib
++PSRESDIR=${.CURDIR}/Resource
++PSGENDIR=${.CURDIR}/obj
++PSOBJDIR=${.CURDIR}/obj
++CONTRIBDIR=${.CURDIR}/contrib
+
+ # Do not edit the next group of lines.
+
+@@ -48,11 +51,10 @@
+ # the directories also define the default search path for the
+ # initialization files (gs_*.ps) and the fonts.
+
+-INSTALL = $(GLSRCDIR)/instcopy -c
+-INSTALL_PROGRAM = $(INSTALL) -m 755
+-INSTALL_DATA = $(INSTALL) -m 644
++INSTALL_PROGRAM = ${BSD_INSTALL_SCRIPT}
++INSTALL_DATA = ${BSD_INSTALL_DATA}
+
+-prefix = /usr/local
++prefix = ${PREFIX}
+ exec_prefix = $(prefix)
+ bindir = $(exec_prefix)/bin
+ scriptdir = $(bindir)
+@@ -107,7 +109,7 @@
+ # -DHAVE_HYPOT
+ # use the system hypot() call
+
+-CAPOPT= -DHAVE_MKSTEMP
++CAPOPT= -DHAVE_MKSTEMP -DHAVE_HYPOT
+
+ # Define the name of the executable file.
+
+@@ -131,7 +133,7 @@
+ # some older JPEG streams that violate the standard. If the JPEG
+ # library built from local sources, the patch will be applied.
+
+-SHARE_JPEG=0
++SHARE_JPEG=1
+ JPEG_NAME=jpeg
+
+ # Define the directory where the PNG library sources are stored,
+@@ -145,7 +147,7 @@
+ # what its name is.
+ # See gs.mak and Make.htm for more information.
+
+-SHARE_LIBPNG=0
++SHARE_LIBPNG=1
+ LIBPNG_NAME=png
+
+ # Define the directory where the zlib sources are stored.
+@@ -157,7 +159,7 @@
+ # what its name is (usually libz, but sometimes libgz).
+ # See gs.mak and Make.htm for more information.
+
+-SHARE_ZLIB=0
++SHARE_ZLIB=1
+ #ZLIB_NAME=gz
+ ZLIB_NAME=z
+
+@@ -166,6 +168,14 @@
+ JBIG2_LIB=jbig2dec
+ JBIG2SRCDIR=jbig2dec
+
++# Choose the library to use for (JPXDecode support)
++# whether to link to an external build or compile in from source
++# and source location and configuration flags for compiling in
++JPX_LIB=jasper
++SHARE_JPX=0
++JPXSRCDIR=jasper
++JPX_CFLAGS=-DJAS_CONFIGURE
++
+ # Define the directory where the icclib source are stored.
+ # See icclib.mak for more information
+
+@@ -194,7 +204,7 @@
+
+ # Define the name of the C compiler.
+
+-CC=gcc
++CC?=cc
+
+ # Define the name of the linker for the final link step.
+ # Normally this is the same as the C compiler.
+@@ -211,10 +221,10 @@
+ # Define the added flags for standard, debugging, profiling
+ # and shared object builds.
+
+-CFLAGS_STANDARD=-O2
++CFLAGS_STANDARD?=-O2
+ CFLAGS_DEBUG=-g -O0
+ CFLAGS_PROFILE=-pg -O2
+-CFLAGS_SO=-fPIC -shared
++CFLAGS_SO=-fPIC
+
+ # Define the other compilation flags. Add at most one of the following:
+ # -DBSD4_2 for 4.2bsd systems.
+@@ -227,7 +237,8 @@
+ # We don't include -ansi, because this gets in the way of the platform-
+ # specific stuff that <math.h> typically needs; nevertheless, we expect
+ # gcc to accept ANSI-style function prototypes and function definitions.
+-XCFLAGS=-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\"$(gssharedir)\"
++#XCFLAGS+=-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\"$(gssharedir)\"
++XCFLAGS+=-DUPD_SIGNAL=0 -I${JPXSRCDIR}/src/libjasper/include -I${LOCALBASE}/include/libpng -I${LOCALBASE}/include
+
+ CFLAGS=$(CFLAGS_STANDARD) $(GCFLAGS) $(XCFLAGS)
+
+@@ -238,7 +249,7 @@
+ # -R /usr/local/xxx/lib:/usr/local/lib
+ # giving the full path names of the shared library directories.
+ # XLDFLAGS can be set from the command line.
+-XLDFLAGS=
++XLDFLAGS+=-L${LOCALBASE}/lib
+
+ LDFLAGS=$(XLDFLAGS)
+
+@@ -249,7 +260,7 @@
+ # Solaris may need -lnsl -lsocket -lposix4.
+ # (Libraries required by individual drivers are handled automatically.)
+
+-EXTRALIBS=-rdynamic -ldl
++EXTRALIBS+=-Wl,-export-dynamic
+
+ # Define the standard libraries to search at the end of linking.
+ # Most platforms require -lpthread for the POSIX threads library;
+@@ -271,7 +282,7 @@
+ # Note that x_.h expects to find the header files in $(XINCLUDE)/X11,
+ # not in $(XINCLUDE).
+
+-XINCLUDE=-I/usr/X11R6/include
++XINCLUDE=-I${LOCALBASE}/include
+
+ # Define the directory/ies and library names for the X11 library files.
+ # XLIBDIRS is for ld and should include -L; XLIBDIR is for LD_RUN_PATH
+@@ -283,28 +294,28 @@
+ # Solaris and other SVR4 systems with dynamic linking probably want
+ #XLIBDIRS=-L/usr/openwin/lib -R/usr/openwin/lib
+ # X11R6 (on any platform) may need
+-#XLIBS=Xt SM ICE Xext X11
++XLIBS=Xt SM ICE Xext X11
+
+ #XLIBDIRS=-L/usr/local/X/lib
+-XLIBDIRS=-L/usr/X11R6/lib
++XLIBDIRS=-L${LOCALBASE}/lib
+ XLIBDIR=
+-XLIBS=Xt Xext X11
++#XLIBS=Xt Xext X11
+
+ # Define the .dev module that implements thread and synchronization
+ # primitives for this platform.
+
+ # If POSIX sync primitives are used, also change the STDLIBS to include
+ # the pthread library.
+-#SYNC=posync
++SYNC=posync
+
+ # Default is No sync primitives since some platforms don't have it (HP-UX)
+-SYNC=nosync
++#SYNC=nosync
+
+ # ------ Devices and features ------ #
+
+ # Choose the language feature(s) to include. See gs.mak for details.
+
+-FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev
++FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev $(PSD)jbig2.dev $(PSD)jpx.dev
+ #FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev
+ # The following is strictly for testing.
+ FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev
+@@ -389,7 +400,7 @@
+ DEVICE_DEVS21=$(DD)spotcmyk.dev $(DD)devicen.dev $(DD)xcf.dev $(DD)bmpsep1.dev $(DD)bmpsep8.dev $(DD)bmp16m.dev $(DD)bmp32b.dev $(DD)psdcmyk.dev $(DD)psdrgb.dev $(DD)pamcmyk32.dev
+
+ # Shared library target to build.
+-GS_SHARED_OBJS=$(GLOBJDIR)/X11.so $(GLOBJDIR)/lvga256.so $(GLOBJDIR)/vgalib.so
++#GS_SHARED_OBJS=$(GLOBJDIR)/X11.so $(GLOBJDIR)/lvga256.so $(GLOBJDIR)/vgalib.so
+ #GS_SHARED_OBJS=$(GLOBJDIR)/X11.so
+
+ # ---------------------------- End of options --------------------------- #
+@@ -429,6 +440,9 @@
+ include $(GLSRCDIR)/zlib.mak
+ include $(GLSRCDIR)/libpng.mak
+ include $(GLSRCDIR)/jbig2.mak
++include $(GLSRCDIR)/jasper.mak
++include $(GLSRCDIR)/ldf_jb2.mak
++include $(GLSRCDIR)/lwf_jp2.mak
+ include $(GLSRCDIR)/icclib.mak
+ include $(GLSRCDIR)/ijs.mak
+ include $(GLSRCDIR)/devs.mak
+@@ -438,6 +452,7 @@
+ include $(GLSRCDIR)/unix-dll.mak
+ include $(GLSRCDIR)/unix-end.mak
+ include $(GLSRCDIR)/unixinst.mak
++include $(CONTRIBDIR)/contrib.mak
+
+ # This has to come last so it won't be taken as the default target.
+ $(AK):
diff --git a/print/ghostscript8-base/files/patch-base-unixinst.mak b/print/ghostscript8-base/files/patch-base-unixinst.mak
new file mode 100644
index 000000000000..4f6006f3a9a8
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-base-unixinst.mak
@@ -0,0 +1,20 @@
+--- base/unixinst.mak.orig 2009-11-19 09:09:15.000000000 +0900
++++ base/unixinst.mak 2014-11-23 17:40:46.000000000 +0900
+@@ -44,7 +44,7 @@
+ wftopfa fixmswrd.pl lprsetup.sh pj-gs.sh pv.sh sysvlp.sh unix-lpr.sh ;\
+ do if ( test -f $(PSLIBDIR)/$$f ); then \
+ (cat $(PSLIBDIR)/$$f | sed -e "s/GS_EXECUTABLE=gs/GS_EXECUTABLE=$(GS)/" > $(PSOBJDIR)/$$f); \
+- $(INSTALL_PROGRAM) $(PSOBJDIR)/$$f $(DESTDIR)$(scriptdir)/$$f; \
++ $(INSTALL_SCRIPT) $(PSOBJDIR)/$$f $(DESTDIR)$(scriptdir)/$$f; \
+ fi;\
+ done'
+
+@@ -128,7 +128,7 @@
+ done'
+
+ # install the man pages for each locale
+-MAN_LCDIRS=. de
++MAN_LCDIRS=.
+ MAN1_LINKS_PS2PS=eps2eps
+ MAN1_LINKS_PS2PDF=ps2pdf12 ps2pdf13
+ MAN1_LINKS_GSLP=gsbj gsdj gsdj500 gslj
diff --git a/print/ghostscript8-base/files/patch-contrib-contrib.mak b/print/ghostscript8-base/files/patch-contrib-contrib.mak
new file mode 100644
index 000000000000..f255865761a5
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-contrib-contrib.mak
@@ -0,0 +1,11 @@
+--- contrib/contrib.mak.orig 2012-06-13 01:22:12.000000000 +0900
++++ contrib/contrib.mak 2012-06-13 01:22:40.000000000 +0900
+@@ -956,7 +956,7 @@
+ $(GLOBJ)gdevdmpr.$(OBJ) : $(JAPSRC)gdevdmpr.c $(JAPSRC)dviprlib.h $(PDEVH)
+ $(GLCC) $(O_)$@ $(C_) $(JAPSRC)gdevdmpr.c
+
+-$(GLOBJ)dviprlib.$(OBJ) : $(JAPSRC)dviprlib.c $(JAPSRC)dviprlib.h
++$(GLOBJ)dviprlib.$(OBJ) : $(arch_h) $(stdio__h) $(JAPSRC)dviprlib.c $(JAPSRC)dviprlib.h
+ $(GLCC) $(O_)$@ $(C_) $(JAPSRC)dviprlib.c
+
+ extra-dmprt-install:
diff --git a/print/ghostscript8-base/files/patch-contrib__japanese__dmp_site.ps b/print/ghostscript8-base/files/patch-contrib__japanese__dmp_site.ps
new file mode 100644
index 000000000000..472e54c82318
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-contrib__japanese__dmp_site.ps
@@ -0,0 +1,11 @@
+--- contrib/japanese/dmp_site.ps.orig 2007-05-09 07:00:10.000000000 +0900
++++ contrib/japanese/dmp_site.ps 2015-08-21 19:15:38.311336000 +0900
+@@ -1,7 +1,7 @@
+ %!
+ BeginConfig
+ %%%%%%%%%%%%%%%%%%%%%% Standard user cusomizations %%%%%%%%%%%%%%%%%%%%%
+-/printer (escp_24.src)
++/printer (%%DATADIR%%/lib/escp_24.src)
+ % horizontal / vertical
+ % /resolution [ 180.0 180.0 ]
+ % horizontal / vertical
diff --git a/print/ghostscript8-base/files/patch-contrib__japanese__gdevdmpr.c b/print/ghostscript8-base/files/patch-contrib__japanese__gdevdmpr.c
new file mode 100644
index 000000000000..1e6c3261d464
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-contrib__japanese__gdevdmpr.c
@@ -0,0 +1,44 @@
+--- contrib/japanese/gdevdmpr.c.orig Thu Apr 26 01:27:24 2007
++++ contrib/japanese/gdevdmpr.c Tue May 15 01:44:09 2007
+@@ -41,8 +41,6 @@
+ /* include library header. */
+ #include "dviprlib.h"
+
+-extern FILE *lib_fopen(const char *);
+-
+ #define LOCAL_DEBUG 0
+
+ #define DEVICE_NAME "dmprt"
+@@ -405,8 +403,6 @@
+ if (pddev->dmprt.max_height>0 && pddev->dmprt.max_height<pddev->height)
+ pddev->height = pddev->dmprt.max_height;
+
+- dviprt_setmessagestream(pddev->dmprt.debug_f ? stderr : NULL);
+-
+ return code;
+ }
+
+@@ -425,8 +421,6 @@
+ if (code < 0) return code;
+ if (code == 0) pddev->dmprt.debug_f = vbool;
+
+- dviprt_setmessagestream(pddev->dmprt.debug_f ? stderr : NULL);
+-
+ code = param_read_bool(plist, "Verbose", &vbool);
+ if (code < 0) return code;
+ pddev->dmprt.verbose_f = vbool;
+@@ -841,13 +835,12 @@
+ char *env;
+
+ strcpy(fname,fnamebase);
+- fp = lib_fopen(fname);
++ fp = fopen(fname,"r");
+ if (fp == NULL) {
+ env = getenv("TEXCFG");
+ if (env) {
+ strcpy(fname,env);
+ strcat(fname, gp_file_name_concat_string(env,strlen(env)));
+- strcat(fname,fnamebase);
+ fp = fopen(fname,gp_fmode_rb);
+ }
+ }
diff --git a/print/ghostscript8-base/files/patch-epag-ert.c b/print/ghostscript8-base/files/patch-epag-ert.c
new file mode 100644
index 000000000000..f063aeddabc2
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-epag-ert.c
@@ -0,0 +1,11 @@
+--- epag-3.09/ert.c.orig 2000-07-08 13:33:09.000000000 +0900
++++ epag/ert.c 2012-02-13 03:38:07.000000000 +0900
+@@ -1,6 +1,8 @@
+ /* $Id: ert.c,v 1.3 1998/11/20 10:51:12 nari Exp $ */
+
+ #include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
+
+ /*
+ * EPSON Remoteのコマンドを出力するコマンド
diff --git a/print/ghostscript8-base/files/patch-epag__gdevepag.c b/print/ghostscript8-base/files/patch-epag__gdevepag.c
new file mode 100644
index 000000000000..6012768b4d9c
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-epag__gdevepag.c
@@ -0,0 +1,217 @@
+--- epag/gdevepag.c.orig Sat Jul 8 13:33:09 2000
++++ epag/gdevepag.c Sat Nov 24 15:25:11 2007
+@@ -102,30 +102,30 @@
+ } EpagBubble;
+
+ /* The device descriptors */
+-private dev_proc_open_device(epag_open);
+-private dev_proc_close_device(epag_close);
+-private dev_proc_print_page(epag_print_page);
+-private void epag_printer_initialize(gx_device_printer *pdev, FILE *fp,int);
+-private dev_proc_print_page(epag_print_page);
+-private dev_proc_get_params(epag_get_params);
+-private dev_proc_put_params(epag_put_params);
+-private void epag_paper_set(gx_device_printer *pdev, FILE *fp);
+-private void epag_bubble_flush_all(EpagPageCont *cont);
+-private void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,EpagPageCont *cont);
+-private void epag_page_close(EpagPageCont *cont);
+-private int epag_read_image(EpagPageCont *cont);
+-private void epag_process_line(EpagPageCont *cont);
+-private int epag_is_black(EpagPageCont *cont, int bx);
+-private void epag_rect_add(EpagPageCont *cont,int start,int end);
+-private void epag_bubble_gen(EpagPageCont *cont,
++static dev_proc_open_device(epag_open);
++static dev_proc_close_device(epag_close);
++static dev_proc_print_page(epag_print_page);
++static void epag_printer_initialize(gx_device_printer *pdev, FILE *fp,int);
++static dev_proc_print_page(epag_print_page);
++static dev_proc_get_params(epag_get_params);
++static dev_proc_put_params(epag_put_params);
++static void epag_paper_set(gx_device_printer *pdev, FILE *fp);
++static void epag_bubble_flush_all(EpagPageCont *cont);
++static void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,EpagPageCont *cont);
++static void epag_page_close(EpagPageCont *cont);
++static int epag_read_image(EpagPageCont *cont);
++static void epag_process_line(EpagPageCont *cont);
++static int epag_is_black(EpagPageCont *cont, int bx);
++static void epag_rect_add(EpagPageCont *cont,int start,int end);
++static void epag_bubble_gen(EpagPageCont *cont,
+ int x0, int x1, int y0, int y1);
+-private void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl);
+-private void epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl);
++static void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl);
++static void epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl);
+
+ /*
+ * デバイスの宣言
+ */
+-private gx_device_procs prn_epag_procs =
++static gx_device_procs prn_epag_procs =
+ prn_params_procs(epag_open, gdev_prn_output_page, epag_close,
+ epag_get_params, epag_put_params);
+ gx_device_printer far_data gs_epag_device =
+@@ -140,13 +140,13 @@
+ static char *epson_remote_start = "\033\001@EJL \r\n";
+
+ /* Open the printer, adjusting the margins if necessary. */
+-private int
++static int
+ epag_open(gx_device *pdev)
+ {
+ return gdev_prn_open(pdev);
+ }
+
+-private int
++static int
+ epag_close(gx_device *pdev)
+ {
+ gdev_prn_open_printer(pdev, 1);
+@@ -163,7 +163,7 @@
+ return gdev_prn_close(pdev);
+ }
+
+-private int
++static int
+ epag_print_page(gx_device_printer *pdev, FILE *fp)
+ {
+ EpagPageCont cont;
+@@ -205,7 +205,7 @@
+ GS, '2', 'a', 'b', 'P', /* イメージ描画後下へ */
+ };
+
+-private void
++static void
+ epag_printer_initialize(gx_device_printer *pdev, FILE *fp, int copies)
+ {
+ double xDpi,yDpi;
+@@ -260,7 +260,7 @@
+ fprintf(fp,"%c%dcoO",GS, copies < 256 ? copies : 255);
+ }
+
+-private int
++static int
+ epag_get_params(gx_device *pdev, gs_param_list *plist)
+ {
+ int code;
+@@ -286,7 +286,7 @@
+ }
+
+ /* Put properties. */
+-private int
++static int
+ epag_put_params(gx_device *pdev, gs_param_list *plist)
+ {
+ param_read_int(plist, "cRowBuf", &epag_cont.cRowBuf);
+@@ -380,7 +380,7 @@
+ /*
+ * epag_bubble_flush_all: 残っている bubbleを全て出力する。
+ */
+-private void epag_bubble_flush_all(EpagPageCont *cont)
++static void epag_bubble_flush_all(EpagPageCont *cont)
+ {
+ int i;
+
+@@ -392,7 +392,7 @@
+ /*
+ * epag_page_cont_init: EpagPageContの初期化、バッファ確保等
+ */
+-private void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,
++static void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,
+ EpagPageCont *cont)
+ {
+ int bpl;
+@@ -417,15 +417,15 @@
+ cont->maxY = epag_cont.cRowBuf / cont->bh * cont->bh ;
+ if(cont->maxY < cont->bh) cont->maxY = cont->bh;
+
+- cont->bp = gs_malloc(bpl , cont->maxY, "epag_skip_blank_init(bp)");
+- cont->bp2 = gs_malloc(bpl*3/2+1 , cont->maxY, "epag_skip_blank_init(bp2)");
++ cont->bp = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl , cont->maxY, "epag_skip_blank_init(bp)");
++ cont->bp2 = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl*3/2+1 , cont->maxY, "epag_skip_blank_init(bp2)");
+
+ cont->h = cont->r = 0;
+
+- cont->bubbleTbl=gs_malloc(sizeof(EpagBubble *),cont->maxBx,"bubbleTbl");
++ cont->bubbleTbl = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(EpagBubble *),cont->maxBx,"bubbleTbl");
+ for(i=0;i<cont->maxBx;i++)
+ cont->bubbleTbl[i] = NULL;
+- cont->bubbleBuffer=gs_malloc(sizeof(EpagBubble),cont->maxBx,"bubbleBuffer");
++ cont->bubbleBuffer=gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(EpagBubble),cont->maxBx,"bubbleBuffer");
+ bbtbl = (EpagBubble *)cont->bubbleBuffer;
+ for(i=0;i<cont->maxBx-1;i++)
+ bbtbl[i].next = &bbtbl[i+1];
+@@ -433,15 +433,15 @@
+ cont->freeBubbleList = &bbtbl[0];
+ }
+
+-private void
++static void
+ epag_page_close(EpagPageCont *cont)
+ {
+- gs_free(cont->bp, bpl, cont->maxY, "epag_skip_blank_init(bp)");
+- gs_free(cont->bp2, bpl*3/2+1, cont->maxY, "epag_skip_blank_init(bp2)");
+- gs_free(cont->bubbleBuffer, sizeof(EpagBubble), cont->maxBx,"bubbleBuffer");
++ gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bp, bpl, cont->maxY, "epag_skip_blank_init(bp)");
++ gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bp2, bpl*3/2+1, cont->maxY, "epag_skip_blank_init(bp2)");
++ gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bubbleBuffer, sizeof(EpagBubble), cont->maxBx,"bubbleBuffer");
+ }
+
+-private int
++static int
+ epag_read_image(EpagPageCont *cont)
+ {
+ int bh = cont->bh;
+@@ -473,7 +473,7 @@
+ /*
+ * bh行分のラスターデータを処理する
+ */
+-private void
++static void
+ epag_process_line(EpagPageCont *cont)
+ {
+ int bh = cont->bh;
+@@ -502,7 +502,7 @@
+ else epag_rect_add(cont, 0, cont->maxBx-1);
+ }
+
+-private int
++static int
+ epag_is_black(EpagPageCont *cont, int bx)
+ {
+ int bh = cont->bh;
+@@ -520,7 +520,7 @@
+ return 0;
+ }
+
+-private void
++static void
+ epag_rect_add(EpagPageCont *cont,int start,int end)
+ {
+ int x0 = start * cont->bw;
+@@ -544,7 +544,7 @@
+ }
+ }
+
+-private void
++static void
+ epag_bubble_gen(EpagPageCont *cont, int x0, int x1, int y0, int y1)
+ {
+ EpagBubble *bbl;
+@@ -569,7 +569,7 @@
+ }
+ }
+
+-private void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl)
++static void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl)
+ {
+ int bx,bx0,bx1;
+
+@@ -588,7 +588,7 @@
+
+ /* イメージを出力 */
+
+-private void
++static void
+ epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl)
+ {
+ FILE *fp = cont->fp;
diff --git a/print/ghostscript8-base/files/patch-lib-FAPIcidfmap b/print/ghostscript8-base/files/patch-lib-FAPIcidfmap
new file mode 100644
index 000000000000..156c3e8458f2
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-lib-FAPIcidfmap
@@ -0,0 +1,62 @@
+--- lib/FAPIcidfmap.orig 2006-06-01 00:29:52.000000000 +0900
++++ lib/FAPIcidfmap 2009-05-15 03:27:31.000000000 +0900
+@@ -29,4 +29,59 @@
+ %
+ % /Ryumin-Medium << /Path (msgothic.ttc) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ;
+ % /HeiseiKakuGo-W5 << /Path (F:/WIN2000/Fonts/BATANG.TTC) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ;
++%/Ryumin-Light << /Path (Ryumin-Light) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ;
++%/GothicBBB-Medium << /Path (GothicBBB-Medium) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ;
++
++/Ryumin-Medium /Ryumin-Light ;
++/Ryumin-Regular /Ryumin-Light ;
++/RyuminPro-Light /Ryumin-Light ;
++
++/GothicBBBPro-Medium /GothicBBB-Medium ;
++
++/KozGoPro-Bold /GothicBBB-Medium ;
++/KozGoPro-Heavy /GothicBBB-Medium ;
++/KozGoPro-Medium /GothicBBB-Medium ;
++/KozGoPro-Regular /GothicBBB-Medium ;
++
++/KozMinPro-Bold /Ryumin-Light ;
++/KozMinPro-Light /Ryumin-Light ;
++/KozMinPro-Medium /Ryumin-Light ;
++/KozMinPro-Regular /Ryumin-Light ;
++
++/HiraKakuPro-W3 /GothicBBB-Medium ;
++/HiraKakuPro-W6 /GothicBBB-Medium ;
++/HiraKakuStd-W8 /GothicBBB-Medium ;
++
++/HiraMaruPro-W4 /GothicBBB-Medium ;
+
++/HiraMinPro-W3 /Ryumin-Light ;
++
++/HeiseiMin-W3 /Ryumin-Light ;
++/HeiseiKakuGo-W5 /GothicBBB-Medium ;
++
++/FutoMinA101-Bold /Ryumin-Light ;
++/FutoMinA101Pro-Bold /Ryumin-Light ;
++/FutoGoB101-Bold /GothicBBB-Medium ;
++/FutoGoB101Pro-Bold /GothicBBB-Medium ;
++
++/Jun101-Light /Ryumin-Light ;
++/Jun101Pro-Light /Ryumin-Light ;
++
++/MidashiGo-MB31 /GothicBBB-Medium ;
++/MidashiGoPro-MB31 /GothicBBB-Medium ;
++
++/MidashiMinPro-MA31 /Ryumin-Light ;
++
++%/Munhwa-Regular /Munhwa-Regular ;
++%/MunhwaGothic-Regular /MunhwaGothic-Regular ;
++%/Munhwa-Bold /Munhwa-Bold ;
++%/MunhwaGothic-Bold /MunhwaGothic-Bold ;
++
++/HYGoThic-Medium /MunhwaGothic-Regular ;
++/HYSMyeongJo-Medium /Munhwa-Regular ;
++/HYRGoThic-Medium /MunhwaGothic-Bold ;
++
++%/STHeiti-Regular << /Path (STHeiti-Regular) /CIDFontType 0 /FAPI /UFST /CSI [(CNS1) 5] >> ;
++%/STSong-Light << /Path (STSong-Light) /CIDFontType 0 /FAPI /UFST /CSI [(GB1) 5] >> ;
++%/MSung-Light << /Path (MSung-Light) /CIDFontType 0 /FAPI /UFST /CSI [(CNS1) 5] >> ;
++%/MHei-Medium << /Path (MHei-Medium) /CIDFontType 0 /FAPI /UFST /CSI [(GB1) 5] >> ;
diff --git a/print/ghostscript8-base/files/patch-lib-FAPIconfig b/print/ghostscript8-base/files/patch-lib-FAPIconfig
new file mode 100644
index 000000000000..f72f2fd9a6c0
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-lib-FAPIconfig
@@ -0,0 +1,21 @@
+--- lib/FAPIconfig.orig 2008-03-04 06:50:24.000000000 +0900
++++ lib/FAPIconfig 2008-03-04 06:51:30.000000000 +0900
+@@ -2,10 +2,14 @@
+ % $Id: FAPIconfig 6870 2006-06-20 16:31:15Z leonardo $
+ % This is configuration file for FAPI client.
+
+-/FontPath (/Fonts) % A default directory for FAPI-handled font files path in FAPIfontmap.
+-/CIDFontPath (/CIDFonts) % A default directory for FAPI-handled CID font files path in FAPIcidfmap.
+-/HookDiskFonts [1 2 9 11 42] % FontType values for disk PS fonts to be redirected to FAPI.
+-/HookEmbeddedFonts [1 2 9 11 42] % FontType values for embedded PS fonts to be redirected to FAPI.
++%/FontPath (/Fonts) % A default directory for FAPI-handled font files path in FAPIfontmap.
++/FontPath () % A default directory for FAPI-handled font files path in FAPIfontmap.
++%/CIDFontPath (/CIDFonts) % A default directory for FAPI-handled CID font files path in FAPIcidfmap.
++/CIDFontPath () % A default directory for FAPI-handled CID font files path in FAPIcidfmap.
++%/HookDiskFonts [1 2 9 11 42] % FontType values for disk PS fonts to be redirected to FAPI.
++/HookDiskFonts [] % FontType values for disk PS fonts to be redirected to FAPI.
++%/HookEmbeddedFonts [1 2 9 11 42] % FontType values for embedded PS fonts to be redirected to FAPI.
++/HookEmbeddedFonts [] % FontType values for embedded PS fonts to be redirected to FAPI.
+
+ % Values allowed for HookDiskFonts and HookEmbeddedFonts are 1, 2, 9, 11, 42.
+ % "Disk fonts" are fonts being installed to Ghostscript with 'lib/Fontmap' or with GS_FONTPATH,
diff --git a/print/ghostscript8-base/files/patch-lib-pdf2dsc.ps b/print/ghostscript8-base/files/patch-lib-pdf2dsc.ps
new file mode 100644
index 000000000000..dab7f7a1b84c
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-lib-pdf2dsc.ps
@@ -0,0 +1,11 @@
+--- lib/pdf2dsc.ps.orig 2011-05-24 05:26:51.000000000 +0900
++++ lib/pdf2dsc.ps 2011-05-24 05:27:14.000000000 +0900
+@@ -116,7 +116,7 @@
+ DSCfile PDFname write==only
+ ( \(r\) file { DELAYSAFER { .setsafe } if } stopped pop\n) puts
+ ( pdfopen begin\n) puts
+- ( copy_trailer_attrs\n) puts
++ ( process_trailer_attrs\n) puts
+ (%%EndSetup\n) puts
+
+ /.hasPageLabels false def % see "Page Labels" in the PDF Reference
diff --git a/print/ghostscript8-base/files/patch-libpng15 b/print/ghostscript8-base/files/patch-libpng15
new file mode 100644
index 000000000000..dca4f07607f7
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-libpng15
@@ -0,0 +1,196 @@
+$NetBSD: patch-ak,v 1.5 2011/01/15 14:08:10 wiz Exp $
+
+Fix build with png-1.5. From John Bowler.
+
+--- base/gdevpng.c.orig 2008-07-17 02:34:01.000000000 +0000
++++ base/gdevpng.c
+@@ -36,12 +36,14 @@
+ #include "gdevpccm.h"
+ #include "gscdefs.h"
+
+-#define PNG_INTERNAL
+ /*
+ * libpng versions 1.0.3 and later allow disabling access to the stdxxx
+ * files while retaining support for FILE * I/O.
++ *
++ * This is a misunderstanding - this is a build time option for libpng,
++ * it has no effect on a user of libpng.
+ */
+-#define PNG_NO_CONSOLE_IO
++/*#define PNG_NO_CONSOLE_IO*/
+ /*
+ * Earlier libpng versions require disabling FILE * I/O altogether.
+ * This produces a compiler warning about no prototype for png_init_io.
+@@ -280,7 +282,7 @@ png_print_page(gx_device_printer * pdev,
+ goto done;
+ }
+ /* set error handling */
+- if (setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_jmpbuf(png_ptr))) {
+ /* If we get here, we had a problem reading the file */
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
+@@ -290,19 +292,12 @@ png_print_page(gx_device_printer * pdev,
+ png_init_io(png_ptr, file);
+
+ /* set the file information here */
+- info_ptr->width = pdev->width;
+- info_ptr->height = pdev->height;
+- /* resolution is in pixels per meter vs. dpi */
+- info_ptr->x_pixels_per_unit =
+- (png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54));
+- info_ptr->y_pixels_per_unit =
+- (png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54));
+- info_ptr->phys_unit_type = PNG_RESOLUTION_METER;
+- info_ptr->valid |= PNG_INFO_pHYs;
+ switch (depth) {
+ case 32:
+- info_ptr->bit_depth = 8;
+- info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 8, PNG_COLOR_TYPE_RGB_ALPHA,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ png_set_invert_alpha(png_ptr);
+ { gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
+ png_color_16 background;
+@@ -315,57 +310,69 @@ png_print_page(gx_device_printer * pdev,
+ }
+ break;
+ case 48:
+- info_ptr->bit_depth = 16;
+- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 16, PNG_COLOR_TYPE_RGB,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ #if defined(ARCH_IS_BIG_ENDIAN) && (!ARCH_IS_BIG_ENDIAN)
+ png_set_swap(png_ptr);
+ #endif
+ break;
+ case 24:
+- info_ptr->bit_depth = 8;
+- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 8, PNG_COLOR_TYPE_RGB,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ break;
+ case 8:
+- info_ptr->bit_depth = 8;
+- if (gx_device_has_color(pdev))
+- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+- else
+- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 8, gx_device_has_color(pdev) ?
++ PNG_COLOR_TYPE_PALETTE : PNG_COLOR_TYPE_GRAY,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ break;
+ case 4:
+- info_ptr->bit_depth = 4;
+- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 4, PNG_COLOR_TYPE_PALETTE,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ break;
+ case 1:
+- info_ptr->bit_depth = 1;
+- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height,
++ 1, PNG_COLOR_TYPE_GRAY,
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
++ PNG_FILTER_TYPE_DEFAULT);
+ /* invert monocrome pixels */
+ png_set_invert_mono(png_ptr);
+ break;
++ default:
++ png_error(png_ptr, "invalid bit depth");
+ }
+
++ /* resolution is in pixels per meter vs. dpi */
++ png_set_pHYs(png_ptr, info_ptr,
++ (png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54)),
++ (png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54)),
++ PNG_RESOLUTION_METER);
++
+ /* set the palette if there is one */
+- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
+ int i;
+ int num_colors = 1 << depth;
+ gx_color_value rgb[3];
++ png_color palette[256];
++
++ if (num_colors > 256)
++ num_colors = 256;
+
+- info_ptr->palette =
+- (void *)gs_alloc_bytes(mem, 256 * sizeof(png_color),
+- "png palette");
+- if (info_ptr->palette == 0) {
+- code = gs_note_error(gs_error_VMerror);
+- goto done;
+- }
+- info_ptr->num_palette = num_colors;
+- info_ptr->valid |= PNG_INFO_PLTE;
+ for (i = 0; i < num_colors; i++) {
+ (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
+ (gx_color_index) i, rgb);
+- info_ptr->palette[i].red = gx_color_value_to_byte(rgb[0]);
+- info_ptr->palette[i].green = gx_color_value_to_byte(rgb[1]);
+- info_ptr->palette[i].blue = gx_color_value_to_byte(rgb[2]);
++ palette[i].red = gx_color_value_to_byte(rgb[0]);
++ palette[i].green = gx_color_value_to_byte(rgb[1]);
++ palette[i].blue = gx_color_value_to_byte(rgb[2]);
+ }
++ png_set_PLTE(png_ptr, info_ptr, palette, num_colors);
+ }
+ /* add comment */
+ strncpy(software_key, "Software", sizeof(software_key));
+@@ -375,15 +382,14 @@ png_print_page(gx_device_printer * pdev,
+ text_png.key = software_key;
+ text_png.text = software_text;
+ text_png.text_length = strlen(software_text);
+- info_ptr->text = &text_png;
+- info_ptr->num_text = 1;
++ png_set_text(png_ptr, info_ptr, &text_png, 1);
+
+ /* write the file information */
+ png_write_info(png_ptr, info_ptr);
+
+ /* don't write the comments twice */
+- info_ptr->num_text = 0;
+- info_ptr->text = NULL;
++ /*info_ptr->num_text = 0;*/
++ /*info_ptr->text = NULL;*/
+
+ /* Write the contents of the image. */
+ for (y = 0; y < height; y++) {
+@@ -395,7 +401,7 @@ png_print_page(gx_device_printer * pdev,
+ png_write_end(png_ptr, info_ptr);
+
+ /* if you alloced the palette, free it here */
+- gs_free_object(mem, info_ptr->palette, "png palette");
++ /*gs_free_object(mem, info_ptr->palette, "png palette");*/
+
+ done:
+ /* free the structures */
+@@ -405,6 +411,7 @@ png_print_page(gx_device_printer * pdev,
+ return code;
+ }
+
++#if 0 /* not required in 1.5 */
+ /*
+ * Patch around a static reference to a never-used procedure.
+ * This could be avoided if we were willing to edit pngconf.h to
+@@ -422,6 +429,7 @@ png_push_fill_buffer(png_structp png_ptr
+ {
+ }
+ #endif
++#endif
+
+ static int
+ pngalpha_open(gx_device * pdev)
diff --git a/print/ghostscript8-base/files/patch-lips:gdevlips.c b/print/ghostscript8-base/files/patch-lips:gdevlips.c
new file mode 100644
index 000000000000..95f8b06f4841
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-lips:gdevlips.c
@@ -0,0 +1,18 @@
+--- contrib/lips4/gdevlips.c.orig Thu Nov 2 12:09:18 2000
++++ contrib/lips4/gdevlips.c Tue Jan 13 01:23:47 2004
+@@ -62,7 +62,15 @@
+ height = tmp;
+ }
+ for (pt = lips_paper_table; pt->num_unit < 80; pt++)
++/* add by shige 11/06 2003 */
++#ifdef USE_LIPS_SIZE_ERROR
++ if(pt->width+LIPS_SIZE_ERROR_VALUE>=width
++ && pt->width-LIPS_SIZE_ERROR_VALUE<=width
++ && pt->height+LIPS_SIZE_ERROR_VALUE>=height
++ && pt->height-LIPS_SIZE_ERROR_VALUE<=height)
++#else
+ if (pt->width == width && pt->height == height)
++#endif
+ break;
+
+ return pt->num_unit + landscape;
diff --git a/print/ghostscript8-base/files/patch-lips:gdevlips.h b/print/ghostscript8-base/files/patch-lips:gdevlips.h
new file mode 100644
index 000000000000..b3520ba1ac33
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-lips:gdevlips.h
@@ -0,0 +1,17 @@
+--- contrib/lips4/gdevlips.h.orig Thu Nov 2 12:09:18 2000
++++ contrib/lips4/gdevlips.h Tue Jan 13 01:23:47 2004
+@@ -188,6 +188,14 @@
+ bool faceup;\
+ char mediaType[LIPS_MEDIACHAR_MAX];
+
++/* added by shige 11/06 2003 */
++#define USE_LIPS_SIZE_ERROR
++#define LIPS_SIZE_ERROR_VALUE 2
++
++/* added by shige 11/09 2003 */
++#define LIPS_HEIGHT_MAX_720 11906
++#define LIPS_WIDTH_MAX_720 8419
++
+ int lips_media_selection(int width, int height);
+ int lips_packbits_encode(byte * inBuff, byte * outBuff, int Length);
+ int lips_mode3format_encode(byte * inBuff, byte * outBuff, int Length);
diff --git a/print/ghostscript8-base/files/patch-psi-zicc.c b/print/ghostscript8-base/files/patch-psi-zicc.c
new file mode 100644
index 000000000000..98c4eed85c37
--- /dev/null
+++ b/print/ghostscript8-base/files/patch-psi-zicc.c
@@ -0,0 +1,12 @@
+--- psi/zicc.c
++++ psi/zicc.c 2008-02-05 16:11:59.000000000 +0000
+@@ -77,6 +77,9 @@ zseticcspace(i_ctx_t * i_ctx_p)
+ dict_find_string(op, "N", &pnval);
+ ncomps = pnval->value.intval;
+
++ if (2*ncomps > sizeof(range_buff)/sizeof(float))
++ return_error(e_rangecheck);
++
+ /* verify the DataSource entry */
+ if (dict_find_string(op, "DataSource", &pstrmval) <= 0)
+ return_error(e_undefined);
diff --git a/print/ghostscript8-base/files/pkg-message.in b/print/ghostscript8-base/files/pkg-message.in
new file mode 100644
index 000000000000..ff7c18d05a86
--- /dev/null
+++ b/print/ghostscript8-base/files/pkg-message.in
@@ -0,0 +1,5 @@
+Note: in order to use the script "dvipdf", dvips must be installed.
+This program is provided by another package print/tex-dvipsk.
+
+FAPIfontmap and FAPIcidfmap in %%DATADIR%%/Resource/Init
+have to be configured if you want to use FAPI feature.