wok rev 15345

xfprint: patch for cups 1.6
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 29 20:30:03 2013 +0000 (2013-09-29)
parents b4f7117eb98c
children 49dd2dff0330
files perl/receipt xfprint/receipt xfprint/stuff/xfprint-4.6.1-cups-1.6.patch
line diff
     1.1 --- a/perl/receipt	Sun Sep 29 15:54:42 2013 +0000
     1.2 +++ b/perl/receipt	Sun Sep 29 20:30:03 2013 +0000
     1.3 @@ -8,7 +8,7 @@
     1.4  LICENSE="GPL"
     1.5  TARBALL="$PACKAGE-$VERSION.tar.bz2"
     1.6  DEPENDS="libdb gdbm zlib"
     1.7 -BUILD_DEPENDS="db gdbm zlib"
     1.8 +BUILD_DEPENDS="db gdbm zlib less"
     1.9  WEB_SITE="http://www.perl.org/"
    1.10  WGET_URL="http://ftp.funet.fi/pub/CPAN/src/$TARBALL"
    1.11  PROVIDE="microperl"
     2.1 --- a/xfprint/receipt	Sun Sep 29 15:54:42 2013 +0000
     2.2 +++ b/xfprint/receipt	Sun Sep 29 20:30:03 2013 +0000
     2.3 @@ -19,6 +19,7 @@
     2.4  compile_rules()
     2.5  {
     2.6  	cd $src
     2.7 +	patch -p1 < $stuff/xfprint-4.6.1-cups-1.6.patch
     2.8  	./configure --prefix=/usr $CONFIGURE_ARGS && \
     2.9  	make && make DESTDIR=$DESTDIR install
    2.10  }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xfprint/stuff/xfprint-4.6.1-cups-1.6.patch	Sun Sep 29 20:30:03 2013 +0000
     3.3 @@ -0,0 +1,136 @@
     3.4 +>From 2b5b2efdf2ce8233933c1304dc00c271303a4d92 Mon Sep 17 00:00:00 2001
     3.5 +From: Matt Philips <matt.philips@timesys.com>
     3.6 +Date: Fri, 19 Apr 2013 14:31:37 -0400
     3.7 +Subject: [PATCH] Use CUPS-1.6 IPP API getter/setter functions
     3.8 +
     3.9 +CUPS 1.6 makes various structures private and introduces these ippGet
    3.10 +and ippSet functions for all of the fields in these structures.
    3.11 +http://www.cups.org/str.php?L3928
    3.12 +
    3.13 +We define our own accessors when building against CUPS < 1.6.
    3.14 +
    3.15 +Based on work by Jiri Popelka <jpopelka@redhat.com> at
    3.16 +https://bugzilla.gnome.org/show_bug.cgi?id=679759
    3.17 +---
    3.18 + printing-systems/cups/cups.c |   64 +++++++++++++++++-----------
    3.19 + 1 file changed, 38 insertions(+), 26 deletions(-)
    3.20 +
    3.21 +diff --git a/printing-systems/cups/cups.c b/xfprint-4.6.1/printing-systems/cups/cups.c
    3.22 +index 96b30d1..9d5df01 100644
    3.23 +--- a/printing-systems/cups/cups.c
    3.24 ++++ b/printing-systems/cups/cups.c
    3.25 +@@ -44,6 +44,37 @@ G_MODULE_EXPORT const gchar version[] = VERSION;
    3.26 + G_MODULE_EXPORT const gchar author[] = "Jean-François Wauthy";
    3.27 + G_MODULE_EXPORT const gchar homepage[] = "http://www.xfce.org";
    3.28 + 
    3.29 ++/* fix for cups 1.6 incompatibility */
    3.30 ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
    3.31 ++#define HAVE_CUPS_1_6 1
    3.32 ++#endif
    3.33 ++
    3.34 ++#ifndef HAVE_CUPS_1_6
    3.35 ++#define ippGetState(request) request->state 
    3.36 ++#define ippGetInteger(attr, element) attr->values[element].integer
    3.37 ++#define ippGetString(attr, element, language) attr->values[element].string.text
    3.38 ++#define ippNewRequest(operation_id) cups_request_new(operation_id)
    3.39 ++
    3.40 ++static ipp_t *
    3.41 ++cups_request_new (int operation_id)
    3.42 ++{
    3.43 ++  ipp_t *request;
    3.44 ++  cups_lang_t *language;
    3.45 ++
    3.46 ++  language = cupsLangDefault ();
    3.47 ++  request = ippNew ();
    3.48 ++  request->request.op.operation_id = operation_id;
    3.49 ++  request->request.op.request_id = 1;
    3.50 ++
    3.51 ++  ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8");
    3.52 ++
    3.53 ++  ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language);
    3.54 ++  cupsLangFree (language);
    3.55 ++
    3.56 ++  return request;
    3.57 ++}
    3.58 ++#endif
    3.59 ++
    3.60 + static GtkActionEntry printer_list_action_entries[] = {
    3.61 +   {"set-default-printer", GTK_STOCK_PRINT, N_("Set as default printer"), NULL,
    3.62 +    N_("Set as default CUPS printer"), G_CALLBACK (action_set_default_printer_cb),},
    3.63 +@@ -126,25 +157,6 @@ cups_password_cb (const char *prompt)
    3.64 + }
    3.65 + 
    3.66 + static ipp_t *
    3.67 +-cups_request_new (int operation_id)
    3.68 +-{
    3.69 +-  ipp_t *request;
    3.70 +-  cups_lang_t *language;
    3.71 +-
    3.72 +-  language = cupsLangDefault ();
    3.73 +-  request = ippNew ();
    3.74 +-  request->request.op.operation_id = operation_id;
    3.75 +-  request->request.op.request_id = 1;
    3.76 +-
    3.77 +-  ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8");
    3.78 +-
    3.79 +-  ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language);
    3.80 +-  cupsLangFree (language);
    3.81 +-
    3.82 +-  return request;
    3.83 +-}
    3.84 +-
    3.85 +-static ipp_t *
    3.86 + cups_request_new_for_printer (int operation_id, const gchar * printer)
    3.87 + {
    3.88 +   ipp_t *request;
    3.89 +@@ -160,7 +172,7 @@ cups_request_new_for_printer (int operation_id, const gchar * printer)
    3.90 +   }
    3.91 + 
    3.92 +   printer_uri = g_strdup_printf ("ipp://%s/printers/%s", server, printer);
    3.93 +-  request = cups_request_new (operation_id);
    3.94 ++  request = ippNewRequest (operation_id);
    3.95 + 
    3.96 +   ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer_uri);
    3.97 + 
    3.98 +@@ -242,24 +254,24 @@ get_printers ()
    3.99 + 
   3.100 +       if (!request)
   3.101 +         continue;
   3.102 +-      if (request->state == IPP_ERROR || request->state == IPP_IDLE) {
   3.103 ++      if (ippGetState (request) == IPP_ERROR || ippGetState (request) == IPP_IDLE) {
   3.104 +         ippDelete (request);
   3.105 +         continue;
   3.106 +       }
   3.107 + 
   3.108 +       attr = ippFindAttribute (request, "printer-info", IPP_TAG_TEXT);
   3.109 +-      if (!attr || strlen (attr->values[0].string.text) == 0) {
   3.110 ++      if (!attr || strlen (ippGetString (attr, 0, NULL)) == 0) {
   3.111 +         attr = ippFindAttribute (request, "printer-make-and-model", IPP_TAG_TEXT);
   3.112 +         if (attr)
   3.113 +-          printer->alias = g_strdup (attr->values[0].string.text);
   3.114 ++          printer->alias = g_strdup (ippGetString (attr, 0, NULL));
   3.115 +         else
   3.116 +           printer->alias = g_strdup ("");
   3.117 +       }
   3.118 +       else
   3.119 +-        printer->alias = g_strdup (attr->values[0].string.text);
   3.120 ++        printer->alias = g_strdup (ippGetString (attr, 0, NULL));
   3.121 + 
   3.122 +       attr = ippFindAttribute (request, "printer-type", IPP_TAG_ENUM);
   3.123 +-      if (attr && (attr->values[0].integer & CUPS_PRINTER_CLASS))
   3.124 ++      if (attr && (ippGetInteger (attr, 0) & CUPS_PRINTER_CLASS))
   3.125 +         printer->type = PRINTER_TYPE_CLASS;
   3.126 +       else
   3.127 +         printer->type = PRINTER_TYPE_PRINTER;
   3.128 +@@ -309,7 +321,7 @@ get_printer_state (const gchar * printer)
   3.129 +     ipp_attribute_t *attr = ippFindAttribute (request, "printer-state",
   3.130 +                                               IPP_TAG_ENUM);
   3.131 +     if (attr)
   3.132 +-      switch (attr->values[0].integer) {
   3.133 ++      switch (ippGetInteger (attr, 0)) {
   3.134 +       case IPP_PRINTER_IDLE:
   3.135 +         state = PRINTER_STATE_IDLE;
   3.136 +         break;
   3.137 +-- 
   3.138 +1.7.9.5
   3.139 +