Compile/install gstoraster and the corresponding convs file.

Link gstoraster to pstoraster in case there are some oldies around that
still try to use pstoraster.
Remove the dlopen libcups hack and link to libcups as upstream intended.
Unconditionally depend on cups,-libs.

with and ok kili@
This commit is contained in:
ajacoutot 2012-08-04 17:51:44 +00:00
parent 0671039df6
commit 3a90553d9c
4 changed files with 32 additions and 208 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.91 2012/07/11 10:26:31 kili Exp $
# $OpenBSD: Makefile,v 1.92 2012/08/04 17:51:44 ajacoutot Exp $
COMMENT= GNU PostScript interpreter
@ -6,6 +6,7 @@ VERSION= 9.05
DISTNAME= ghostscript-${VERSION}
CATEGORIES= print lang
SHARED_LIBS= gs 15.0
REVISION= 0
MASTER_SITES= http://downloads.ghostscript.com/public/
@ -32,7 +33,6 @@ WANTLIB= c ijs m jbig2dec jpeg>=62 lcms2 png>=6 pthread tiff z
MODULES= converters/libiconv
RUN_DEPENDS= print/ghostscript/gnu-fonts
BUILD_DEPENDS= print/cups>=1.5.0
LIB_DEPENDS= graphics/jbig2dec \
graphics/jpeg \
graphics/lcms2 \
@ -91,9 +91,9 @@ USE_GMAKE= Yes
# Hack to let ALL_TARGET etc. depend on the value of NO_SHARED_LIBS,
# which is available only after the inclusion of bsd.port.mk.
ALL_TARGET_NON_SHARED-No = so all
ALL_TARGET_NON_SHARED-No = so all ${ALL_TARGET_CUPS}
ALL_TARGET_NON_SHARED-Yes = all
INSTALL_TARGET_NON_SHARED-No = install install-so
INSTALL_TARGET_NON_SHARED-No = install install-so ${INSTALL_TARGET_CUPS}
INSTALL_TARGET_NON_SHARED-Yes = install
SOC_LIBS = -liconv -pthread
@ -203,8 +203,10 @@ post-install:
${INSTALL_SCRIPT_DIR} ${PREFIX}/libexec/cups/filter
${INSTALL_SCRIPT} ${WRKSRC}/cups/gstopxl ${PREFIX}/libexec/cups/filter
cd ${PREFIX}/libexec/cups/filter && ln -s gstopxl pstopxl
cd ${PREFIX}/libexec/cups/filter && ln -s gstoraster pstoraster
${INSTALL_DATA_DIR} ${PREFIX}/share/cups/model
${INSTALL_DATA} ${WRKSRC}/cups/*.ppd ${PREFIX}/share/cups/model
mv ${DESTDIR}/${SYSCONFDIR}/cups/ ${PREFIX}/share/ghostscript/${VERSION}/examples/
# Device list based on configure.ac:
# X_DEVS (skipping x11_ and x11alt_, since those are dependencies of
@ -316,7 +318,21 @@ DEVICES+= bit bitcmyk bitrgb bitrgbtags ccr \
DEVICES+= ijs
# Cups
LIB_DEPENDS+= print/cups,-libs
WANTLIB += asn1 crypto cups cupsimage gssapi krb5 ssl
DEVICES+= cups
ALL_TARGET_CUPS=cups
INSTALL_TARGET_CUPS= install-cups
CUPSLIBS+= $$(cups-config --image --libs)
EXTRALIBS+= ${CUPSLIBS}
SOC_LIBS+= ${CUPSLIBS}
MAKE_FLAGS+= CUPSCFLAGS="$$(cups-config --cflags)" \
CUPSSERVERBIN="$$(cups-config --serverbin)" \
CUPSSERVERROOT="$$(cups-config --serverroot)" \
CUPSDATA="$$(cups-config --datadir)" \
CUPSPDFTORASTER=1 \
CUPS_FONTPATH="${LOCALBASE}/share/cups/fonts" \
CUPS_DATA="${LOCALBASE}/share/cups"
.include <bsd.port.mk>

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-base_unix-gcc_mak,v 1.5 2012/07/11 10:26:31 kili Exp $
$OpenBSD: patch-base_unix-gcc_mak,v 1.6 2012/08/04 17:51:44 ajacoutot Exp $
--- base/unix-gcc.mak.orig Wed Feb 8 09:48:47 2012
+++ base/unix-gcc.mak Sun Jul 8 17:09:59 2012
+++ base/unix-gcc.mak Sun Jul 29 21:15:58 2012
@@ -31,6 +31,7 @@ PSLIBDIR=./lib
PSRESDIR=./Resource
PSGENDIR=./$(BUILDDIRPREFIX)obj
@ -123,11 +123,12 @@ $OpenBSD: patch-base_unix-gcc_mak,v 1.5 2012/07/11 10:26:31 kili Exp $
include $(GLSRCDIR)/ijs.mak
include $(GLSRCDIR)/devs.mak
include $(GLSRCDIR)/contrib.mak
@@ -482,6 +472,7 @@ include $(GLSRCDIR)/unixlink.mak
@@ -482,6 +472,8 @@ include $(GLSRCDIR)/unixlink.mak
include $(GLSRCDIR)/unix-dll.mak
include $(GLSRCDIR)/unix-end.mak
include $(GLSRCDIR)/unixinst.mak
+include contrib/contrib.mak
+include cups/cups.mak
# This has to come last so it won't be taken as the default target.
$(AK):

View File

@ -1,200 +0,0 @@
$OpenBSD: patch-cups_gdevcups_c,v 1.8 2012/07/11 10:26:31 kili Exp $
--- cups/gdevcups.c.orig Wed Feb 8 09:48:50 2012
+++ cups/gdevcups.c Sun Jul 8 19:22:15 2012
@@ -71,6 +71,7 @@
#include "arch.h"
#include "gsicc_manage.h"
+#include <dlfcn.h>
#include <stdlib.h>
#include <ctype.h>
#include <cups/raster.h>
@@ -233,6 +234,15 @@ typedef struct gx_device_cups_s
int cupsRasterVersion;
/* Used by cups_put_params(): */
+
+ /* cups stubs, initialized in cups_open() */
+ int libCupsReady;
+ void (*cupsRasterClose) (cups_raster_t *);
+ cups_raster_t *(*cupsRasterOpen) (int, cups_mode_t);
+ unsigned (*cupsRasterWriteHeader2) (cups_raster_t *, cups_page_header2_t *);
+ unsigned (*cupsRasterWritePixels) (cups_raster_t *, unsigned char *, unsigned);
+ ppd_attr_t *(*ppdFindAttr) (ppd_file_t *, const char *, const char *);
+ ppd_file_t *(*ppdOpenFile) (const char *);
} gx_device_cups;
private gx_device_procs cups_procs =
@@ -434,7 +444,14 @@ gx_device_cups gs_cups_device =
{{0x00},{0x00},{0x00}},
{{0x00},{0x00},{0x00}}}, /* Matrix */
0, /* user_icc */
- 3 /* cupsRasterVersion */
+ 3, /* cupsRasterVersion */
+ 0, /* libCupsReady */
+ NULL, /* cupsRasterClose */
+ NULL, /* cupsRasterOpen */
+ NULL, /* cupsRasterWriteHeader2 */
+ NULL, /* cupsRasterWritePixels */
+ NULL, /* ppdFindAttr */
+ NULL /* ppdOpenFile */
};
/*
@@ -467,7 +484,7 @@ cups_close(gx_device *pdev) /* I - Device info */
if (cups->stream != NULL)
{
- cupsRasterClose(cups->stream);
+ cups->cupsRasterClose(cups->stream);
cups->stream = NULL;
}
@@ -2724,6 +2741,39 @@ cups_open(gx_device *pdev) /* I - Device info */
dprintf1("DEBUG2: cups_open(%p)\n", pdev);
#endif /* CUPS_DEBUG2 */
+ if (!cups->libCupsReady) {
+ void *handle;
+ if (!(handle = dlopen("libcupsimage.so.5", 0))) {
+ eprintf1("ERROR: libcupsimage.so.5: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->cupsRasterClose = dlsym(handle, "cupsRasterClose"))) {
+ eprintf1("ERROR: cupsRasterClose: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->cupsRasterOpen = dlsym(handle, "cupsRasterOpen"))) {
+ eprintf1("ERROR: cupsRasterOpen: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->cupsRasterWriteHeader2 = dlsym(handle, "cupsRasterWriteHeader2"))) {
+ eprintf1("ERROR: cupsRasterWriteHeader2: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->cupsRasterWritePixels = dlsym(handle, "cupsRasterWritePixels"))) {
+ eprintf1("ERROR: cupsRasterWritePixels: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->ppdFindAttr = dlsym(handle, "ppdFindAttr"))) {
+ eprintf1("ERROR: ppdFindAttr: %s\n", dlerror());
+ return -1;
+ }
+ if (!(cups->ppdOpenFile = dlsym(handle, "ppdOpenFile"))) {
+ eprintf1("ERROR: ppdOpenFile: %s\n", dlerror());
+ return -1;
+ }
+ cups->libCupsReady = 1;
+ }
+
dprintf("INFO: Start rendering...\n");
cups->printer_procs.get_space_params = cups_get_space_params;
@@ -2741,7 +2791,7 @@ cups_open(gx_device *pdev) /* I - Device info */
return (code);
if (cups->PPD == NULL)
- cups->PPD = ppdOpenFile(getenv("PPD"));
+ cups->PPD = cups->ppdOpenFile(getenv("PPD"));
return (0);
}
@@ -2838,7 +2888,7 @@ cups_print_pages(gx_device_printer *pdev,
if (cups->stream == NULL)
{
- RasterVersion = ppdFindAttr(cups->PPD, "cupsRasterVersion", NULL);
+ RasterVersion = cups->ppdFindAttr(cups->PPD, "cupsRasterVersion", NULL);
if (RasterVersion) {
#ifdef CUPS_DEBUG2
dprintf1("DEBUG2: cupsRasterVersion = %s\n", RasterVersion->value);
@@ -2851,7 +2901,7 @@ cups_print_pages(gx_device_printer *pdev,
return_error(gs_error_unknownerror);
}
}
- if ((cups->stream = cupsRasterOpen(fileno(cups->file),
+ if ((cups->stream = cups->cupsRasterOpen(fileno(cups->file),
(cups->cupsRasterVersion == 3 ?
CUPS_RASTER_WRITE :
CUPS_RASTER_WRITE_COMPRESSED))) == NULL)
@@ -2882,7 +2932,7 @@ cups_print_pages(gx_device_printer *pdev,
for (copy = num_copies; copy > 0; copy --)
{
- cupsRasterWriteHeader(cups->stream, &(cups->header));
+ cups->cupsRasterWriteHeader(cups->stream, &(cups->header));
if (pdev->color_info.num_components == 1)
code = cups_print_chunked(pdev, src, dst, srcbytes);
@@ -3213,7 +3263,7 @@ cups_put_params(gx_device *pdev, /* I - Device inf
dprintf1("DEBUG2: cups->PPD = %p\n", cups->PPD);
#endif /* CUPS_DEBUG */
- backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
+ backside = cups->ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
if (backside) {
#ifdef CUPS_DEBUG
dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value);
@@ -3225,7 +3275,7 @@ cups_put_params(gx_device *pdev, /* I - Device inf
#endif /* CUPS_DEBUG */
backsiderequiresflippedmargins =
- ppdFindAttr(cups->PPD, "APDuplexRequiresFlippedMargin", NULL);
+ cups->ppdFindAttr(cups->PPD, "APDuplexRequiresFlippedMargin", NULL);
#ifdef CUPS_DEBUG
if (backsiderequiresflippedmargins)
dprintf1("DEBUG2: APDuplexRequiresFlippedMargin = %s\n",
@@ -4256,7 +4306,7 @@ cups_print_chunked(gx_device_printer *pdev,
#endif /* CUPS_DEBUG */
if (cups->PPD) {
- backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
+ backside = cups->ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
if (backside) {
#ifdef CUPS_DEBUG
dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value);
@@ -4433,7 +4483,7 @@ cups_print_chunked(gx_device_printer *pdev,
* Write the bitmap data to the raster stream...
*/
- cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
+ cups->cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
}
else
{
@@ -4441,7 +4491,7 @@ cups_print_chunked(gx_device_printer *pdev,
* Write the scanline data to the raster stream...
*/
- cupsRasterWritePixels(cups->stream, srcptr, cups->header.cupsBytesPerLine);
+ cups->cupsRasterWritePixels(cups->stream, srcptr, cups->header.cupsBytesPerLine);
}
}
return (0);
@@ -4483,7 +4533,7 @@ cups_print_banded(gx_device_printer *pdev,
#endif /* CUPS_DEBUG */
if (cups->PPD) {
- backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
+ backside = cups->ppdFindAttr(cups->PPD, "cupsBackSide", NULL);
if (backside) {
#ifdef CUPS_DEBUG
dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value);
@@ -5154,7 +5204,7 @@ cups_print_banded(gx_device_printer *pdev,
* Write the bitmap data to the raster stream...
*/
- cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
+ cups->cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
}
return (0);
}
@@ -5526,7 +5576,7 @@ cups_print_planar(gx_device_printer *pdev,
* Write the bitmap data to the raster stream...
*/
- cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
+ cups->cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
}
return (0);
}

View File

@ -1,4 +1,6 @@
@comment $OpenBSD: PLIST,v 1.23 2012/07/11 10:26:31 kili Exp $
@comment $OpenBSD: PLIST,v 1.24 2012/08/04 17:51:44 ajacoutot Exp $
@conflict gstoraster-*
@pkgpath print/gstoraster
@pkgpath print/ghostscript/afpl${FLAVOR_STRING}
@pkgpath print/ghostscript/gnu${FLAVOR_STRING},cups
%%SHARED%%
@ -35,7 +37,9 @@ bin/wftopfa
libexec/cups/
libexec/cups/filter/
libexec/cups/filter/gstopxl
@bin libexec/cups/filter/gstoraster
libexec/cups/filter/pstopxl
libexec/cups/filter/pstoraster
man/de/
man/de/man1/
@man man/de/man1/dvipdf.1
@ -443,6 +447,9 @@ share/ghostscript/${VERSION}/examples/cjk/gscjk_ak.ps
share/ghostscript/${VERSION}/examples/cjk/iso2022.ps
share/ghostscript/${VERSION}/examples/cjk/iso2022v.ps
share/ghostscript/${VERSION}/examples/colorcir.ps
share/ghostscript/${VERSION}/examples/cups/
share/ghostscript/${VERSION}/examples/cups/gstoraster.convs
@sample ${SYSCONFDIR}/cups/gstoraster.convs
share/ghostscript/${VERSION}/examples/doretree.ps
share/ghostscript/${VERSION}/examples/escher.ps
share/ghostscript/${VERSION}/examples/golfer.eps