cairo and pycairo 0.6.0cvs win32 builds

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

cairo and pycairo 0.6.0cvs win32 builds

by Vittorio Palmisano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
you can find a win32 build for libpixman, glitz, cairo and pycairo (for
python2.3) here:

http://anakonda.altervista.org/archivio/

I have built them with mingw32, on attachment there is the patch required for
pycairo, the command used is:
 > python setup.py build -cmingw32
 > python setup.py bdist_wininst

for pycairo ./configure doesn't work, you have to add manually a __init__.py file
before make bdist_wininst.



--
/Vittorio Palmisano/
Home Page: http://redclay.altervista.org

Index: setup.py
===================================================================
RCS file: /cvs/cairo/pycairo/setup.py,v
retrieving revision 1.3
diff -u -p -r1.3 setup.py
--- setup.py 1 Aug 2005 15:54:21 -0000 1.3
+++ setup.py 6 Aug 2005 16:56:01 -0000
@@ -21,15 +21,25 @@ def get_libs(pkg):
 #~ print get_lib_dirs('cairo')
 #~ print get_libs('cairo')
 
+include_dirs = get_include('cairo')
+library_dirs = get_lib_dirs('cairo')
+libraries = get_libs('cairo')
+
+import sys
+if sys.platform == 'win32':
+    include_dirs += get_include('freetype2')
+    library_dirs += get_lib_dirs('freetype2')
+    libraries += get_libs('freetype2') + ['gdi32','msimg32']
+
 _cairo = Extension(name = 'cairo._cairo',
             sources= ['cairo/cairomodule.c',
             'cairo/pycairo-context.c', 'cairo/pycairo-font.c',
             'cairo/pycairo-matrix.c', 'cairo/pycairo-path.c',
             'cairo/pycairo-pattern.c', 'cairo/pycairo-surface.c',
             ],
-            include_dirs = get_include('cairo'),
-            library_dirs = get_lib_dirs('cairo'),
-            libraries = get_libs('cairo'),
+            include_dirs=include_dirs,
+            library_dirs=library_dirs,
+            libraries=libraries,
         )
 
 setup( name = "pycairo",
Index: cairo/cairosvgmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairosvgmodule.c,v
retrieving revision 1.9
diff -u -p -r1.9 cairosvgmodule.c
--- cairo/cairosvgmodule.c 20 Jun 2005 07:17:11 -0000 1.9
+++ cairo/cairosvgmodule.c 6 Aug 2005 16:56:02 -0000
@@ -205,7 +205,11 @@ static PyMethodDef pycairosvg_methods[]
 
 
 PyTypeObject PycairoSVGContext_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /*ob_size*/
     "cairo.svg.Context",                /*tp_name*/
     sizeof(PycairoSVGContext),          /*tp_basicsize*/
Index: cairo/pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.60
diff -u -p -r1.60 pycairo-context.c
--- cairo/pycairo-context.c 1 Aug 2005 15:24:38 -0000 1.60
+++ cairo/pycairo-context.c 6 Aug 2005 16:56:03 -0000
@@ -1172,8 +1172,12 @@ static PyMethodDef pycairo_methods[] = {
 
 
 PyTypeObject PycairoContext_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
-    0,                                  /* ob_size */
+#endif
+ 0,                                  /* ob_size */
     "cairo.Context",                    /* tp_name */
     sizeof(PycairoContext),             /* tp_basicsize */
     0,                                  /* tp_itemsize */
@@ -1203,8 +1207,12 @@ PyTypeObject PycairoContext_Type = {
     pycairo_methods,                    /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
-    0,                                  /* tp_dict */
+#endif
+ 0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
Index: cairo/pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.26
diff -u -p -r1.26 pycairo-font.c
--- cairo/pycairo-font.c 1 Aug 2005 10:25:47 -0000 1.26
+++ cairo/pycairo-font.c 6 Aug 2005 16:56:03 -0000
@@ -101,7 +101,11 @@ static PyMethodDef font_face_methods[] =
 */
 
 PyTypeObject PycairoFontFace_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.FontFace",                   /* tp_name */
     sizeof(PycairoFontFace),            /* tp_basicsize */
@@ -132,7 +136,11 @@ PyTypeObject PycairoFontFace_Type = {
     0,                                  /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
+#endif
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
@@ -243,7 +251,11 @@ static PyMethodDef scaled_font_methods[]
 
 
 PyTypeObject PycairoScaledFont_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.ScaledFont",                 /* tp_name */
     sizeof(PycairoScaledFont),          /* tp_basicsize */
@@ -274,8 +286,12 @@ PyTypeObject PycairoScaledFont_Type = {
     scaled_font_methods,                /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
-    0,                                  /* tp_dict */
+#endif
+ 0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
@@ -369,7 +385,11 @@ static PyMethodDef font_options_methods[
 
 
 PyTypeObject PycairoFontOptions_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.FontOptions",                /* tp_name */
     sizeof(PycairoFontOptions),         /* tp_basicsize */
@@ -400,7 +420,11 @@ PyTypeObject PycairoFontOptions_Type = {
     font_options_methods,               /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
+#endif
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
Index: cairo/pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.21
diff -u -p -r1.21 pycairo-matrix.c
--- cairo/pycairo-matrix.c 20 May 2005 08:57:44 -0000 1.21
+++ cairo/pycairo-matrix.c 6 Aug 2005 16:56:04 -0000
@@ -313,7 +313,11 @@ static PyGetSetDef matrix_getsets[] = {
 };
 
 PyTypeObject PycairoMatrix_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.Matrix",                     /* tp_name */
     sizeof(PycairoMatrix),              /* tp_basicsize */
@@ -344,7 +348,11 @@ PyTypeObject PycairoMatrix_Type = {
     matrix_methods,                     /* tp_methods */
     0,                                  /* tp_members */
     matrix_getsets,                     /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
+#endif
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
Index: cairo/pycairo-path.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-path.c,v
retrieving revision 1.6
diff -u -p -r1.6 pycairo-path.c
--- cairo/pycairo-path.c 14 Jun 2005 04:02:58 -0000 1.6
+++ cairo/pycairo-path.c 6 Aug 2005 16:56:04 -0000
@@ -181,8 +181,12 @@ static PyObject * path_iter(PyObject *se
 
 
 PyTypeObject PycairoPath_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
-    0,        /* ob_size */
+#endif
+ 0,        /* ob_size */
     "cairo.Path", /* tp_name */
     sizeof(PycairoPath), /* tp_basicsize */
     0, /* tp_itemsize */
@@ -304,7 +308,11 @@ pathiter_next(PycairoPathiter *it)
 }
 
 static PyTypeObject PycairoPathiter_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.Pathiter",                   /* tp_name */
     sizeof(PycairoPathiter),            /* tp_basicsize */
@@ -330,7 +338,11 @@ static PyTypeObject PycairoPathiter_Type
     0,                                  /* tp_clear */
     0,                                  /* tp_richcompare */
     0,                                  /* tp_weaklistoffset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_iter */
+#else /* ! WIN32 */
     PyObject_SelfIter, /* tp_iter */
+#endif
     (iternextfunc)pathiter_next, /* tp_iternext */
     0, /* tp_methods */
 };
Index: cairo/pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.25
diff -u -p -r1.25 pycairo-pattern.c
--- cairo/pycairo-pattern.c 14 Jun 2005 04:02:58 -0000 1.25
+++ cairo/pycairo-pattern.c 6 Aug 2005 16:56:05 -0000
@@ -247,8 +247,12 @@ static PyMethodDef pattern_methods[] = {
 };
 
 PyTypeObject PycairoPattern_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
-    0,                                  /* ob_size */
+#endif
+ 0,                                  /* ob_size */
     "cairo.Pattern",                    /* tp_name */
     sizeof(PycairoPattern),             /* tp_basicsize */
     0,                                  /* tp_itemsize */
@@ -278,7 +282,11 @@ PyTypeObject PycairoPattern_Type = {
     pattern_methods,                    /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
+#endif
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
Index: cairo/pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.51
diff -u -p -r1.51 pycairo-surface.c
--- cairo/pycairo-surface.c 1 Aug 2005 15:24:38 -0000 1.51
+++ cairo/pycairo-surface.c 6 Aug 2005 16:56:06 -0000
@@ -201,8 +201,12 @@ static PyMethodDef surface_methods[] = {
 
 
 PyTypeObject PycairoSurface_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
-    0,                                  /* ob_size */
+#endif
+ 0,                                  /* ob_size */
     "cairo.Surface",                    /* tp_name */
     sizeof(PycairoSurface),             /* tp_basicsize */
     0,                                  /* tp_itemsize */
@@ -232,7 +236,11 @@ PyTypeObject PycairoSurface_Type = {
     surface_methods,                    /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
+#if defined(WIN32) || defined(__CYGWIN__)
+    NULL,                 /* tp_base */
+#else /* ! WIN32 */
     &PyBaseObject_Type,                 /* tp_base */
+#endif
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
@@ -462,7 +470,11 @@ static PyMethodDef image_surface_methods
 
 
 PyTypeObject PycairoImageSurface_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.ImageSurface",               /* tp_name */
     sizeof(PycairoImageSurface),        /* tp_basicsize */
@@ -554,8 +566,12 @@ static PyMethodDef pdfsurface_methods[]
 };
 
 PyTypeObject PycairoPDFSurface_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
-    0,                                  /* ob_size */
+#endif
+ 0,                                  /* ob_size */
     "cairo.PDFSurface",                 /* tp_name */
     sizeof(PycairoPDFSurface),          /* tp_basicsize */
     0,                                  /* tp_itemsize */
@@ -647,7 +663,11 @@ static PyMethodDef pssurface_methods[] =
 };
 
 PyTypeObject PycairoPSSurface_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.PSSurface",                  /* tp_name */
     sizeof(PycairoPSSurface),           /* tp_basicsize */
@@ -725,7 +745,11 @@ static PyMethodDef win32surface_methods[
 };
 
 PyTypeObject PycairoWin32Surface_Type = {
+#if defined(WIN32) || defined(__CYGWIN__)
+    PyObject_HEAD_INIT(NULL)
+#else /* ! WIN32 */
     PyObject_HEAD_INIT(&PyType_Type)
+#endif
     0,                                  /* ob_size */
     "cairo.Win32Surface",               /* tp_name */
     sizeof(PycairoWin32Surface),        /* tp_basicsize */
Index: test/test.py
===================================================================
RCS file: /cvs/cairo/pycairo/test/test.py,v
retrieving revision 1.2
diff -u -p -r1.2 test.py
--- test/test.py 9 Apr 2005 02:58:43 -0000 1.2
+++ test/test.py 6 Aug 2005 16:56:06 -0000
@@ -15,6 +15,6 @@ def _test():
 
 
 if __name__ == "__main__":
-    if sys.version_info < (2,4):
-        raise SystemExit ("Python 2.4 or higher required")
+    if sys.version_info < (2,3):
+        raise SystemExit ("Python 2.3 or higher required")
     _test()

_______________________________________________
cairo mailing list
cairo@...
http://lists.freedesktop.org/mailman/listinfo/cairo

Parent Message unknown Re: cairo and pycairo 0.6.0cvs win32 builds

by Steven Chaplin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2005-08-08 at 12:27 -0700, Vittorio Palmisano wrote:
>         Hello,
>         you can find a win32 build for libpixman, glitz, cairo and
>         pycairo (for
>         python2.3) here:
>        
>         http://anakonda.altervista.org/archivio/
I had a look at this link, there's nothing there!

>         I have built them with mingw32, on attachment there is the
>         patch required for
>         pycairo, the command used is:
>          > python setup.py build -cmingw32
>          > python setup.py bdist_wininst
>        
>         for pycairo ./configure doesn't work, you have to add manually
>         a __init__.py file
>         before make bdist_wininst.

Why does setup.py need:
+import sys
        +if sys.platform == 'win32':
        +    include_dirs += get_include('freetype2')
        +    library_dirs += get_lib_dirs('freetype2')
        +    libraries += get_libs('freetype2') + ['gdi32','msimg32']
       
These cairo lines should pick up the freetype dependency
        +include_dirs = get_include('cairo')
        +library_dirs = get_lib_dirs('cairo')
        +libraries = get_libs('cairo')
       
If its a problem with the names 'freetype' and 'freetype2' not matching
then cairo or freetype should be patched.
       
       
I don't understand these lines:
         PyTypeObject PycairoContext_Type = {
        +#if defined(WIN32) || defined(__CYGWIN__)
        +    PyObject_HEAD_INIT(NULL)
        +#else /* ! WIN32 */
             PyObject_HEAD_INIT(&PyType_Type)
        -    0,                                  /* ob_size */
        +#endif

The line "PyObject_HEAD_INIT(&PyType_Type)" is used in
Python-2.4.1/Objects/listobject.c (and many other *.c files) so it looks
like a standard Python statement, why does it need to be changed?

gcc on Linux handles it OK. mingw uses gcc so I'd expect it to handle it
just the same.


pycairo/test/test.py has:
         if __name__ == "__main__":
        -    if sys.version_info < (2,4):
        -        raise SystemExit ("Python 2.4 or higher required")
       
because it uses doctest.DocFileSuite which is new in 2.4. Does it work
for you using Python 2.3?

Steve

Send instant messages to your online friends http://au.messenger.yahoo.com 
_______________________________________________
cairo mailing list
cairo@...
http://lists.freedesktop.org/mailman/listinfo/cairo

Re: cairo and pycairo 0.6.0cvs win32 builds

by Vittorio Palmisano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steve Chaplin ha scritto:

> Why does setup.py need:
> +import sys
>         +if sys.platform == 'win32':
>         +    include_dirs += get_include('freetype2')
>         +    library_dirs += get_lib_dirs('freetype2')
>         +    libraries += get_libs('freetype2') + ['gdi32','msimg32']
>        
> These cairo lines should pick up the freetype dependency
>         +include_dirs = get_include('cairo')
>         +library_dirs = get_lib_dirs('cairo')
>         +libraries = get_libs('cairo')
>        
> If its a problem with the names 'freetype' and 'freetype2' not matching
> then cairo or freetype should be patched.

Yes, I think it is a problem of freetype lib installed with mingw.

> I don't understand these lines:
>          PyTypeObject PycairoContext_Type = {
>         +#if defined(WIN32) || defined(__CYGWIN__)
>         +    PyObject_HEAD_INIT(NULL)
>         +#else /* ! WIN32 */
>              PyObject_HEAD_INIT(&PyType_Type)
>         -    0,                                  /* ob_size */
>         +#endif
>
> The line "PyObject_HEAD_INIT(&PyType_Type)" is used in
> Python-2.4.1/Objects/listobject.c (and many other *.c files) so it looks
> like a standard Python statement, why does it need to be changed?
>
> gcc on Linux handles it OK. mingw uses gcc so I'd expect it to handle it
> just the same.

On win32 with gcc version 3.4.4 (mingw special) I get this error:

cairo/pycairo-pattern.c:250: error: initializer element is not constant
cairo/pycairo-pattern.c:250: error: (near initialization for
`PycairoPattern_Type.ob_type')
cairo/pycairo-pattern.c:281: error: initializer element is not constant
cairo/pycairo-pattern.c:281: error: (near initialization for
`PycairoPattern_Type.tp_base')
error: command 'gcc' failed with exit status 1

a similar problem is reported here:
<http://sourceforge.net/mailarchive/forum.php?forum_id=4026&max_rows=25&style=nested&viewmonth=200504>


- --
/Vittorio Palmisano/
Home Page: http://redclay.altervista.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC+zhtpT6bvDtyXOIRArsGAJ42ODoJCb6kJl1owcxAG6TjkWqPpACfcTb1
lR+3Tjr3oiY/lPCdwGKYKLE=
=vIYb
-----END PGP SIGNATURE-----

_______________________________________________
cairo mailing list
cairo@...
http://lists.freedesktop.org/mailman/listinfo/cairo