cairo fixes step 1

View: New views
2 Messages — Rating Filter:   Alert me  

cairo fixes step 1

by bob majdak jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this patch is step 1 in fixing the current php-gtk cvs on unix, as
right now it will not compile. (however with the patch, it does)

it addresses renaming in the updated cairo extension, and also a
"stray # in program" error caused by lack of a new line.

you will need cairo from the svn. if the cairo svn is still at
revision 20 you will probably need to patch cairo first
(recompile/reinstall). that patch is also attached.

it compiles with this command:

     ./cvsclean && ./buildconf && CFLAGS=-DHAVE_CAIRO ./configure && make

notice the manual cflags, step two will be fixing the autotools
scripting to do that automatically.

with no objections i will commit this
php-gtk-cairofix-20080106bob1.diff (text/x-patch) 6K

[php-gtk-cairofix-20080106bob1.diff]

diff -ur php-gtk/ext/gtk+/gdk-2.10.overrides php-gtk-bob2/ext/gtk+/gdk-2.10.overrides
--- php-gtk/ext/gtk+/gdk-2.10.overrides 2008-07-30 21:52:19.000000000 -0400
+++ php-gtk-bob2/ext/gtk+/gdk-2.10.overrides 2009-01-06 11:51:56.000000000 -0500
@@ -4,7 +4,7 @@
 add-arginfo GdkScreen set_font_options
 static
 ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME,0,0,1)
- ZEND_ARG_OBJ_INFO(0,obj, CairoFontOptions, 1)
+ ZEND_ARG_OBJ_INFO(0,obj, Cairocairo_fontoptions, 1)
 ZEND_END_ARG_INFO();
 
 %%
@@ -12,12 +12,12 @@
 PHP_METHOD
 {
  zval *obj=NULL;
- fontoptions_object *fobj;
+ cairo_fontoptions_object *fobj;
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"O", &obj)) {
         return;
  }
 
- fobj = (fontoptions_object *)zend_object_store_get_object(obj TSRMLS_CC);
+ fobj = (cairo_fontoptions_object *)zend_object_store_get_object(obj TSRMLS_CC);
 
  gdk_screen_set_font_options(GDK_SCREEN(PHPG_GOBJECT(this_ptr)), fobj->fontoptions);
 }
@@ -28,17 +28,17 @@
 {
  const cairo_font_options_t *fo;
  zend_class_entry *ce;
- fontoptions_object *fobj;
+ cairo_fontoptions_object *fobj;
  if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"")) {
             return;
  }
  fo = gdk_screen_get_font_options(GDK_SCREEN(PHPG_GOBJECT(this_ptr)));
- ce = get_CairoFontOptions_ce_ptr();
+ ce = get_Cairocairo_fontoptions_ce_ptr();
 
  object_init_ex(return_value, ce);
-    fobj = (fontoptions_object *)zend_object_store_get_object(return_value TSRMLS_CC);
+    fobj = (cairo_fontoptions_object *)zend_object_store_get_object(return_value TSRMLS_CC);
     /* I don't want to have to link to cairo.dll as well, this should be fixed!
- fobj->fontoptions = cairo_font_options_copy(fo);*/
+ fobj->cairo_fontoptions = cairo_font_options_copy(fo);*/
 }
 
 %%
@@ -60,12 +60,12 @@
     GdkPixmap *pixmap;
  gdouble pixmap_x = 0;
  gdouble pixmap_y = 0;
- context_object *cont;
+ cairo_context_object *cont;
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"OOdd", &cobj, &pmap, &pixmap_x, &pixmap_y)) {
         return;
     }
-    cont = (context_object *)zend_objects_get_address(cobj TSRMLS_CC);
+    cont = (cairo_context_object *)zend_objects_get_address(cobj TSRMLS_CC);
     pixmap = GDK_PIXMAP(PHPG_GOBJECT(pmap));
  gdk_cairo_set_source_pixmap(cont->context, pixmap, pixmap_x, pixmap_y);
 }
-
+
diff -ur php-gtk/ext/gtk+/gdk-2.8.overrides php-gtk-bob2/ext/gtk+/gdk-2.8.overrides
--- php-gtk/ext/gtk+/gdk-2.8.overrides 2008-07-30 21:52:19.000000000 -0400
+++ php-gtk-bob2/ext/gtk+/gdk-2.8.overrides 2009-01-06 11:51:53.000000000 -0500
@@ -8,7 +8,7 @@
     zval *cobj = NULL;
     zval *rect = NULL;
     GdkDrawable *drawable;
-    context_object *cont;
+    cairo_context_object *cont;
  zend_class_entry *ce;
 
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"")) {
@@ -16,7 +16,7 @@
    }
  ce = get_CairoContext_ce_ptr();
  object_init_ex(return_value,ce);
-    cont = (context_object *)zend_objects_get_address(return_value TSRMLS_CC);
+    cont = (cairo_context_object *)zend_objects_get_address(return_value TSRMLS_CC);
     drawable = GDK_DRAWABLE(PHPG_GOBJECT(this_ptr));
  cont->context = gdk_cairo_create(drawable);
 }
@@ -37,11 +37,11 @@
  zval *cobj = NULL;
  zval *color = NULL;
     GdkColor *col;
-    context_object *cont;
+    cairo_context_object *cont;
  if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"OO", &cobj, &color)) {
  return;
  }
- cont = (context_object *)zend_objects_get_address(cobj TSRMLS_CC);
+ cont = (cairo_context_object *)zend_objects_get_address(cobj TSRMLS_CC);
  col = GDK_COLOR(PHPG_GOBJECT(color));
  gdk_cairo_set_source_color(cont->context, col); */
 }
@@ -65,11 +65,11 @@
  gdouble pixbuf_x = 0;
  gdouble pixbuf_y = 0;
     GdkPixbuf *pixbuf;
-    context_object *cont;
+    cairo_context_object *cont;
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"OOdd", &cobj, &pbuf, &pixbuf_x, &pixbuf_y)) {
         return;
     }
-    cont = (context_object *)zend_objects_get_address(cobj TSRMLS_CC);
+    cont = (cairo_context_object *)zend_objects_get_address(cobj TSRMLS_CC);
     pixbuf = GDK_PIXBUF(PHPG_GOBJECT(pbuf));
  gdk_cairo_set_source_pixbuf(cont->context, pixbuf, pixbuf_x, pixbuf_y);
 }
@@ -90,11 +90,11 @@
     zval *cobj = NULL;
     zval *reg = NULL;
     GdkRegion *region;
-    context_object *cont;
+    cairo_context_object *cont;
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"OO", &cobj, ®)) {
         return;
     }
-    cont = (context_object *)zend_objects_get_address(cobj TSRMLS_CC);
+    cont = (cairo_context_object *)zend_objects_get_address(cobj TSRMLS_CC);
     region = GDK_REGION(PHPG_GOBJECT(reg));
  gdk_cairo_region(cont->context, region); */
 }
@@ -115,11 +115,12 @@
     zval *cobj = NULL;
     zval *rect = NULL;
     GdkRectangle *rectangle;
-    context_object *cont;
+    cairo_context_object *cont;
     if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"OO", &cobj, &rect)) {
         return;
     }
-    cont = (context_object *)zend_objects_get_address(cobj TSRMLS_CC);
+    cont = (cairo_context_object *)zend_objects_get_address(cobj TSRMLS_CC);
     rectangle = GDK_RECTANGLE(PHPG_GOBJECT(rect));
  gdk_cairo_rectangle(cont->context, rectangle); */
-}
\ No newline at end of file
+}
+


[php-cairo-installheaders-20091006bob1.diff]

diff -ur php-cairo/config.m4 php-cairo-bob/config.m4
--- php-cairo/config.m4 2009-01-06 11:25:46.000000000 -0500
+++ php-cairo-bob/config.m4 2009-01-06 11:27:40.000000000 -0500
@@ -11,7 +11,11 @@
   AC_DEFINE(HAVE_CAIRO, 1, [ ])
 
   PHP_NEW_EXTENSION(cairo, cairo.c cairo_error.c cairo_context.c cairo_pattern.c cairo_matrix.c cairo_font.c cairo_surface.c cairo_image_surface.c cairo_svg_surface.c, $ext_shared)
-
+
+  EXT_CAIRO_HEADERS="php_cairo_api.h php_cairo.h php_cairo_internal.h"
+  ifdef([PHP_INSTALL_HEADERS], [
+    PHP_INSTALL_HEADERS(ext/cairo, $EXT_CAIRO_HEADERS)
+  ])
 
   AC_MSG_CHECKING(for pkg-config)
 


--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: cairo fixes step 1

by Elizabeth M Smith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Majdak Jr wrote:

> this patch is step 1 in fixing the current php-gtk cvs on unix, as
> right now it will not compile. (however with the patch, it does)
>
> it addresses renaming in the updated cairo extension, and also a
> "stray # in program" error caused by lack of a new line.
>
> you will need cairo from the svn. if the cairo svn is still at
> revision 20 you will probably need to patch cairo first
> (recompile/reinstall). that patch is also attached.
>
> it compiles with this command:
>
>      ./cvsclean && ./buildconf && CFLAGS=-DHAVE_CAIRO ./configure && make
>
> notice the manual cflags, step two will be fixing the autotools
> scripting to do that automatically.
>
> with no objections i will commit this
> php-gtk-cairofix-20080106bob1.diff (text/x-patch) 6K
>

Looks good to me bob - I'll put the fix for cairo into the svn - hoping
in the next week or so to get it stable enough to sync to cvs and
release it in PECL, then we can think about rolling a new php-gtk

Thanks,
Elizabeth

--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php