gutenprint-postscriptdriver.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. diff -up gutenprint-5.2.6/src/main/gutenprint-internal.h.postscriptdriver gutenprint-5.2.6/src/main/gutenprint-internal.h
  2. --- gutenprint-5.2.6/src/main/gutenprint-internal.h.postscriptdriver 2010-08-04 02:33:56.000000000 +0200
  3. +++ gutenprint-5.2.6/src/main/gutenprint-internal.h 2010-08-11 16:11:19.000000000 +0200
  4. @@ -56,6 +56,8 @@ extern void stpi_init_printer(void);
  5. #define BUFFER_FLAG_FLIP_X 0x1
  6. #define BUFFER_FLAG_FLIP_Y 0x2
  7. extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags);
  8. +extern stp_list_t *stp_paths_copy_with_prefix(stp_list_t* list,
  9. + const char *prefix);
  10. #define STPI_ASSERT(x,v) \
  11. do \
  12. diff -up gutenprint-5.2.6/src/main/module.c.postscriptdriver gutenprint-5.2.6/src/main/module.c
  13. --- gutenprint-5.2.6/src/main/module.c.postscriptdriver 2006-09-30 17:02:59.000000000 +0200
  14. +++ gutenprint-5.2.6/src/main/module.c 2010-08-11 16:13:43.000000000 +0200
  15. @@ -151,12 +151,20 @@ int stp_module_load(void)
  16. }
  17. else
  18. {
  19. + const char *prefix = getenv("DESTDIR");
  20. #ifdef USE_LTDL
  21. stp_path_split(dir_list, getenv("LTDL_LIBRARY_PATH"));
  22. stp_path_split(dir_list, lt_dlgetsearchpath());
  23. #else
  24. stp_path_split(dir_list, PKGMODULEDIR);
  25. #endif
  26. + if (prefix)
  27. + {
  28. + stp_list_t *prefix_list;
  29. + prefix_list = stp_paths_copy_with_prefix(dir_list, prefix);
  30. + stp_list_destroy(dir_list);
  31. + dir_list = prefix_list;
  32. + }
  33. }
  34. #ifdef USE_LTDL
  35. file_list = stp_path_search(dir_list, ".la");
  36. diff -up gutenprint-5.2.6/src/main/path.c.postscriptdriver gutenprint-5.2.6/src/main/path.c
  37. --- gutenprint-5.2.6/src/main/path.c.postscriptdriver 2008-06-01 16:41:18.000000000 +0200
  38. +++ gutenprint-5.2.6/src/main/path.c 2010-08-11 16:13:43.000000000 +0200
  39. @@ -158,7 +158,17 @@ stpi_data_path(void)
  40. if (getenv("STP_DATA_PATH"))
  41. stp_path_split(dir_list, getenv("STP_DATA_PATH"));
  42. else
  43. - stp_path_split(dir_list, PKGXMLDATADIR);
  44. + {
  45. + const char *prefix = getenv("DESTDIR");
  46. + stp_path_split(dir_list, PKGXMLDATADIR);
  47. + if (prefix)
  48. + {
  49. + stp_list_t *prefix_list;
  50. + prefix_list = stp_paths_copy_with_prefix(dir_list, prefix);
  51. + stp_list_destroy(dir_list);
  52. + dir_list = prefix_list;
  53. + }
  54. + }
  55. return dir_list;
  56. }
  57. @@ -226,6 +236,40 @@ stp_path_split(stp_list_t *list, /* List
  58. }
  59. }
  60. +/*
  61. + * Split a PATH-type string (colon-delimited) into separate
  62. + * directories.
  63. + */
  64. +stp_list_t *
  65. +stp_paths_copy_with_prefix(stp_list_t *list, /* List to add prefix to */
  66. + const char *prefix) /* Prefix to add */
  67. +{
  68. + stp_list_t *new_list;
  69. + stp_list_item_t *item;
  70. + int prefixlen = strlen (prefix);
  71. + if (!(new_list = stp_list_create()))
  72. + return;
  73. +
  74. + item = stp_list_get_start (list);
  75. + while (item)
  76. + {
  77. + const char *data;
  78. + char *new_data;
  79. + int len;
  80. + data = stp_list_item_get_data (item);
  81. + len = strlen (data);
  82. + new_data = (char *) stp_malloc(prefixlen + 1 + len + 1);
  83. + strncpy(new_data, prefix, prefixlen);
  84. + new_data[prefixlen] = '/';
  85. + strcpy(new_data + prefixlen + 1, data);
  86. + stp_list_item_create(new_list, NULL, new_data);
  87. +
  88. + item = stp_list_item_next (item);
  89. + }
  90. +
  91. + return new_list;
  92. +}
  93. +
  94. /* Adapted from GNU libc <dirent.h>
  95. These macros extract size information from a `struct dirent *'.
  96. They may evaluate their argument multiple times, so it must not