From b496b096ceaf7551747107fc8ab25183fb75f4e77e31889cb707654859d4fa2f Mon Sep 17 00:00:00 2001
From: OBS User unknown <null@suse.de>
Date: Fri, 12 Jun 2009 16:14:50 +0000
Subject: [PATCH] OBS-URL:
 https://build.opensuse.org/package/show/openSUSE:Factory/gegl?expand=0&rev=6

---
 gegl-babl_api_change.patch | 352 +++++++++++++++++++++++++++++++++++++
 gegl.changes               |   8 +
 gegl.spec                  |  19 +-
 3 files changed, 371 insertions(+), 8 deletions(-)
 create mode 100644 gegl-babl_api_change.patch

diff --git a/gegl-babl_api_change.patch b/gegl-babl_api_change.patch
new file mode 100644
index 0000000..110cd30
--- /dev/null
+++ b/gegl-babl_api_change.patch
@@ -0,0 +1,352 @@
+--- gegl/buffer/gegl-buffer-access.c
++++ gegl/buffer/gegl-buffer-access.c
+@@ -46,16 +46,6 @@
+ GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
+ #endif
+ 
+-#ifdef BABL
+-#undef BABL
+-#endif
+-
+-#define BABL(o)     ((Babl *) (o))
+-
+-#ifdef FMTPXS
+-#undef FMTPXS
+-#endif
+-#define FMTPXS(fmt)    (BABL (fmt)->format.bytes_per_pixel)
+ 
+ #if 0
+ static inline void
+@@ -68,7 +58,7 @@ pset (GeglBuffer *buffer,
+   gint  tile_width  = buffer->tile_storage->tile_width;
+   gint  tile_height  = buffer->tile_storage->tile_width;
+   gint  px_size     = gegl_buffer_px_size (buffer);
+-  gint  bpx_size    = FMTPXS (format);
++  gint  bpx_size    = babl_format_get_bytes_per_pixel (format);
+   Babl *fish        = NULL;
+ 
+   gint  abyss_x_total  = buffer->abyss.x + buffer->abyss.width;
+@@ -134,7 +124,7 @@ pset (GeglBuffer *buffer,
+   guchar *buf         = data;
+   gint    tile_width  = buffer->tile_storage->tile_width;
+   gint    tile_height = buffer->tile_storage->tile_height;
+-  gint    bpx_size    = FMTPXS (format);
++  gint    bpx_size    = babl_format_get_bytes_per_pixel (format);
+   Babl   *fish        = NULL;
+ 
+   gint  buffer_shift_x = buffer->shift_x;
+@@ -143,7 +133,7 @@ pset (GeglBuffer *buffer,
+   gint  buffer_abyss_y = buffer->abyss.y + buffer_shift_y;
+   gint  abyss_x_total  = buffer_abyss_x + buffer->abyss.width;
+   gint  abyss_y_total  = buffer_abyss_y + buffer->abyss.height;
+-  gint  px_size        = FMTPXS (buffer->format);
++  gint  px_size        = babl_format_get_bytes_per_pixel (buffer->format);
+ 
+   if (format != buffer->format)
+     {
+@@ -218,7 +208,7 @@ pget (GeglBuffer *buffer,
+   guchar *buf         = data;
+   gint    tile_width  = buffer->tile_storage->tile_width;
+   gint    tile_height = buffer->tile_storage->tile_height;
+-  gint    bpx_size    = FMTPXS (format);
++  gint    bpx_size    = babl_format_get_bytes_per_pixel (format);
+   Babl   *fish        = NULL;
+ 
+   gint  buffer_shift_x = buffer->shift_x;
+@@ -227,7 +217,7 @@ pget (GeglBuffer *buffer,
+   gint  buffer_abyss_y = buffer->abyss.y + buffer_shift_y;
+   gint  abyss_x_total  = buffer_abyss_x + buffer->abyss.width;
+   gint  abyss_y_total  = buffer_abyss_y + buffer->abyss.height;
+-  gint  px_size        = FMTPXS (buffer->format);
++  gint  px_size        = babl_format_get_bytes_per_pixel (buffer->format);
+ 
+   if (format != buffer->format)
+     {
+@@ -330,8 +320,8 @@ gegl_buffer_iterate (GeglBuffer          *buffer,
+ 
+   gint  tile_width  = buffer->tile_storage->tile_width;
+   gint  tile_height = buffer->tile_storage->tile_height;
+-  gint  px_size     = FMTPXS (buffer->format);
+-  gint  bpx_size    = FMTPXS (format);
++  gint  px_size     = babl_format_get_bytes_per_pixel (buffer->format);
++  gint  bpx_size    = babl_format_get_bytes_per_pixel (format);
+   gint  tile_stride = px_size * tile_width;
+   gint  buf_stride;
+   gint  bufy = 0;
+@@ -994,7 +984,7 @@ gegl_buffer_get (GeglBuffer          *buffer,
+       gint          level       = 0;
+       gint          buf_width   = rect->width / scale;
+       gint          buf_height  = rect->height / scale;
+-      gint          bpp         = BABL (format)->format.bytes_per_pixel;
++      gint          bpp         = babl_format_get_bytes_per_pixel (format);
+       GeglRectangle sample_rect = { floor(rect->x/scale),
+                                     floor(rect->y/scale),
+                                     buf_width,
+@@ -1030,7 +1020,7 @@ gegl_buffer_get (GeglBuffer          *buffer,
+    * no time to make a fast implementation
+    */
+ 
+-      if (BABL (format)->format.type[0] == (BablType *) babl_type ("u8")
++      if (babl_format_get_type (format, 0) == babl_type ("u8")
+           && !(level == 0 && scale > 1.99))
+         { /* do box-filter resampling if we're 8bit (which projections are) */
+ 
+@@ -1201,7 +1191,7 @@ gegl_buffer_clear (GeglBuffer          *dst,
+       dst_rect->height == 0)
+     return;
+ 
+-  pxsize = dst->format->format.bytes_per_pixel;
++  pxsize = babl_format_get_bytes_per_pixel (dst->format);
+ 
+   /* FIXME: this can be even further optimized by special casing it so
+    * that fully voided tiles are dropped.
+--- gegl/buffer/gegl-buffer-iterator.c
++++ gegl/buffer/gegl-buffer-iterator.c
+@@ -191,7 +191,7 @@ gulp:
+          i->data = gegl_tile_get_data (i->tile);
+ 
+          {
+-         gint bpp = i->buffer->format->format.bytes_per_pixel;
++         gint bpp = babl_format_get_bytes_per_pixel (i->buffer->format);
+          i->rowstride = bpp * tile_width;
+          i->sub_data = (guchar*)(i->data) + bpp * (i->subrect.y * tile_width + i->subrect.x);
+          }
+@@ -356,7 +356,7 @@ static void ensure_buf (GeglBufferIterators *i, gint no)
+    * would probably improve performance
+    */
+   if (i->buf[no]==NULL)
+-    i->buf[no] = iterator_buf_pool_get (i->format[no]->format.bytes_per_pixel *
++    i->buf[no] = iterator_buf_pool_get (babl_format_get_bytes_per_pixel (i->format[no]) *
+                                         i->i[0].max_size);
+ }
+ 
+--- gegl/buffer/gegl-buffer-linear.c
++++ gegl/buffer/gegl-buffer-linear.c
+@@ -77,7 +77,7 @@ gegl_buffer_linear_new_from_data (const gpointer       data,
+                        */
+     rowstride = extent->width;
+   else
+-    rowstride = rowstride / format->format.bytes_per_pixel;
++    rowstride = rowstride / babl_format_get_bytes_per_pixel (format);
+     buffer = gegl_buffer_linear_new2 (extent, format, rowstride);
+ 
+   {
+@@ -90,7 +90,7 @@ gegl_buffer_linear_new_from_data (const gpointer       data,
+     tile->y = 0;
+     tile->z = 0;
+     tile->data       = (gpointer)data;
+-    tile->size       = format->format.bytes_per_pixel * rowstride * extent->height;
++    tile->size       = babl_format_get_bytes_per_pixel (format) * rowstride * extent->height;
+     tile->next_shared = tile;
+     tile->prev_shared = tile;
+ 
+@@ -155,7 +155,7 @@ gegl_buffer_linear_open (GeglBuffer          *buffer,
+ 
+       g_object_set_data (G_OBJECT (buffer), "linear-tile", tile);
+ 
+-      if(rowstride)*rowstride = buffer->tile_storage->tile_width * format->format.bytes_per_pixel;
++      if(rowstride)*rowstride = buffer->tile_storage->tile_width * babl_format_get_bytes_per_pixel (format);
+       return (gpointer)gegl_tile_get_data (tile);
+     }
+   /* first check if there is a linear buffer, share the existing buffer if one
+@@ -194,7 +194,7 @@ gegl_buffer_linear_open (GeglBuffer          *buffer,
+     info->extent = buffer->extent;
+     info->format = format;
+ 
+-    rs = info->extent.width * format->format.bytes_per_pixel;
++    rs = info->extent.width * babl_format_get_bytes_per_pixel (format);
+     if(rowstride)*rowstride = rs;
+ 
+     info->buf = gegl_malloc (rs * info->extent.height);
+--- gegl/buffer/gegl-buffer-load.c
++++ gegl/buffer/gegl-buffer-load.c
+@@ -372,7 +372,7 @@ gegl_buffer_load (const gchar *path)
+ 
+   /* sanity check, should probably report error condition and return safely instead
+   */
+-  g_assert (info->format->format.bytes_per_pixel == info->header.bytes_per_pixel);
++  g_assert (babl_format_get_bytes_per_pixel (info->format) == info->header.bytes_per_pixel);
+ 
+   info->tiles = gegl_buffer_read_index (info->i, &info->offset);
+ 
+--- gegl/buffer/gegl-buffer-save.c
++++ gegl/buffer/gegl-buffer-save.c
+@@ -204,7 +204,7 @@ gegl_buffer_header_init (GeglBufferHeader *header,
+   {
+     gchar buf[64];
+     g_snprintf (buf, 64, "%s%c\n%i×%i %ibpp\n%ix%i\n\n\n\n\n\n\n\n\n", 
+-          format->instance.name, 0,
++          babl_get_name (format), 0,
+           header->tile_width,
+           header->tile_height,
+           header->bytes_per_pixel,
+--- gegl/buffer/gegl-sampler.c
++++ gegl/buffer/gegl-sampler.c
+@@ -215,7 +215,7 @@ gegl_sampler_get_ptr (GeglSampler *sampler,
+    gint    bpp;
+    gint    sof;
+ 
+-   bpp = sampler->interpolate_format->format.bytes_per_pixel;
++   bpp = babl_format_get_bytes_per_pixel (sampler->interpolate_format);
+ 
+    if (sampler->sampler_buffer == NULL
+        ||
+@@ -284,7 +284,7 @@ gegl_sampler_get_from_buffer (GeglSampler *sampler,
+    gint    bpp;
+    gint    sof;
+ 
+-   bpp = sampler->interpolate_format->format.bytes_per_pixel;
++   bpp = babl_format_get_bytes_per_pixel (sampler->interpolate_format);
+ 
+    if (sampler->sampler_buffer == NULL
+        ||
+--- gegl/buffer/gegl-tile-backend-file.c
++++ gegl/buffer/gegl-tile-backend-file.c
+@@ -917,7 +917,7 @@ gegl_tile_backend_file_constructor (GType                  type,
+       backend->tile_width = self->header.tile_width;
+       backend->tile_height = self->header.tile_height;
+       backend->format = babl_format (self->header.description);
+-      backend->px_size = backend->format->format.bytes_per_pixel;
++      backend->px_size = babl_format_get_bytes_per_pixel (backend->format);
+       backend->tile_size = backend->tile_width * backend->tile_height * backend->px_size;
+ 
+       /* insert each of the entries into the hash table */
+--- gegl/buffer/gegl-tile-backend.c
++++ gegl/buffer/gegl-tile-backend.c
+@@ -114,7 +114,7 @@ constructor (GType                  type,
+   g_assert (backend->tile_width > 0 && backend->tile_height > 0);
+   g_assert (backend->format);
+ 
+-  backend->px_size = backend->format->format.bytes_per_pixel;
++  backend->px_size = babl_format_get_bytes_per_pixel (backend->format);
+   backend->tile_size = backend->tile_width * backend->tile_height * backend->px_size;
+ 
+   return object;
+--- gegl/buffer/gegl-tile-handler-zoom.c
++++ gegl/buffer/gegl-tile-handler-zoom.c
+@@ -50,7 +50,7 @@ static inline void set_blank (GeglTile *dst_tile,
+                               gint      j)
+ {
+   guchar *dst_data  = gegl_tile_get_data (dst_tile);
+-  gint    bpp       = format->format.bytes_per_pixel;
++  gint    bpp       = babl_format_get_bytes_per_pixel (format);
+   gint    rowstride = width * bpp;
+   gint    scanline;
+ 
+@@ -76,7 +76,7 @@ static inline void set_half_nearest (GeglTile *dst_tile,
+ {
+   guchar *dst_data = gegl_tile_get_data (dst_tile);
+   guchar *src_data = gegl_tile_get_data (src_tile);
+-  gint    bpp      = format->format.bytes_per_pixel;
++  gint    bpp      = babl_format_get_bytes_per_pixel (format);
+   gint    x, y;
+ 
+   for (y = 0; y < height / 2; y++)
+@@ -177,17 +177,17 @@ static void inline set_half (GeglTile * dst_tile,
+ {
+   guchar *dst_data   = gegl_tile_get_data (dst_tile);
+   guchar *src_data   = gegl_tile_get_data (src_tile);
+-  gint    components = format->format.components;
+-  gint    bpp        = format->format.bytes_per_pixel;
++  gint    components = babl_format_get_n_components (format);
++  gint    bpp        = babl_format_get_bytes_per_pixel (format);
+ 
+   if (i) dst_data += bpp * width / 2;
+   if (j) dst_data += bpp * width * height / 2;
+ 
+-  if (format->format.type[0] == (BablType *) babl_type ("float"))
++  if (babl_format_get_type (format, 0) == babl_type ("float"))
+     {
+       downscale_float (components, width, height, width * bpp, src_data, dst_data);
+     }
+-  else if (format->format.type[0] == (BablType *) babl_type ("u8"))
++  else if (babl_format_get_type (format, 0) == babl_type ("u8"))
+     {
+       downscale_u8 (components, width, height, width * bpp, src_data, dst_data);
+     }
+--- operations/core/convert-format.c
++++ operations/core/convert-format.c
+@@ -56,7 +56,7 @@ process (GeglOperation       *op,
+          glong                samples,
+          const GeglRectangle *roi)
+ {
+-	int bpp = gegl_operation_get_format(op, "output")->format.bytes_per_pixel;
++	int bpp = babl_format_get_bytes_per_pixel (gegl_operation_get_format (op, "output"));
+ 	memcpy(out_buf, in_buf, samples * bpp);
+   return TRUE;
+ }
+--- operations/external/png-save.c
++++ operations/external/png-save.c
+@@ -89,14 +89,11 @@ gegl_buffer_export_png (GeglBuffer  *gegl_buffer,
+ 
+   {
+     const Babl *babl; /*= gegl_buffer->format;*/
+-    BablType   **type;
+ 
+     g_object_get (gegl_buffer, "format", &babl, NULL);
+-    type = babl->format.type;
+ 
+-    for (i=0; i<babl->format.components; i++)
+-      if ((*type)->bits > 8)
+-        bit_depth = 16;
++    if (babl_format_get_type (babl, 0) != babl_type ("u8"))
++      bit_depth = 16;
+ 
+     if (bd == 16)
+       bit_depth = 16;
+--- operations/external/save-pixbuf.c
++++ operations/external/save-pixbuf.c
+@@ -17,6 +17,9 @@
+  */
+ 
+ #include "config.h"
++
++#include <babl/babl.h>
++
+ #include <glib/gi18n-lib.h>
+ 
+ 
+@@ -44,21 +47,16 @@ process (GeglOperation       *operation,
+     {
+       GdkPixbuf       **pixbuf = o->pixbuf;
+       const Babl       *babl;
+-      const BablFormat *format;
++      const Babl       *format;
+       guchar           *temp;
+       GeglRectangle *rect = gegl_operation_source_get_bounding_box (operation, "input");
+       gchar *name;
+       gboolean has_alpha;
+       gint bps;
+-      guint i;
+ 
+-      g_object_get (input, "format", &babl, NULL);
+-      format = (BablFormat*) babl;
++      g_object_get (input, "format", &format, NULL);
+ 
+-      has_alpha = FALSE;
+-      for (i = 0; i < format->components; i++) {
+-    has_alpha = has_alpha || format->component[i]->alpha != 0;
+-      }
++      has_alpha = babl_format_has_alpha (format);
+ 
+       /* pixbuf from data only support 8bit bps */
+       bps = 8;
+--- bin/export.c	2008-06-14 12:40:05.000000000 -0400
++++ bin/export.c.new	2009-06-04 15:39:42.898669573 -0400
+@@ -308,12 +308,11 @@
+   strcpy (format_string, "R'G'B'A ");
+ 
+   {
+-    const Babl  *babl   = gegl_buffer->format;
+-    BablType   **type   = babl->format.type;
++    const Babl  *babl; /*   = gegl_buffer->format;*/
+ 
+-    for (i=0; i<babl->format.components; i++)
+-      if ((*type)->bits > 8)
+-        bit_depth = 16;
++    g_object_get (gegl_buffer, "format", &babl, NULL);
++    if (babl_format_get_type (babl, 0) != babl_type ("u8"))
++      bit_depth = 16;
+   }
+ 
+   if (bit_depth == 16)
diff --git a/gegl.changes b/gegl.changes
index dc9163a..a87810c 100644
--- a/gegl.changes
+++ b/gegl.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Thu Jun 11 04:04:07 CEST 2009 - vuntz@novell.com
+
+- Add gegl-babl_api_change.patch to make gegl build with babl
+  0.1.0. Patch taken from Fedora.
+- Remove autoreconf call.
+- Do not make gegl0_0 explicitly Requires libbabl-0_0-0.
+
 -------------------------------------------------------------------
 Wed Dec 31 16:29:21 EST 2008 - hfiguiere@suse.de
 
diff --git a/gegl.spec b/gegl.spec
index d003a89..4c29fde 100644
--- a/gegl.spec
+++ b/gegl.spec
@@ -24,8 +24,6 @@ Name:           gegl
 # Use rpmbuild -D 'BUILD_ORIG 1' -D 'BUILD_ORIG_ADDON 1' to build patched build plus original as addon.
 BuildRequires:  ImageMagick OpenEXR-devel SDL-devel asciidoc babl-devel enscript gcc-c++ graphviz gtk2-devel libjpeg-devel libpng-devel librsvg-devel libstdc++-devel lua-devel ruby
 BuildRequires:  glib2-devel >= 2.16.1
-# To build documentation, babl-0_0 is a must, "Recommends" is not enough:
-BuildRequires:  babl-0_0
 BuildRequires:  libopenraw-devel >= 0.0.5
 # Only for directory ownership:
 BuildRequires:  gtk-doc
@@ -42,11 +40,13 @@ Provides:       patched_subset
 %endif
 Url:            http://gegl.org/
 Version:        0.0.22
-Release:        1
+Release:        2
 License:        GPL v3 or later; LGPL v3 or later
 Group:          System/Libraries
 Summary:        Generic Graphics Library
 Source:         ftp://ftp.gimp.org/pub/gegl/v0.0/%{name}-%{version}.tar.bz2
+# PATCH-FIX-UPSTREAM gegl-babl_api_change.patch vuntz@novell.com -- Taken from Fedora
+Patch0:         gegl-babl_api_change.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %define debug_package_requires libgegl-0_0-0 = %{version}-%{release}
 
@@ -98,7 +98,6 @@ Authors:
 License:        GPL v3 or later; LGPL v3 or later
 Summary:        Generic Graphics Library
 Group:          System/Libraries
-Requires:       libbabl-0_0-0 >= %{version}
 
 %description 0_0
 GEGL provides infratructure to do demand based cached non destructive
@@ -352,9 +351,9 @@ Authors:
 
 %prep
 %setup -q
+%patch0 -p0
 
 %build
-autoreconf -f -i
 %configure\
 	--enable-workshop=yes\
 	--disable-static
@@ -369,8 +368,7 @@ for MODULE in \
     rm -f $RPM_BUILD_ROOT$MODULE
 done
 %endif
-rm $RPM_BUILD_ROOT%{_libdir}/gegl-0.0/*.la
-rm $RPM_BUILD_ROOT%{_libdir}/*.la
+find %{buildroot} -type f -name "*.la" -delete -print
 chmod -x $RPM_BUILD_ROOT%{_datadir}/gtk-doc/html/gegl/*.*
 
 %post -n libgegl-0_0-0 -p /sbin/ldconfig
@@ -414,6 +412,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/gtk-doc/html/gegl
 
 %changelog
+* Thu Jun 11 2009 vuntz@novell.com
+- Add gegl-babl_api_change.patch to make gegl build with babl
+  0.1.0. Patch taken from Fedora.
+- Remove autoreconf call.
+- Do not make gegl0_0 explicitly Requires libbabl-0_0-0.
 * Wed Dec 31 2008 hfiguiere@suse.de
 - Update to 0.0.22
   * GeglOperation
@@ -430,7 +433,7 @@ rm -rf $RPM_BUILD_ROOT
      - made gegl_node_add_child and gegl_node_remove_child public API. (bgo#507298)
   * GeglPath: Vector path representation infrastructure,
 - Remove gegl-64bit-warning.diff
-* Sun Oct 05 2008 hfiguiere@suse.de
+* Mon Oct 06 2008 hfiguiere@suse.de
 - Update to 0.0.20
   * libopenraw support
   * Linear buffer support, amongst other things enabling GeglBuffer API access