[cairo-commit] 5 commits - boilerplate/cairo-boilerplate-pdf.c boilerplate/cairo-boilerplate-private.h boilerplate/cairo-boilerplate-ps.c boilerplate/cairo-boilerplate-svg.c boilerplate/cairo-boilerplate-win32-printing.c boilerplate/Makefile.win32 configure.ac src/cairo-deflate-stream.c src/cairoint.h src/cairo-xcb-connection-shm.c src/cairo-xcb-shm.c src/cairo-xlib-xcb-surface.c src/Makefile.sources test/cairo-test.c test/Makefile.win32

Andrea Canciani ranma42 at kemper.freedesktop.org
Tue Jun 14 09:35:31 PDT 2011


 boilerplate/Makefile.win32                     |    3 ++
 boilerplate/cairo-boilerplate-pdf.c            |    9 +++++--
 boilerplate/cairo-boilerplate-private.h        |    4 +++
 boilerplate/cairo-boilerplate-ps.c             |   10 ++++++--
 boilerplate/cairo-boilerplate-svg.c            |   10 ++++++--
 boilerplate/cairo-boilerplate-win32-printing.c |   10 ++++++--
 configure.ac                                   |    5 +---
 src/Makefile.sources                           |   29 ++++---------------------
 src/cairo-deflate-stream.c                     |    5 ++++
 src/cairo-xcb-connection-shm.c                 |    4 +++
 src/cairo-xcb-shm.c                            |    4 +++
 src/cairo-xlib-xcb-surface.c                   |    4 +++
 src/cairoint.h                                 |    4 +++
 test/Makefile.win32                            |    7 +-----
 test/cairo-test.c                              |    1 
 15 files changed, 68 insertions(+), 41 deletions(-)

New commits:
commit 3b9c8744898823a4b09917f0540a324318fef726
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jun 14 15:33:18 2011 +0200

    test: Use POSIX-compatible unlink
    
    On Win32, the POSIX-compatible unlink function is named "_unlink".
    
    A function named "unlink" exists, but does not have the same behavior
    as the POSIX-specified one. This function makes the cairo test suite
    behave incorrectly and immediately terminate with the message:
    
    Error: Cannot remove cairo-test-suite.log: No error

diff --git a/test/cairo-test.c b/test/cairo-test.c
index e03f9f7..b438e07 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -75,6 +75,7 @@
 #include <crtdbg.h>
 #define vsnprintf _vsnprintf
 #define access _access
+#define unlink _unlink
 #define F_OK 0
 #endif
 
commit 5cb18fcec7d973595e4e8ae992ce84836b815ce4
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jun 14 15:34:09 2011 +0200

    test: Fix compilation on win32
    
    The Microsoft C Compiler does not accept empty-initialized arrays:
    
    cairo-boilerplate-win32-printing.c(373) : error C2059: syntax error : '}'
    cairo-boilerplate-win32-printing.c(374) : warning C4034: sizeof returns 0

diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index 53bf55b..9854344 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -238,10 +238,8 @@ _cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface,
 					   x_pixels_per_inch,
 					   y_pixels_per_inch);
 }
-#endif
 
 static const cairo_boilerplate_target_t targets[] = {
-#if CAIRO_CAN_TEST_PDF_SURFACE
     {
 	"pdf", "pdf", ".pdf", NULL,
 	CAIRO_SURFACE_TYPE_PDF,
@@ -269,6 +267,11 @@ static const cairo_boilerplate_target_t targets[] = {
 	_cairo_boilerplate_pdf_cleanup,
 	NULL, NULL, FALSE, TRUE, TRUE
     },
-#endif
 };
 CAIRO_BOILERPLATE (pdf, targets)
+
+#else
+
+CAIRO_NO_BOILERPLATE (pdf)
+
+#endif
diff --git a/boilerplate/cairo-boilerplate-private.h b/boilerplate/cairo-boilerplate-private.h
index a848aa1..a7a2dd0 100644
--- a/boilerplate/cairo-boilerplate-private.h
+++ b/boilerplate/cairo-boilerplate-private.h
@@ -44,6 +44,10 @@ void _register_##name__ (void) { \
 					 sizeof (targets__) / sizeof (targets__[0])); \
 }
 
+#define CAIRO_NO_BOILERPLATE(name__) \
+void _register_##name__ (void); \
+void _register_##name__ (void) { }
+
 CAIRO_END_DECLS
 
 #endif /* _CAIRO_BOILERPLATE_PRIVATE_H_ */
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index a3f7507..c3f0694 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -26,6 +26,8 @@
 
 #include "cairo-boilerplate-private.h"
 
+#if CAIRO_CAN_TEST_PS_SURFACE
+
 #include <cairo-ps.h>
 
 #include <cairo-ps-surface-private.h>
@@ -302,7 +304,6 @@ _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface,
 }
 
 static const cairo_boilerplate_target_t targets[] = {
-#if CAIRO_CAN_TEST_PS_SURFACE
     {
 	"ps2", "ps", ".ps", NULL,
 	CAIRO_SURFACE_TYPE_PS,
@@ -357,6 +358,11 @@ static const cairo_boilerplate_target_t targets[] = {
 	_cairo_boilerplate_ps_cleanup,
 	NULL, NULL, FALSE, TRUE, TRUE
     },
-#endif
 };
 CAIRO_BOILERPLATE (ps, targets)
+
+#else
+
+CAIRO_NO_BOILERPLATE (ps)
+
+#endif
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index b5a7d0d..10fddb6 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -26,6 +26,8 @@
 
 #include "cairo-boilerplate-private.h"
 
+#if CAIRO_CAN_TEST_SVG_SURFACE
+
 #include <cairo-svg.h>
 #include <cairo-svg-surface-private.h>
 #include <cairo-paginated-surface-private.h>
@@ -274,7 +276,6 @@ _cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface,
 }
 
 static const cairo_boilerplate_target_t targets[] = {
-#if CAIRO_CAN_TEST_SVG_SURFACE
     /* It seems we should be able to round-trip SVG content perfectly
      * through librsvg and cairo, but for some mysterious reason, some
      * systems get an error of 1 for some pixels on some of the text
@@ -332,6 +333,11 @@ static const cairo_boilerplate_target_t targets[] = {
 	_cairo_boilerplate_svg_cleanup,
 	NULL, NULL, FALSE, TRUE, TRUE
     },
-#endif
 };
 CAIRO_BOILERPLATE (svg, targets)
+
+#else
+
+CAIRO_NO_BOILERPLATE (svg)
+
+#endif
diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c
index ee76bf6..0e54512 100644
--- a/boilerplate/cairo-boilerplate-win32-printing.c
+++ b/boilerplate/cairo-boilerplate-win32-printing.c
@@ -36,6 +36,8 @@
 
 #include "cairo-boilerplate-private.h"
 
+#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE
+
 #include <cairo-win32.h>
 #include <cairo-win32-private.h>
 #include <cairo-paginated-surface-private.h>
@@ -343,7 +345,6 @@ _cairo_boilerplate_win32_printing_cleanup (void *closure)
 }
 
 static const cairo_boilerplate_target_t targets[] = {
-#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE
     {
 	"win32-printing", "win32", ".ps", NULL,
 	CAIRO_SURFACE_TYPE_WIN32_PRINTING,
@@ -369,6 +370,11 @@ static const cairo_boilerplate_target_t targets[] = {
 	_cairo_boilerplate_win32_printing_cleanup,
 	NULL, NULL, FALSE, TRUE, TRUE
     },
-#endif
 };
 CAIRO_BOILERPLATE (win32_printing, targets)
+
+#else
+
+CAIRO_NO_BOILERPLATE (win32_printing)
+
+#endif
commit 0cbe3d1020fae0fdd601f48ca8c67861390c78ad
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jun 14 16:30:01 2011 +0200

    test: Update generation of constructors on win32
    
    51bd27afa147f78c8f4f3778cee725b6444e7eb0 removed
    make-cairo-test-constructors.c but did not update the win32 Makefiles
    accordingly.
    
    cairo-test-constructors.c is now generated by a make target which runs
    make-cairo-test-constructors.sh.

diff --git a/test/Makefile.win32 b/test/Makefile.win32
index 8d8f1f8..0d9a15c 100644
--- a/test/Makefile.win32
+++ b/test/Makefile.win32
@@ -14,11 +14,8 @@ TESTCORE_SOURCES = \
 
 all: cairo-test-suite.exe
 
-make-cairo-test-constructors.exe: $(CFG)/make-cairo-test-constructors.obj
-	$(CC) $(OPT) $(MS_MDFLAGS) $(CFG)/make-cairo-test-constructors.obj -Fe"$@" -link $(LDFLAGS) user32.lib /NODEFAULTLIB:library
-
-cairo-test-constructors.c: $(test_sources) make-cairo-test-constructors.exe
-	./make-cairo-test-constructors.exe $(test_sources) > $@
+cairo-test-constructors.c: Makefile.sources Makefile.win32 $(test_sources) make-cairo-test-constructors.sh
+	sh ./make-cairo-test-constructors.sh $(test_sources) > $@
 
 SOURCES = $(cairo_test_suite_sources) $(test_sources) cairo-test-constructors.c
 
commit 510f0f391cf07a6357468493a3b9aacbd0069a8d
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jun 14 16:15:57 2011 +0200

    boilerplate: Add generation of constructors on win32
    
    cairo-boilerplate-constructors.c is one of the sources required to
    build the boilerplate.
    
    This file is generated by a script, invoked by the appropriate make
    target during the build.

diff --git a/boilerplate/Makefile.win32 b/boilerplate/Makefile.win32
index 286ea2b..46aa0b6 100644
--- a/boilerplate/Makefile.win32
+++ b/boilerplate/Makefile.win32
@@ -11,10 +11,13 @@ HEADERS = \
 
 SOURCES = \
 	$(enabled_cairo_boilerplate_sources) \
+	cairo-boilerplate-constructors.c \
 	$(NULL)
 
 OBJECTS = $(patsubst %.c, $(CFG)/%-static.obj, $(SOURCES))
 
+cairo-boilerplate-constructors.c: Makefile.sources Makefile.win32 $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors.sh
+	sh ./make-cairo-boilerplate-constructors.sh $(enabled_cairo_boilerplate_sources) > $@
 
 all: $(CFG)/boiler.lib
 
commit 45665c0d48396af7bd653d546115a5f36cfa9ae1
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jun 14 10:45:18 2011 +0200

    Remove if's from Makefile.sources
    
    make on win32 complains that:
    
    make[1]: Entering directory `/home/ranma42/Code/fdo/cairo/src'
    ../src/Makefile.sources:220: *** missing separator.  Stop.
    
    Makefile.sources should not contain if's, which are aoutomake-only
    conditionals.  The correct way to conditionally include files is to
    enable/disable them using C preprocessor macros.

diff --git a/configure.ac b/configure.ac
index 72caa0d..5d72c24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,12 +114,12 @@ CAIRO_ENABLE_FUNCTIONS(xlib_xcb, Xlib/XCB, no, [
   if test "x$use_xcb" = "xyes" -a "x$use_xlib" = "xyes"; then
     xlib_xcb_REQUIRES="x11-xcb"
     PKG_CHECK_MODULES(xlib_xcb, $xlib_xcb_REQUIRES, ,
-		      [use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
+		      [AC_MSG_RESULT(no)
+		      use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
   else
     use_xlib_xcb="no (requires both --enable-xlib and --enable-xcb)"
   fi
 ])
-AM_CONDITIONAL(BUILD_XLIB_XCB, test "x$use_xlib_xcb" = "xyes")
 
 CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
   if test "x$use_xcb" = "xyes"; then
@@ -131,7 +131,6 @@ CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
     use_xcb_shm="no (requires --enable-xcb)"
   fi
 ])
-AM_CONDITIONAL(BUILD_XCB_SHM, test "x$use_xcb_shm" = "xyes")
 
 dnl ===========================================================================
 
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 474e092..edb9f44 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -212,14 +212,12 @@ cairo_ps_headers = cairo-ps.h
 cairo_ps_private = cairo-ps-surface-private.h
 cairo_ps_sources = cairo-ps-surface.c
 
-cairo_deflate_stream_sources = cairo-deflate-stream.c
+_cairo_deflate_stream_sources = cairo-deflate-stream.c
+cairo_sources += $(_cairo_deflate_stream_sources)
 
 cairo_pdf_headers = cairo-pdf.h
 cairo_pdf_private = cairo-pdf-surface-private.h
 cairo_pdf_sources = cairo-pdf-surface.c
-if CAIRO_HAS_PDF_SURFACE
-req_cairo_deflate_stream_sources = $(cairo_deflate_stream_sources)
-endif
 
 cairo_svg_headers = cairo-svg.h
 cairo_svg_private = cairo-svg-surface-private.h
@@ -251,16 +249,13 @@ cairo_xlib_private = \
 	cairo-xlib-surface-private.h \
 	cairo-xlib-xrender-private.h \
 	$(NULL)
-if BUILD_XLIB_XCB
-cairo_xlib_sources = cairo-xlib-xcb-surface.c
-else
 cairo_xlib_sources = \
 	cairo-xlib-display.c \
 	cairo-xlib-screen.c \
 	cairo-xlib-surface.c \
 	cairo-xlib-visual.c \
+	cairo-xlib-xcb-surface.c \
 	$(NULL)
-endif
 
 cairo_xlib_xrender_headers = cairo-xlib-xrender.h
 
@@ -270,18 +265,14 @@ cairo_xcb_sources = \
 		    cairo-xcb-connection.c \
 		    cairo-xcb-connection-core.c \
 		    cairo-xcb-connection-render.c \
+		    cairo-xcb-connection-shm.c \
 		    cairo-xcb-screen.c \
+		    cairo-xcb-shm.c \
 		    cairo-xcb-surface.c \
 		    cairo-xcb-surface-cairo.c \
 		    cairo-xcb-surface-core.c \
 		    cairo-xcb-surface-render.c \
 		    $(NULL)
-if BUILD_XCB_SHM
-cairo_xcb_sources += \
-		    cairo-xcb-shm.c \
-		    cairo-xcb-connection-shm.c \
-		    $(NULL)
-endif
 
 cairo_qt_headers = cairo-qt.h
 cairo_qt_cxx_sources = cairo-qt-surface.cpp
@@ -379,9 +370,6 @@ cairo_drm_xr_sources = \
 
 cairo_script_headers = cairo-script.h
 cairo_script_sources = cairo-script-surface.c
-if CAIRO_HAS_SCRIPT_SURFACE
-req_cairo_deflate_stream_sources = $(cairo_deflate_stream_sources)
-endif
 
 cairo_tee_headers = cairo-tee.h
 cairo_tee_private = cairo-tee-surface-private.h
@@ -389,13 +377,6 @@ cairo_tee_sources = cairo-tee-surface.c
 
 cairo_xml_headers = cairo-xml.h
 cairo_xml_sources = cairo-xml-surface.c
-if CAIRO_HAS_XML_SURFACE
-req_cairo_deflate_stream_sources = $(cairo_deflate_stream_sources)
-endif
 
 cairo_vg_headers = cairo-vg.h
 cairo_vg_sources = cairo-vg-surface.c
-
-cairo_sources += \
-		 $(req_cairo_deflate_stream_sources) \
-		 $(NULL)
diff --git a/src/cairo-deflate-stream.c b/src/cairo-deflate-stream.c
index ba5f183..ae23bda 100644
--- a/src/cairo-deflate-stream.c
+++ b/src/cairo-deflate-stream.c
@@ -35,6 +35,9 @@
  */
 
 #include "cairoint.h"
+
+#if CAIRO_HAS_DEFLATE_STREAM
+
 #include "cairo-error-private.h"
 #include "cairo-output-stream-private.h"
 #include <zlib.h>
@@ -149,3 +152,5 @@ _cairo_deflate_stream_create (cairo_output_stream_t *output)
 
     return &stream->base;
 }
+
+#endif /* CAIRO_HAS_DEFLATE_STREAM */
diff --git a/src/cairo-xcb-connection-shm.c b/src/cairo-xcb-connection-shm.c
index ccdcb27..2ba9583 100644
--- a/src/cairo-xcb-connection-shm.c
+++ b/src/cairo-xcb-connection-shm.c
@@ -31,6 +31,8 @@
 
 #include "cairoint.h"
 
+#if CAIRO_HAS_XCB_SHM_FUNCTIONS
+
 #include "cairo-xcb-private.h"
 
 #include <xcb/xcbext.h>
@@ -107,3 +109,5 @@ _cairo_xcb_connection_shm_detach (cairo_xcb_connection_t *connection,
     xcb_shm_detach (connection->xcb_connection, segment);
     _cairo_xcb_connection_put_xid (connection, segment);
 }
+
+#endif /* CAIRO_HAS_XCB_SHM_FUNCTIONS */
diff --git a/src/cairo-xcb-shm.c b/src/cairo-xcb-shm.c
index 55be475..7695279 100644
--- a/src/cairo-xcb-shm.c
+++ b/src/cairo-xcb-shm.c
@@ -36,6 +36,8 @@
 
 #include "cairoint.h"
 
+#if CAIRO_HAS_XCB_SHM_FUNCTIONS
+
 #include "cairo-xcb-private.h"
 
 #include <xcb/shm.h>
@@ -650,3 +652,5 @@ _cairo_xcb_connection_shm_mem_pools_fini (cairo_xcb_connection_t *connection)
 								 link));
     }
 }
+
+#endif /* CAIRO_HAS_XCB_SHM_FUNCTIONS */
diff --git a/src/cairo-xlib-xcb-surface.c b/src/cairo-xlib-xcb-surface.c
index 84e9e33..9c5eb5a 100644
--- a/src/cairo-xlib-xcb-surface.c
+++ b/src/cairo-xlib-xcb-surface.c
@@ -38,6 +38,8 @@
 
 #include "cairoint.h"
 
+#if CAIRO_HAS_XLIB_XCB_FUNCTIONS
+
 #include "cairo-xlib.h"
 #include "cairo-xcb.h"
 
@@ -537,3 +539,5 @@ cairo_xlib_surface_get_height (cairo_surface_t *abstract_surface)
 
     return surface->xcb->height;
 }
+
+#endif /* CAIRO_HAS_XLIB_XCB_FUNCTIONS */
diff --git a/src/cairoint.h b/src/cairoint.h
index 1d658c8..424457f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -72,6 +72,10 @@
 
 #include "cairo-compiler-private.h"
 
+#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_SCRIPT_SURFACE || CAIRO_HAS_XML_SURFACE
+#define CAIRO_HAS_DEFLATE_STREAM 1
+#endif
+
 #if CAIRO_HAS_PS_SURFACE  || \
     CAIRO_HAS_PDF_SURFACE || \
     CAIRO_HAS_SVG_SURFACE || \


More information about the cairo-commit mailing list