From 1bd8b5cc15964ba78b6dd19505a4ee0c1062647f Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 5 Feb 2010 15:27:26 +0000 Subject: [PATCH] - CUPS driver: if DESTDIR is set, use it when looking for XML files. Fixes postscriptdriver tags. --- gutenprint-postscriptdriver.patch | 99 +++++++++++++++++++++++++++++++ gutenprint.spec | 10 +++- 2 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 gutenprint-postscriptdriver.patch diff --git a/gutenprint-postscriptdriver.patch b/gutenprint-postscriptdriver.patch new file mode 100644 index 0000000..ce682ba --- /dev/null +++ b/gutenprint-postscriptdriver.patch @@ -0,0 +1,99 @@ +diff -up gutenprint-5.2.4/src/main/module.c.postscriptdriver gutenprint-5.2.4/src/main/module.c +--- gutenprint-5.2.4/src/main/module.c.postscriptdriver 2006-09-30 16:02:59.000000000 +0100 ++++ gutenprint-5.2.4/src/main/module.c 2010-02-05 10:01:18.668652991 +0000 +@@ -151,12 +151,20 @@ int stp_module_load(void) + } + else + { ++ const char *prefix = getenv("DESTDIR"); + #ifdef USE_LTDL + stp_path_split(dir_list, getenv("LTDL_LIBRARY_PATH")); + stp_path_split(dir_list, lt_dlgetsearchpath()); + #else + stp_path_split(dir_list, PKGMODULEDIR); + #endif ++ if (prefix) ++ { ++ stp_list_t *prefix_list; ++ prefix_list = stp_paths_copy_with_prefix(dir_list, prefix); ++ stp_list_destroy(dir_list); ++ dir_list = prefix_list; ++ } + } + #ifdef USE_LTDL + file_list = stp_path_search(dir_list, ".la"); +diff -up gutenprint-5.2.4/src/main/path.c.postscriptdriver gutenprint-5.2.4/src/main/path.c +--- gutenprint-5.2.4/src/main/path.c.postscriptdriver 2008-06-01 15:41:18.000000000 +0100 ++++ gutenprint-5.2.4/src/main/path.c 2010-02-05 10:33:18.117778663 +0000 +@@ -158,7 +158,17 @@ stpi_data_path(void) + if (getenv("STP_DATA_PATH")) + stp_path_split(dir_list, getenv("STP_DATA_PATH")); + else +- stp_path_split(dir_list, PKGXMLDATADIR); ++ { ++ const char *prefix = getenv("DESTDIR"); ++ stp_path_split(dir_list, PKGXMLDATADIR); ++ if (prefix) ++ { ++ stp_list_t *prefix_list; ++ prefix_list = stp_paths_copy_with_prefix(dir_list, prefix); ++ stp_list_destroy(dir_list); ++ dir_list = prefix_list; ++ } ++ } + return dir_list; + } + +@@ -226,6 +236,40 @@ stp_path_split(stp_list_t *list, /* List + } + } + ++/* ++ * Split a PATH-type string (colon-delimited) into separate ++ * directories. ++ */ ++stp_list_t * ++stp_paths_copy_with_prefix(stp_list_t *list, /* List to add prefix to */ ++ const char *prefix) /* Prefix to add */ ++{ ++ stp_list_t *new_list; ++ stp_list_item_t *item; ++ int prefixlen = strlen (prefix); ++ if (!(new_list = stp_list_create())) ++ return; ++ ++ item = stp_list_get_start (list); ++ while (item) ++ { ++ const char *data; ++ char *new_data; ++ int len; ++ data = stp_list_item_get_data (item); ++ len = strlen (data); ++ new_data = (char *) stp_malloc(prefixlen + 1 + len + 1); ++ strncpy(new_data, prefix, prefixlen); ++ new_data[prefixlen] = '/'; ++ strcpy(new_data + prefixlen + 1, data); ++ stp_list_item_create(new_list, NULL, new_data); ++ ++ item = stp_list_item_next (item); ++ } ++ ++ return new_list; ++} ++ + /* Adapted from GNU libc + These macros extract size information from a `struct dirent *'. + They may evaluate their argument multiple times, so it must not +diff -up gutenprint-5.2.4/src/main/util.h.postscriptdriver gutenprint-5.2.4/src/main/util.h +--- gutenprint-5.2.4/src/main/util.h.postscriptdriver 2007-02-24 21:49:22.000000000 +0000 ++++ gutenprint-5.2.4/src/main/util.h 2010-02-05 10:24:16.253778762 +0000 +@@ -61,6 +61,8 @@ extern void stpi_init_printer(void); + #define BUFFER_FLAG_FLIP_X 0x1 + #define BUFFER_FLAG_FLIP_Y 0x2 + extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags); ++extern stp_list_t *stp_paths_copy_with_prefix(stp_list_t* list, ++ const char *prefix); + + /** @} */ + diff --git a/gutenprint.spec b/gutenprint.spec index 8ff1324..38c3fdb 100644 --- a/gutenprint.spec +++ b/gutenprint.spec @@ -4,7 +4,7 @@ Name: gutenprint Summary: Printer Drivers Package. Version: 5.2.4 -Release: 10%{?dist} +Release: 11%{?dist} Group: System Environment/Base URL: http://gimp-print.sourceforge.net/ Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2 @@ -15,6 +15,7 @@ Patch1: gutenprint-O6.patch Patch2: gutenprint-selinux.patch Patch3: gutenprint-deviceid.patch Patch4: gutenprint-brother-hl-2040.patch +Patch5: gutenprint-postscriptdriver.patch License: GPLv2+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: cups-libs >= 1.1.22-0.rc1.9.10, cups >= 1.1.22-0.rc1.9.10 @@ -30,7 +31,7 @@ Obsoletes: gimp-print-utils <= 4.2.7-25 Provides: gimp-print-utils = 4.2.7-25 # Make sure we get postscriptdriver tags. -BuildRequires: pycups +BuildRequires: pycups, cups ## NOTE ## # The README file in this package contains suggestions from upstream @@ -145,6 +146,7 @@ Epson, HP and compatible printers. %patch2 -p1 -b .selinux %patch3 -p1 -b .deviceid %patch4 -p1 -b .brother-hl-2040 +%patch5 -p1 -b .postscriptdriver cp %{SOURCE2} src/cups/cups-genppdupdate.in @@ -273,6 +275,10 @@ fi /bin/rm -f /var/cache/foomatic/* %changelog +* Fri Feb 5 2010 Tim Waugh 5.2.4-11 +- CUPS driver: if DESTDIR is set, use it when looking for XML files. + Fixes postscriptdriver tags. + * Thu Feb 4 2010 Tim Waugh 5.2.4-10 - Rebuild for postscriptdriver tags.