Fix pstopxl.in (from jirib, thanks), process and install it together
with the pxl*.ppd files. Yet untested; if anyone uses cups and
ghostscript with a H-P PCL XL printer, please give this a try.

Ciao,
        Kili

Index: Makefile
===================================================================
RCS file: /cvs/ports/print/ghostscript/gnu/Makefile,v
retrieving revision 1.84
diff -u -p -r1.84 Makefile
--- Makefile    6 Jul 2011 13:49:17 -0000       1.84
+++ Makefile    7 Jul 2011 11:12:04 -0000
@@ -4,6 +4,7 @@ COMMENT=        GNU PostScript interpreter
 
 VERSION=       9.02
 DISTNAME=      ghostscript-${VERSION}
+REVISION=      0
 CATEGORIES=    print lang
 SHARED_LIBS=   gs      13.0
 
@@ -158,6 +159,16 @@ FT_BRIDGE= 0
 
 NO_REGRESS=    Yes
 
+# Simulate ./configure.
+post-configure:
+       sed -e 's!@prefix@!${PREFIX}!' \
+           -e 's!@exec_prefix@!${PREFIX}!' \
+           -e 's!@bindir@!${PREFIX}/bin!' \
+           -e '/GS_LIB/s!/usr!${PREFIX}!' \
+           -e 's!@SED_EXTENDED_REGEX_OPT@!-nEe!' \
+           -e 's!@GS@!gs!' \
+           ${WRKSRC}/cups/pstopxl.in > ${WRKSRC}/cups/pstopxl
+
 # Avoid surprises in update-patches.
 # Use the old-style (non-autoconf) build.
 post-extract:
@@ -200,6 +211,10 @@ post-install:
                ln -sf ps2pdf.1 ps2pdf13.1 && \
                ln -sf ps2pdf.1 ps2pdf14.1 && \
                ln -sf ps2ps.1 eps2eps.1
+       ${INSTALL_SCRIPT_DIR} ${PREFIX}/libexec/cups/filter
+       ${INSTALL_SCRIPT} ${WRKSRC}/cups/pstopxl ${PREFIX}/libexec/cups/filter
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/cups/model
+       ${INSTALL_DATA} ${WRKSRC}/cups/*.ppd ${PREFIX}/share/cups/model
 
 # Device list based on configure.ac:
 # X_DEVS (skipping x11_ and x11alt_, since those are dependencies of
Index: patches/patch-cups_pstopxl_in
===================================================================
RCS file: patches/patch-cups_pstopxl_in
diff -N patches/patch-cups_pstopxl_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cups_pstopxl_in       7 Jul 2011 11:12:04 -0000
@@ -0,0 +1,101 @@
+$OpenBSD$
+
+From jirib via http://bugs.ghostscript.com/show_bug.cgi?id=692328
+
+--- cups/pstopxl.in.orig       Tue Jun 29 05:48:17 2010
++++ cups/pstopxl.in    Thu Jul  7 12:53:16 2011
+@@ -51,9 +51,9 @@ ps_code=
+ ppd_opts=
+ 
+ resolution=
+-eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|\s)Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
++eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|[[:space:]])Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
+ if test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultResolution:\s+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p'
 "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultResolution:[[:space:]]+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p'
 "$PPD")"
+ fi
+ echo "DEBUG: Resolution: $resolution" >&2
+ if test -n "$resolution"; then
+@@ -61,15 +61,15 @@ if test -n "$resolution"; then
+ fi
+ 
+ pagesize=
+-eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|\s)(media|PageSize)=(\S+).*/pagesize="${pagesize:-\3}"/p')"
++eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|[[:space:]])(media|PageSize)=([^[:space:]]+).*/pagesize="${pagesize:-\3}"/p')"
+ if test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultPageSize:\s+(\S+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultPageSize:[[:space:]]+([^[:space:]]+).*/pagesize="${pagesize:-\1}"/p'
 "$PPD")"
+ fi
+ echo "DEBUG: Page size: $pagesize" >&2
+ width=
+ height=
+ if test -n "$pagesize" && test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*PaperDimension\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)".*|width="\1"; 
height="\2"|p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*PaperDimension[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|width="\1";
 height="\2"|p' "$PPD")"
+ fi
+ echo "DEBUG: Width: $width, height: $height" >&2
+ if test -n "$width"; then
+@@ -84,7 +84,7 @@ bl_y=
+ tr_x=
+ tr_y=
+ if test -n "$pagesize" && test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*ImageableArea\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)\s+(\S+)\s+(\S+)".*|bl_x="\1";
 bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*ImageableArea[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|bl_x="\1";
 bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
+ fi
+ echo "DEBUG: Absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
+ margin_l=
+@@ -106,14 +106,14 @@ if test -n "$margin_l" && test -n "$margin_b" && \
+ fi
+ 
+ inputslot=
+-eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|\s)(InputSlot)=(\S+).*/inputslot="${inputslot:-\3}"/p')"
++eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|[[:space:]])(InputSlot)=([^[:space:]]+).*/inputslot="${inputslot:-\3}"/p')"
+ if test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultInputSlot:\s+(\S+).*/inputslot="${inputslot:-\1}"/p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultInputSlot:[[:space:]]+([^[:space:]]+).*/inputslot="${inputslot:-\1}"/p'
 "$PPD")"
+ fi
+ echo "DEBUG: InputSlot: $inputslot" >&2
+ inputslot_val=
+ if test -n "$inputslot" && test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*InputSlot\s+'"$inputslot"'/[^:]+:\s+"\s*<\s*<\s*/MediaPosition\s*([0-9]+)\s*>\s*>\s*setpagedevice\s*".*|inputslot_val="\1"|p'
 "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*InputSlot[[:space:]]+'"$inputslot"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/MediaPosition[[:space:]]*([0-9]+)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|inputslot_val="\1"|p'
 "$PPD")"
+ fi
+ echo "DEBUG: Value for MediaPosition: $inputslot_val" >&2
+ if test -n "$inputslot_val"; then
+@@ -121,14 +121,14 @@ if test -n "$inputslot_val"; then
+ fi
+ 
+ colormodel=
+-eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|\s)(ColorModel)=(\S+).*/colormodel="${colormodel:-\3}"/p')"
++eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|[[:space:]])(ColorModel)=([^[:space:]]+).*/colormodel="${colormodel:-\3}"/p')"
+ if test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultColorModel:\s+(\S+).*/colormodel="${colormodel:-\1}"/p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultColorModel:[[:space:]]+([^[:space:]]+).*/colormodel="${colormodel:-\1}"/p'
 "$PPD")"
+ fi
+ echo "DEBUG: ColorModel: $colormodel" >&2
+ colormodel_val=
+ if test -n "$colormodel" && test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*ColorModel\s+'"$colormodel"'/[^:]+:\s+"\s*<\s*<\s*/BitsPerPixel\s*([0-9]*)\s*>\s*>\s*setpagedevice\s*".*|colormodel_val="\1"|p'
 "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*ColorModel[[:space:]]+'"$colormodel"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/BitsPerPixel[[:space:]]*([0-9]*)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|colormodel_val="\1"|p'
 "$PPD")"
+ fi
+ echo "DEBUG: Value for BitsPerPixel: $colormodel_val" >&2
+ if test -n "$colormodel_val"; then
+@@ -136,15 +136,15 @@ if test -n "$colormodel_val"; then
+ fi
+ 
+ duplex=
+-eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|\s)(Duplex)=(\S+).*/duplex="${duplex:-\3}"/p')"
++eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 
's/.*(^|[[:space:]])(Duplex)=([^[:space:]]+).*/duplex="${duplex:-\3}"/p')"
+ if test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultDuplex:\s+(\S+).*/duplex="${duplex:-\1}"/p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's/^\*DefaultDuplex:[[:space:]]+([^[:space:]]+).*/duplex="${duplex:-\1}"/p' 
"$PPD")"
+ fi
+ echo "DEBUG: Duplex: $duplex" >&2
+ duplex_val=
+ tumble_val=
+ if test -n "$duplex" && test -e "$PPD"; then
+-  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*Duplex\s+'"$duplex"'/[^:]+:\s+"\s*<\s*<\s*/Duplex\s*(\S*)\s*(/Tumble\s*(\S*)\s*)?>\s*>\s*setpagedevice\s*".*|duplex_val="\1";
 tumble_val="\3"|p' "$PPD")"
++  eval "$(sed @SED_EXTENDED_REGEX_OPT@ 
's|^\*Duplex[[:space:]]+'"$duplex"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/Duplex[[:space:]]*([^[:space:]]*)[[:space:]]*(/Tumble[[:space:]]*([^[:space:]]*)[[:space:]]*)?>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|duplex_val="\1";
 tumble_val="\3"|p' "$PPD")"
+ fi
+ echo "DEBUG: Value for Duplex: $duplex_val; Value for Tumble: $tumble_val" >&2
+ if test -n "$duplex_val"; then
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/print/ghostscript/gnu/pkg/PLIST,v
retrieving revision 1.20
diff -u -p -r1.20 PLIST
--- pkg/PLIST   6 Jul 2011 13:49:17 -0000       1.20
+++ pkg/PLIST   7 Jul 2011 11:12:04 -0000
@@ -35,6 +35,9 @@ bin/ps2ps2
 bin/pv.sh
 bin/unix-lpr.sh
 bin/wftopfa
+libexec/cups/
+libexec/cups/filter/
+libexec/cups/filter/pstopxl
 man/de/
 man/de/man1/
 @man man/de/man1/dvipdf.1
@@ -77,6 +80,10 @@ man/de/man1/
 @man man/man1/ps2pdfwr.1
 @man man/man1/ps2ps.1
 @man man/man1/wftopfa.1
+share/cups/
+share/cups/model/
+share/cups/model/pxlcolor.ppd
+share/cups/model/pxlmono.ppd
 share/ghostscript/${VERSION}/
 share/ghostscript/${VERSION}/Resource/
 share/ghostscript/${VERSION}/Resource/CMap/

Reply via email to