1bd8b5cc15
postscriptdriver tags.
100 lines
3.2 KiB
Diff
100 lines
3.2 KiB
Diff
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 <dirent.h>
|
|
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);
|
|
|
|
/** @} */
|
|
|