colord support: prefix printer name with "cups-" to get device ID.

This commit is contained in:
Tim Waugh 2011-03-10 14:41:29 +00:00
parent 63ba0ce8b3
commit 562801bfb7
2 changed files with 40 additions and 27 deletions

View File

@ -1,6 +1,6 @@
diff -urNp ghostscript-9.01.old/configure.ac ghostscript-9.01/configure.ac
--- ghostscript-9.01.old/configure.ac 2011-03-08 10:47:24.851721587 +0000
+++ ghostscript-9.01/configure.ac 2011-03-08 10:48:11.022721481 +0000
diff -up ghostscript-9.01/configure.ac.colord ghostscript-9.01/configure.ac
--- ghostscript-9.01/configure.ac.colord 2011-02-02 14:12:15.000000000 +0000
+++ ghostscript-9.01/configure.ac 2011-03-10 13:48:17.599512567 +0000
@@ -423,6 +423,37 @@ AC_SUBST(HAVE_FONTCONFIG)
AC_SUBST(FONTCONFIG_CFLAGS)
AC_SUBST(FONTCONFIG_LIBS)
@ -48,9 +48,9 @@ diff -urNp ghostscript-9.01.old/configure.ac ghostscript-9.01/configure.ac
-chmod +x cups/pstopxl cups/pstoraster
+chmod +x cups/pstopxl
diff -urNp ghostscript-9.01.old/cups/colord.c ghostscript-9.01/cups/colord.c
--- ghostscript-9.01.old/cups/colord.c 1970-01-01 01:00:00.000000000 +0100
+++ ghostscript-9.01/cups/colord.c 2011-03-08 10:48:11.023721494 +0000
diff -up ghostscript-9.01/cups/colord.c.colord ghostscript-9.01/cups/colord.c
--- ghostscript-9.01/cups/colord.c.colord 2011-03-10 13:48:17.600512671 +0000
+++ ghostscript-9.01/cups/colord.c 2011-03-10 13:48:17.600512671 +0000
@@ -0,0 +1,367 @@
+/*
+Copyright (c) 2011, Tim Waugh
@ -419,9 +419,9 @@ diff -urNp ghostscript-9.01.old/cups/colord.c ghostscript-9.01/cups/colord.c
+}
+
+#endif
diff -urNp ghostscript-9.01.old/cups/colord.h ghostscript-9.01/cups/colord.h
--- ghostscript-9.01.old/cups/colord.h 1970-01-01 01:00:00.000000000 +0100
+++ ghostscript-9.01/cups/colord.h 2011-03-08 10:48:11.024721504 +0000
diff -up ghostscript-9.01/cups/colord.h.colord ghostscript-9.01/cups/colord.h
--- ghostscript-9.01/cups/colord.h.colord 2011-03-10 13:48:17.601512775 +0000
+++ ghostscript-9.01/cups/colord.h 2011-03-10 13:48:17.601512775 +0000
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2011, Richard Hughes
@ -458,9 +458,9 @@ diff -urNp ghostscript-9.01.old/cups/colord.h ghostscript-9.01/cups/colord.h
+char **colord_get_qualifier_for_ppd (ppd_file_t *ppd);
+char *colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple);
diff -urNp ghostscript-9.01.old/cups/cups.mak ghostscript-9.01/cups/cups.mak
--- ghostscript-9.01.old/cups/cups.mak 2011-03-08 10:47:23.796721588 +0000
+++ ghostscript-9.01/cups/cups.mak 2011-03-08 10:50:01.360721549 +0000
diff -up ghostscript-9.01/cups/cups.mak.colord ghostscript-9.01/cups/cups.mak
--- ghostscript-9.01/cups/cups.mak.colord 2011-03-10 13:48:17.573509871 +0000
+++ ghostscript-9.01/cups/cups.mak 2011-03-10 13:48:17.602512879 +0000
@@ -35,30 +35,30 @@ cups_= $(GLOBJ)gdevcups.$(OBJ)
# CUPSDATA=`cups-config --datadir`
# CUPSPDFTORASTER= 1 if CUPS is new enough (cups-config --version)
@ -502,10 +502,10 @@ diff -urNp ghostscript-9.01.old/cups/cups.mak ghostscript-9.01/cups/cups.mak
fi
-mkdir -p $(DESTDIR)$(CUPSDATA)/model
$(INSTALL_DATA) cups/pxlcolor.ppd $(DESTDIR)$(CUPSDATA)/model
diff -urNp ghostscript-9.01.old/cups/gstoraster.c ghostscript-9.01/cups/gstoraster.c
--- ghostscript-9.01.old/cups/gstoraster.c 1970-01-01 01:00:00.000000000 +0100
+++ ghostscript-9.01/cups/gstoraster.c 2011-03-08 10:48:11.026721536 +0000
@@ -0,0 +1,702 @@
diff -up ghostscript-9.01/cups/gstoraster.c.colord ghostscript-9.01/cups/gstoraster.c
--- ghostscript-9.01/cups/gstoraster.c.colord 2011-03-10 13:48:17.604513086 +0000
+++ ghostscript-9.01/cups/gstoraster.c 2011-03-10 14:40:00.005019314 +0000
@@ -0,0 +1,712 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: s; c-basic-offset: 8 -*-
+
+Copyright (c) 2008, Till Kamppeter
@ -1105,11 +1105,21 @@ diff -urNp ghostscript-9.01.old/cups/gstoraster.c ghostscript-9.01/cups/gstorast
+
+ qualifier = colord_get_qualifier_for_ppd (ppd);
+ if (qualifier != NULL) {
+ const char *env_printer = getenv("PRINTER");
+ char *device_id;
+
+ fprintf(stderr, "DEBUG: PPD uses qualifier '%s.%s.%s'\n",
+ qualifier[0], qualifier[1], qualifier[2]);
+ icc_profile = colord_get_profile_for_device_id (getenv("PRINTER"),
+ (const char**) qualifier);
+ if (env_printer) {
+ device_id = malloc (5 + strlen (env_printer) + 1);
+ if (device_id) {
+ strcpy (device_id, "cups-");
+ strcpy (device_id + 5, env_printer);
+ fprintf(stderr, "DEBUG: PPD uses qualifier '%s.%s.%s'\n",
+ qualifier[0], qualifier[1], qualifier[2]);
+ icc_profile = colord_get_profile_for_device_id (device_id,
+ (const char**) qualifier);
+ free (device_id);
+ }
+ }
+
+ /* fall back to the PPD */
+ if (icc_profile == NULL)
@ -1208,9 +1218,9 @@ diff -urNp ghostscript-9.01.old/cups/gstoraster.c ghostscript-9.01/cups/gstorast
+ ppdClose(ppd);
+ return status;
+}
diff -urNp ghostscript-9.01.old/cups/gstoraster.convs ghostscript-9.01/cups/gstoraster.convs
--- ghostscript-9.01.old/cups/gstoraster.convs 1970-01-01 01:00:00.000000000 +0100
+++ ghostscript-9.01/cups/gstoraster.convs 2011-03-08 10:48:11.026721536 +0000
diff -up ghostscript-9.01/cups/gstoraster.convs.colord ghostscript-9.01/cups/gstoraster.convs
--- ghostscript-9.01/cups/gstoraster.convs.colord 2011-03-10 13:48:17.605513190 +0000
+++ ghostscript-9.01/cups/gstoraster.convs 2011-03-10 13:48:17.605513190 +0000
@@ -0,0 +1,30 @@
+# Copyright (c) 2008, Till Kamppeter
+# Copyright (c) 2011, Richard Hughes
@ -1242,9 +1252,9 @@ diff -urNp ghostscript-9.01.old/cups/gstoraster.convs ghostscript-9.01/cups/gsto
+
+application/vnd.cups-pdf application/vnd.cups-raster 66 gstoraster
+application/vnd.cups-postscript application/vnd.cups-raster 100 gstoraster
diff -urNp ghostscript-9.01.old/Makefile.in ghostscript-9.01/Makefile.in
--- ghostscript-9.01.old/Makefile.in 2011-03-08 10:47:24.951721587 +0000
+++ ghostscript-9.01/Makefile.in 2011-03-08 10:48:11.020721446 +0000
diff -up ghostscript-9.01/Makefile.in.colord ghostscript-9.01/Makefile.in
--- ghostscript-9.01/Makefile.in.colord 2011-02-02 14:12:15.000000000 +0000
+++ ghostscript-9.01/Makefile.in 2011-03-10 13:48:17.607513397 +0000
@@ -140,7 +140,7 @@ GENOPT=
# -DHAVE_SETLOCALE
# call setlocale(LC_CTYPE) when running as a standalone app

View File

@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer
Name: ghostscript
Version: %{gs_ver}
Release: 2%{?dist}
Release: 3%{?dist}
# Included CMap data is Redistributable, no modification permitted,
# see http://bugzilla.redhat.com/487510
@ -346,6 +346,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libgs.so
%changelog
* Thu Mar 10 2011 Tim Waugh <twaugh@redhat.com> 9.01-3
- colord support: prefix printer name with "cups-" to get device ID.
* Thu Feb 10 2011 Richard Hughes <rhughes@redhat.com> 9.01-2
- Backport a patch from svn trunk to enable colord support.