summaryrefslogtreecommitdiff
path: root/graphics/camlimages/patches
diff options
context:
space:
mode:
authormarino <marino>2012-07-29 12:52:55 +0000
committermarino <marino>2012-07-29 12:52:55 +0000
commitba151f466b070775ef32e5f8c987a6d583baaa3d (patch)
tree005fbb80a9a13179804353fbd87650fca809394f /graphics/camlimages/patches
parent0b09f5b410e997c4cc46e4bd89a446c0a4f9ba41 (diff)
downloadpkgsrc-ba151f466b070775ef32e5f8c987a6d583baaa3d.tar.gz
graphics/camlimages: Fix tiff-4.0 regression
When tiff was upgraded to 4.0, camlimages stopped building. Both caml and tiff redefine several common typedefs such as uint32. Unlike the 3-series of tiff, tiff-4.0 also redefined int64 and uint64. The existing hack didn't foresee int64 and uint64 getting used, and so camlimages broke. One patch was created and another revised to override the caml typedef definitions with macros before tiff.h is included. The original tiffread.c patch was reworked to override uint16 and uint32 *again* after the tiff.h include and not before as it was originally. Very ugly all around, but I just extended what camlimages was already doing.
Diffstat (limited to 'graphics/camlimages/patches')
-rw-r--r--graphics/camlimages/patches/patch-src_tiffread.c32
-rw-r--r--graphics/camlimages/patches/patch-src_tiffwrite.c28
2 files changed, 54 insertions, 6 deletions
diff --git a/graphics/camlimages/patches/patch-src_tiffread.c b/graphics/camlimages/patches/patch-src_tiffread.c
index 54d0f6f1c6f..d1957f5fe11 100644
--- a/graphics/camlimages/patches/patch-src_tiffread.c
+++ b/graphics/camlimages/patches/patch-src_tiffread.c
@@ -1,13 +1,33 @@
-$NetBSD: patch-src_tiffread.c,v 1.1 2011/08/07 20:36:20 wiz Exp $
+$NetBSD: patch-src_tiffread.c,v 1.2 2012/07/29 12:52:55 marino Exp $
---- src/tiffread.c.orig 2011-01-25 14:10:44.000000000 +0000
-+++ src/tiffread.c 2011-04-17 13:37:39.000000000 +0000
-@@ -28,6 +28,8 @@
+Both ocaml/caml/config.h and tiff.h define int32, uint32, etc.
+The workaround of this name polution is to intentionally overwrite the
+first caml definition with a garbage macro before tiff.h is included and
+then unset it after the include. After tiff version 4.0.1, the same hack
+has to be applied to 64-bit types. Unlike tiffwrite.c, tiffread.c forgot
+to unset the bogus definitions. The uint16 and uint32 then has to be
+redefined correctly. (ugly hack)
+
+--- src/tiffread.c.orig 2011-06-22 18:04:32.000000000 +0000
++++ src/tiffread.c
+@@ -28,9 +28,20 @@
#define uint16 uint16tiff
#define int32 int32tiff
#define uint32 uint32tiff
-+#define uint16 uint16_t
-+#define uint32 uint32_t
++#define int64 int64tiff
++#define uint64 uint64tiff
#include <tiffio.h>
++#undef int16
++#undef uint16
++#undef int32
++#undef uint32
++#undef int64
++#undef uint64
++#define uint16 uint16_t
++#define uint32 uint32_t
++
+ extern value *imglib_error;
+
+ value open_tiff_file_for_read( name )
diff --git a/graphics/camlimages/patches/patch-src_tiffwrite.c b/graphics/camlimages/patches/patch-src_tiffwrite.c
new file mode 100644
index 00000000000..896e3075395
--- /dev/null
+++ b/graphics/camlimages/patches/patch-src_tiffwrite.c
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_tiffwrite.c,v 1.1 2012/07/29 12:52:55 marino Exp $
+
+Both ocaml/caml/config.h and tiff.h define int32, uint32, etc.
+The workaround of this name polution is to intentionally overwrite the
+first caml definition with a garbage macro before tiff.h is included and
+then unset it after the include. After tiff version 4.0.1, the same hack
+has to be applied to 64-bit types
+
+--- src/tiffwrite.c.orig 2011-06-22 18:04:32.000000000 +0000
++++ src/tiffwrite.c
+@@ -25,6 +25,8 @@
+ #define uint16 uint16tiff
+ #define int32 int32tiff
+ #define uint32 uint32tiff
++#define int64 int64tiff
++#define uint64 uint64tiff
+
+ #include <tiffio.h>
+
+@@ -32,6 +34,8 @@
+ #undef uint16
+ #undef int32
+ #undef uint32
++#undef int64
++#undef uint64
+
+ extern value *imglib_error;
+