diff options
Diffstat (limited to 'libraries/libgnomecups')
6 files changed, 453 insertions, 3 deletions
diff --git a/libraries/libgnomecups/libgnomecups.SlackBuild b/libraries/libgnomecups/libgnomecups.SlackBuild index 9a4e2ae32a87e..6cf321fb74ce3 100644 --- a/libraries/libgnomecups/libgnomecups.SlackBuild +++ b/libraries/libgnomecups/libgnomecups.SlackBuild @@ -29,12 +29,10 @@ VERSION=0.2.3 BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -# Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i486 ;; arm*) ARCH=arm ;; - # Unless $ARCH is already set, use uname -m for all other archs: *) ARCH=$( uname -m ) ;; esac fi @@ -60,7 +58,7 @@ fi rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT -cd $TMP || exit 1 +cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 cd $PRGNAM-$VERSION || exit 1 @@ -71,6 +69,20 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +patch -p0 -i $CWD/patches/enablenet.patch + +# Fix .pc file +patch -p0 -i $CWD/patches/$PRGNAM-$VERSION-pkgconfig.patch + +# Upstream fix for g_list_find_custom() argument order +patch -p1 -i $CWD/patches/$PRGNAM-$VERSION-g_list_find_custom.patch + +# >=glib-2.31 compat +patch -p1 -i $CWD/patches/$PRGNAM-$VERSION-glib.h.patch + +# cups-1.6 compat +patch -p1 -i $CWD/patches/$PRGNAM-$VERSION-cups-1.6.patch + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ diff --git a/libraries/libgnomecups/patches/enablenet.patch b/libraries/libgnomecups/patches/enablenet.patch new file mode 100644 index 0000000000000..f2e113d1440fe --- /dev/null +++ b/libraries/libgnomecups/patches/enablenet.patch @@ -0,0 +1,11 @@ +--- libgnomecups/gnome-cups-printer.c.orig 2005-08-04 18:21:32.221038336 +0000 ++++ libgnomecups/gnome-cups-printer.c 2005-08-04 18:22:00.369759080 +0000 +@@ -282,7 +282,7 @@ + * that will produce an infinite loop when presented with an invalid + * hostname. This will also produce a hang if the remote printer is + * unavailable and we do a syncronous lookup. */ +-static gboolean go_directly_to_printer_when_possible = FALSE; ++static gboolean go_directly_to_printer_when_possible = TRUE; + + static void + update_attributes (GnomeCupsPrinter *printer) diff --git a/libraries/libgnomecups/patches/libgnomecups-0.2.3-cups-1.6.patch b/libraries/libgnomecups/patches/libgnomecups-0.2.3-cups-1.6.patch new file mode 100644 index 0000000000000..68f379c251095 --- /dev/null +++ b/libraries/libgnomecups/patches/libgnomecups-0.2.3-cups-1.6.patch @@ -0,0 +1,285 @@ +From ae783efde4fa69578651994505462f02b8639220 Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gentoo.org> +Date: Tue, 7 Aug 2012 06:53:09 -0400 +Subject: [PATCH] Use CUPS-1.6 IPP API getter/setter functions + +CUPS 1.6 makes various structures private and introduces these ippGet +and ippSet functions for all of the fields in these structures. +http://www.cups.org/str.php?L3928 + +We define our own accessors when building against CUPS < 1.6. + +Based on work by Jiri Popelka <jpopelka@redhat.com> at +https://bugzilla.gnome.org/show_bug.cgi?id=679759 +--- + libgnomecups/gnome-cups-printer.c | 48 +++++++++++++++++++++++++++++------- + libgnomecups/gnome-cups-queue.c | 43 +++++++++++++++++++++++++++------ + libgnomecups/gnome-cups-request.c | 44 ++++++++++++++++++++++++++++----- + 3 files changed, 110 insertions(+), 25 deletions(-) + +diff --git a/libgnomecups/gnome-cups-printer.c b/libgnomecups/gnome-cups-printer.c +index c924af0..f5e1ef7 100644 +--- a/libgnomecups/gnome-cups-printer.c ++++ b/libgnomecups/gnome-cups-printer.c +@@ -37,6 +37,34 @@ + + #define UPDATE_TIMEOUT 5000 + ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) ++#define HAVE_CUPS_1_6 1 ++#endif ++ ++#ifndef HAVE_CUPS_1_6 ++#define ippGetCount(attr) attr->num_values ++#define ippGetName(attr) attr->name ++#define ippGetInteger(attr, element) attr->values[element].integer ++#define ippGetString(attr, element, language) attr->values[element].string.text ++ ++static ipp_attribute_t * ++ippFirstAttribute(ipp_t *ipp) ++{ ++ if (!ipp) ++ return (NULL); ++ return (ipp->current = ipp->attrs); ++} ++ ++static ipp_attribute_t * ++ippNextAttribute(ipp_t *ipp) ++{ ++ if (!ipp || !ipp->current) ++ return (NULL); ++ return (ipp->current = ipp->current->next); ++} ++#endif ++ ++ + struct _GnomeCupsPPDFile { + char name[1]; + }; +@@ -173,9 +201,9 @@ map_reasons (GnomeCupsPrinter *printer, + printer->details->state_reasons = NULL; + + /* cf. RFC2911 4.4.12 */ +- for (i = 0; i < attr->num_values; i++) { ++ for (i = 0; i < ippGetCount (attr); i++) { + const char *p; +- const char *keyword = attr->values [i].string.text; ++ const char *keyword = ippGetString (attr, i, NULL); + + reason = g_new (GnomeCupsPrinterReason, 1); + +@@ -224,8 +252,8 @@ gnome_cups_printer_get_info (GnomeCupsPrinter *printer) + return printer->details->info; + } + +-#define MAP_INT(v,a) {if (!g_ascii_strcasecmp (attr->name, (a))) { if ((v) != attr->values[0].integer) { changed = TRUE; } (v) = attr->values[0].integer; }} +-#define MAP_STRING(v,a) {if (!g_ascii_strcasecmp (attr->name, (a))) { if (!v || strcmp (v, attr->values[0].string.text)) { g_free (v); changed = TRUE; (v) = g_strdup (attr->values[0].string.text); }}} ++#define MAP_INT(v,a) {if (!g_ascii_strcasecmp (ippGetName (attr), (a))) { if ((v) != ippGetInteger (attr, 0)) { changed = TRUE; } (v) = ippGetInteger (attr, 0); }} ++#define MAP_STRING(v,a) {if (!g_ascii_strcasecmp (ippGetName (attr), (a))) { if (!v || strcmp (v, ippGetString (attr, 0, NULL))) { g_free (v); changed = TRUE; (v) = g_strdup (ippGetString (attr, 0, NULL)); }}} + + static void + attributes_update_cb (guint id, +@@ -243,14 +271,14 @@ attributes_update_cb (guint id, + changed = FALSE; + + if (!error && response) { +- for (attr = response->attrs; attr != NULL; attr = attr->next) { +- if (!attr->name) { ++ for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response)) { ++ if (!ippGetName (attr)) { + continue; + } +- if (!g_ascii_strcasecmp (attr->name, "attributes-charset") || !strcmp (attr->name, "attributes-charset")) { ++ if (!g_ascii_strcasecmp (ippGetName (attr), "attributes-charset") || !strcmp (ippGetName (attr), "attributes-charset")) { + continue; + } +- if (!g_ascii_strcasecmp (attr->name, "printer-state-reasons")) { ++ if (!g_ascii_strcasecmp (ippGetName (attr), "printer-state-reasons")) { + map_reasons (printer, attr); + } + MAP_INT (printer->details->state, "printer-state"); +@@ -570,7 +598,7 @@ get_default (void) + + attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME); + if (attr) { +- name = g_strdup (attr->values[0].string.text); ++ name = g_strdup (ippGetString (attr, 0, NULL)); + } else { + name = NULL; + } +@@ -698,7 +726,7 @@ get_printer_names (void) + attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME); + while (attr) { + ret = g_list_prepend (ret, +- g_strdup (attr->values[0].string.text)); ++ g_strdup (ippGetString (attr, 0, NULL))); + + attr = ippFindNextAttribute (response, + "printer-name", +diff --git a/libgnomecups/gnome-cups-queue.c b/libgnomecups/gnome-cups-queue.c +index 9f98ed9..298db42 100644 +--- a/libgnomecups/gnome-cups-queue.c ++++ b/libgnomecups/gnome-cups-queue.c +@@ -15,6 +15,33 @@ + + #define UPDATE_TIMEOUT 3000 + ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) ++#define HAVE_CUPS_1_6 1 ++#endif ++ ++#ifndef HAVE_CUPS_1_6 ++#define ippGetName(attr) attr->name ++#define ippGetInteger(attr, element) attr->values[element].integer ++#define ippGetString(attr, element, language) attr->values[element].string.text ++ ++static ipp_attribute_t * ++ippFirstAttribute(ipp_t *ipp) ++{ ++ if (!ipp) ++ return (NULL); ++ return (ipp->current = ipp->attrs); ++} ++ ++static ipp_attribute_t * ++ippNextAttribute(ipp_t *ipp) ++{ ++ if (!ipp || !ipp->current) ++ return (NULL); ++ return (ipp->current = ipp->current->next); ++} ++#endif ++ ++ + struct _GnomeCupsQueueDetails { + char *queue_name; + GList *jobs; +@@ -199,8 +226,8 @@ finish_job (GnomeCupsJob *job) + job->size = job->size * 1024; + } + +-#define MAP_STR(dest, src) { if (!g_ascii_strcasecmp (attr->name, (src))) { if ((dest) != NULL) g_free (dest); (dest) = g_strdup (attr->values[0].string.text);}} +-#define MAP_INT(dest, src) { if (!g_ascii_strcasecmp (attr->name, (src))) { (dest) = attr->values[0].integer; } } ++#define MAP_STR(dest, src) { if (!g_ascii_strcasecmp (ippGetName (attr), (src))) { if ((dest) != NULL) g_free (dest); (dest) = g_strdup (ippGetString (attr, 0, NULL));}} ++#define MAP_INT(dest, src) { if (!g_ascii_strcasecmp (ippGetName (attr), (src))) { (dest) = ippGetInteger (attr, 0); } } + + static void + get_jobs_cb (guint id, +@@ -231,8 +258,8 @@ get_jobs_cb (guint id, + + if (response) { + job = g_new0 (GnomeCupsJob, 1); +- for (attr = response->attrs; attr != NULL; attr = attr->next) { +- if (attr->name == NULL) { ++ for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response)) { ++ if (ippGetName (attr) == NULL) { + if (job->name) { + finish_job (job); + jobs = g_list_prepend (jobs, job); +@@ -244,7 +271,7 @@ get_jobs_cb (guint id, + continue; + } + +- if (!g_ascii_strcasecmp (attr->name, "attributes-charset") || !g_ascii_strcasecmp (attr->name, "attributes-charset")) { ++ if (!g_ascii_strcasecmp (ippGetName (attr), "attributes-charset") || !g_ascii_strcasecmp (ippGetName (attr), "attributes-charset")) { + continue; + + } +@@ -355,8 +382,8 @@ gnome_cups_queue_get_job_nocache (GnomeCupsQueue *queue, + + if (response) { + job = g_new0 (GnomeCupsJob, 1); +- for (attr = response->attrs; attr != NULL; attr = attr->next) { +- if (attr->name == NULL) { ++ for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response)) { ++ if (ippGetName (attr) == NULL) { + if (job->name) { + finish_job (job); + } else { +@@ -366,7 +393,7 @@ gnome_cups_queue_get_job_nocache (GnomeCupsQueue *queue, + break; + } + +- if (!g_ascii_strcasecmp (attr->name, "attributes-charset") || !g_ascii_strcasecmp (attr->name, "attributes-charset")) { ++ if (!g_ascii_strcasecmp (ippGetName (attr), "attributes-charset") || !g_ascii_strcasecmp (ippGetName (attr), "attributes-charset")) { + continue; + } + +diff --git a/libgnomecups/gnome-cups-request.c b/libgnomecups/gnome-cups-request.c +index c94f623..13f0948 100644 +--- a/libgnomecups/gnome-cups-request.c ++++ b/libgnomecups/gnome-cups-request.c +@@ -19,6 +19,36 @@ + #define STOP_UNUSED_THREADS_TIMEOUT 60 + #define CLOSE_UNUSED_CONNECTIONS_TIMEOUT 30 + ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) ++#define HAVE_CUPS_1_6 1 ++#endif ++ ++#ifndef HAVE_CUPS_1_6 ++#define ippGetCount(attr) attr->num_values ++#define ippGetValueTag(attr) attr->value_tag ++#define ippGetName(attr) attr->name ++#define ippGetBoolean(attr, element) attr->values[element].boolean ++#define ippGetInteger(attr, element) attr->values[element].integer ++#define ippGetString(attr, element, language) attr->values[element].string.text ++ ++static ipp_attribute_t * ++ippFirstAttribute(ipp_t *ipp) ++{ ++ if (!ipp) ++ return (NULL); ++ return (ipp->current = ipp->attrs); ++} ++ ++static ipp_attribute_t * ++ippNextAttribute(ipp_t *ipp) ++{ ++ if (!ipp || !ipp->current) ++ return (NULL); ++ return (ipp->current = ipp->current->next); ++} ++#endif ++ ++ + typedef struct + { + GMutex *mutex; +@@ -276,14 +306,14 @@ dump_request (ipp_t const *req) + unsigned i; + ipp_attribute_t *attr; + +- for (attr = req->attrs; attr != NULL; attr = attr->next) { +- g_print ("%s", attr->name); +- for (i = 0 ; i < attr->num_values ; i++) { ++ for (attr = ippFirstAttribute (req); attr != NULL; attr = ippNextAttribute (req)) { ++ g_print ("%s", ippGetName (attr)); ++ for (i = 0 ; i < ippGetCount (attr) ; i++) { + g_print ("\t[%d] = ", i); +- switch (attr->value_tag & ~IPP_TAG_COPY) { ++ switch (ippGetValueTag (attr) & ~IPP_TAG_COPY) { + case IPP_TAG_INTEGER: + case IPP_TAG_ENUM: +- g_print ("%d\n", attr->values[i].integer); ++ g_print ("%d\n", ippGetInteger (attr, i)); + break; + + case IPP_TAG_STRING: +@@ -294,11 +324,11 @@ dump_request (ipp_t const *req) + case IPP_TAG_CHARSET: + case IPP_TAG_LANGUAGE: + case IPP_TAG_MIMETYPE: +- g_print ("'%s'\n", attr->values[i].string.text); ++ g_print ("'%s'\n", ippGetString (attr, i, NULL)); + break; + + case IPP_TAG_BOOLEAN: +- g_print ("%s\n", (int)attr->values[i].boolean ? "true" : "false"); ++ g_print ("%s\n", (int)ippGetBoolean (attr, i) ? "true" : "false"); + break; + + default: +-- +1.7.8.6 + diff --git a/libraries/libgnomecups/patches/libgnomecups-0.2.3-g_list_find_custom.patch b/libraries/libgnomecups/patches/libgnomecups-0.2.3-g_list_find_custom.patch new file mode 100644 index 0000000000000..3383cde16786a --- /dev/null +++ b/libraries/libgnomecups/patches/libgnomecups-0.2.3-g_list_find_custom.patch @@ -0,0 +1,94 @@ +From 14979a2356fd751d82d037db65ce92072097bbf3 Mon Sep 17 00:00:00 2001 +From: Kjartan Maraas <kmaraas@gnome.org> +Date: Wed, 30 Jan 2008 17:30:43 +0000 +Subject: [PATCH] Fix some warnings. Fix wrong order of arguments to + g_list_find_custom. + +2008-01-30 Kjartan Maraas <kmaraas@gnome.org> + + * libgnomecups/gnome-cups-printer.c: (set_timeout), + (gnome_cups_printer_get_state_name), + (_gnome_cups_printer_get_host): Fix some warnings. + * libgnomecups/gnome-cups-queue.c: (gnome_cups_queue_get_job): + Fix wrong order of arguments to g_list_find_custom. + +svn path=/trunk/; revision=237 +--- + ChangeLog | 8 ++++++++ + libgnomecups/gnome-cups-printer.c | 7 +++---- + libgnomecups/gnome-cups-queue.c | 4 ++-- + 3 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index b41ac9e..166c87a 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,11 @@ ++2008-01-30 Kjartan Maraas <kmaraas@gnome.org> ++ ++ * libgnomecups/gnome-cups-printer.c: (set_timeout), ++ (gnome_cups_printer_get_state_name), ++ (_gnome_cups_printer_get_host): Fix some warnings. ++ * libgnomecups/gnome-cups-queue.c: (gnome_cups_queue_get_job): ++ Fix wrong order of arguments to g_list_find_custom. ++ + 2008-01-18 Gil Forcada <gforcada@gnome.org> + + * configure.in: Added mk, tr and zh_HK to ALL_LINGUAS. +diff --git a/libgnomecups/gnome-cups-printer.c b/libgnomecups/gnome-cups-printer.c +index 9c5c7d3..704f205 100644 +--- a/libgnomecups/gnome-cups-printer.c ++++ b/libgnomecups/gnome-cups-printer.c +@@ -791,7 +791,7 @@ set_timeout (void) + + if (should_timeout && !update_timeout_id) { + update_timeout_id = g_timeout_add (UPDATE_TIMEOUT, +- update_printers_timeout, ++ (GSourceFunc)update_printers_timeout, + NULL); + } else if (!should_timeout && update_timeout_id) { + g_source_remove (update_timeout_id); +@@ -1069,7 +1069,6 @@ gnome_cups_printer_get_state (GnomeCupsPrinter *printer) + const char * + gnome_cups_printer_get_state_name (GnomeCupsPrinter *printer) + { +- const char *state_str; + ipp_pstate_t state; + + g_return_val_if_fail (GNOME_CUPS_IS_PRINTER (printer), NULL); +@@ -1079,7 +1078,7 @@ gnome_cups_printer_get_state_name (GnomeCupsPrinter *printer) + + state = printer->details->state; + +- return state_str = _(printer_state_strings[state - IPP_PRINTER_IDLE]); ++ return _(printer_state_strings[state - IPP_PRINTER_IDLE]); + } + + const char * +@@ -2001,7 +2000,7 @@ _gnome_cups_printer_get_host (GnomeCupsPrinter *printer) + { + gchar *host = NULL; + +-#warning this is broken for smb://user:pass@host/printer urls ++ /* warning this is broken for smb://user:pass@host/printer urls */ + if (go_directly_to_printer_when_possible && + printer->details->printer_uri) { + gchar *x, *y; +diff --git a/libgnomecups/gnome-cups-queue.c b/libgnomecups/gnome-cups-queue.c +index d9b9a92..9f98ed9 100644 +--- a/libgnomecups/gnome-cups-queue.c ++++ b/libgnomecups/gnome-cups-queue.c +@@ -413,8 +413,8 @@ gnome_cups_queue_get_job (GnomeCupsQueue *queue, + { + if (cache_ok) { + GList *link = g_list_find_custom (queue->details->jobs, +- (GCompareFunc) find_job_by_id, +- GINT_TO_POINTER (job_id)); ++ GINT_TO_POINTER (job_id), ++ (GCompareFunc) find_job_by_id); + if (link) + return gnome_cups_job_dup (link->data); + } +-- +1.7.8.4 + diff --git a/libraries/libgnomecups/patches/libgnomecups-0.2.3-glib.h.patch b/libraries/libgnomecups/patches/libgnomecups-0.2.3-glib.h.patch new file mode 100644 index 0000000000000..3f73af861c04d --- /dev/null +++ b/libraries/libgnomecups/patches/libgnomecups-0.2.3-glib.h.patch @@ -0,0 +1,38 @@ +From d84eee9450b3b6f6155074915efc61bedcc8d446 Mon Sep 17 00:00:00 2001 +From: Dominique Leuenberger <dimstar@opensuse.org> +Date: Sun, 27 Nov 2011 21:36:41 +0100 +Subject: [PATCH] Fix: Only glib.h can be included + +--- + libgnomecups/gnome-cups-i18n.c | 2 +- + libgnomecups/gnome-cups-init.h | 3 +-- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/libgnomecups/gnome-cups-i18n.c b/libgnomecups/gnome-cups-i18n.c +index 8987c5c..127756d 100644 +--- a/libgnomecups/gnome-cups-i18n.c ++++ b/libgnomecups/gnome-cups-i18n.c +@@ -1,5 +1,5 @@ + #include <config.h> +-#include <glib/gmacros.h> ++#include <glib.h> + #include "gnome-cups-i18n.h" + + #ifdef ENABLE_NLS +diff --git a/libgnomecups/gnome-cups-init.h b/libgnomecups/gnome-cups-init.h +index 22b682a..c4600fc 100644 +--- a/libgnomecups/gnome-cups-init.h ++++ b/libgnomecups/gnome-cups-init.h +@@ -1,8 +1,7 @@ + #ifndef GNOME_CUPS_INIT + #define GNOME_CUPS_INIT + +-#include <glib/gtypes.h> +-#include <glib/gmacros.h> ++#include <glib.h> + + G_BEGIN_DECLS + +-- +1.7.7 + diff --git a/libraries/libgnomecups/patches/libgnomecups-0.2.3-pkgconfig.patch b/libraries/libgnomecups/patches/libgnomecups-0.2.3-pkgconfig.patch new file mode 100644 index 0000000000000..8fe6502a6f388 --- /dev/null +++ b/libraries/libgnomecups/patches/libgnomecups-0.2.3-pkgconfig.patch @@ -0,0 +1,10 @@ +--- libgnomecups-1.0.pc.in~ 2007-01-02 01:18:51.000000000 +0100 ++++ libgnomecups-1.0.pc.in 2011-05-08 13:21:35.000000000 +0200 +@@ -7,5 +7,6 @@ + Description: GNOME CUPS Library + Version: @VERSION@ + Requires: glib-2.0 gobject-2.0 +-Libs: -L${libdir} -lgnomecups-1.0 @CUPS_LIBS@ ++Libs: -L${libdir} -lgnomecups-1.0 ++Libs.private: -L${libdir} -lgnomecups-1.0 @CUPS_LIBS@ + Cflags: -I${includedir} @CUPS_CFLAGS@ |