summaryrefslogtreecommitdiff
path: root/dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch')
-rw-r--r--dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch b/dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch
new file mode 100644
index 00000000000..78dc13bd174
--- /dev/null
+++ b/dev-python/pycairo/files/pycairo-1.8.8-svg_check.patch
@@ -0,0 +1,116 @@
+--- setup.py
++++ setup.py
+@@ -29,6 +30,16 @@
+ print pipe.stderr.read()
+ raise SystemExit('Error: %s >= %s not found' % (pkg, version))
+
++def pkg_config_svg_check():
++ if os.environ.get('PYCAIRO_DISABLE_SVG', None) is None:
++ pipe = call('pkg-config --exists cairo-svg')
++ if pipe.returncode == 0:
++ return [('PYCAIRO_ENABLE_SVG', None)]
++ else:
++ return []
++ else:
++ return []
++
+ def pkg_config_parse(opt, pkg):
+ pipe = call("pkg-config %s %s" % (opt, pkg))
+ output = pipe.stdout.read()
+@@ -94,6 +105,7 @@
+ 'src/pattern.c',
+ 'src/surface.c',
+ ],
++ define_macros = pkg_config_svg_check(),
+ include_dirs = pkg_config_parse('--cflags-only-I', 'cairo'),
+ library_dirs = pkg_config_parse('--libs-only-L', 'cairo'),
+ libraries = pkg_config_parse('--libs-only-l', 'cairo'),
+--- src/cairomodule.c
++++ src/cairomodule.c
+@@ -122,7 +122,7 @@
+ #else
+ 0,
+ #endif
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+ &PycairoSVGSurface_Type,
+ #else
+ 0,
+@@ -209,7 +209,7 @@
+ if (PyType_Ready(&PycairoPSSurface_Type) < 0)
+ return;
+ #endif
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+ if (PyType_Ready(&PycairoSVGSurface_Type) < 0)
+ return;
+ #endif
+@@ -285,7 +285,7 @@
+ PyModule_AddObject(m, "PSSurface", (PyObject *)&PycairoPSSurface_Type);
+ #endif
+
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+ Py_INCREF(&PycairoSVGSurface_Type);
+ PyModule_AddObject(m, "SVGSurface", (PyObject *)&PycairoSVGSurface_Type);
+ #endif
+@@ -350,7 +350,7 @@
+ #else
+ PyModule_AddIntConstant(m, "HAS_PS_SURFACE", 0);
+ #endif
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+ PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 1);
+ #else
+ PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 0);
+--- src/private.h
++++ src/private.h
+@@ -86,7 +86,7 @@
+ extern PyTypeObject PycairoPSSurface_Type;
+ #endif
+
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+ extern PyTypeObject PycairoSVGSurface_Type;
+ #endif
+
+--- src/pycairo.h
++++ src/pycairo.h
+@@ -178,7 +178,7 @@
+ #define PycairoPSSurface_Type *(Pycairo_CAPI->PSSurface_Type)
+ #endif
+
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+ #define PycairoSVGSurface_Type *(Pycairo_CAPI->SVGSurface_Type)
+ #endif
+
+--- src/surface.c
++++ src/surface.c
+@@ -80,7 +80,7 @@
+ type = &PycairoPSSurface_Type;
+ break;
+ #endif
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+ case CAIRO_SURFACE_TYPE_SVG:
+ type = &PycairoSVGSurface_Type;
+ break;
+@@ -965,7 +965,7 @@
+
+
+ /* Class SVGSurface(Surface) ----------------------------------------------- */
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+ #include <cairo-svg.h>
+
+ static PyObject *
+@@ -1067,7 +1067,7 @@
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ };
+-#endif /* CAIRO_HAS_SVG_SURFACE */
++#endif /* PYCAIRO_ENABLE_SVG */
+
+
+ /* Class Win32Surface(Surface) -------------------------------------------- */