summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-09-02 20:20:49 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-09-02 20:24:08 -0400
commit59262577708ddb656851624377efb2a671fa8ca3 (patch)
tree2c75bd94e2cfe3efb333b0b1509c0540181af100 /src
parent5cb3e66305b25a3380f2ca5829ac81e4a27e76d0 (diff)
Revamp the build system.
Quick summary of changes: - Move list of cairo source files out of src/Makefile.am and into src/Sources.mk, - Generate files src/Config.mk and src/Config.mk.win32 that choose the right set of source files and headers based on configured backends and features. This drastically simplifies building using other build systems. The src/Makefile.win32 file needs to be updated to reflect these changes. - Add README files to various directories, - Add toplevel HACKING file.
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore5
-rw-r--r--src/Makefile.am383
-rw-r--r--src/Makefile.win323
-rw-r--r--src/README58
-rw-r--r--src/Sources.mk246
-rw-r--r--src/cairo-cff-subset.c5
-rw-r--r--src/cairo-clip-private.h3
-rw-r--r--src/cairo-compiler-private.h6
-rw-r--r--src/cairo-freelist-private.h1
-rw-r--r--src/cairo-misc.c68
-rw-r--r--src/cairo-mutex-impl-private.h6
-rw-r--r--src/cairo-mutex-private.h4
-rw-r--r--src/cairo-mutex-type-private.h6
-rw-r--r--src/cairo-output-stream-private.h4
-rw-r--r--src/cairo-path-fixed-private.h2
-rw-r--r--src/cairo-pdf-operators-private.h1
-rw-r--r--src/cairo-pdf-operators.c5
-rw-r--r--src/cairo-ps-surface-private.h2
-rw-r--r--src/cairo-reference-count-private.h4
-rw-r--r--src/cairo-region-private.h1
-rw-r--r--src/cairo-scaled-font-subsets-private.h10
-rw-r--r--src/cairo-scaled-font-subsets.c5
-rw-r--r--src/cairo-truetype-subset-private.h4
-rw-r--r--src/cairo-truetype-subset.c4
-rw-r--r--src/cairo-type1-fallback.c5
-rw-r--r--src/cairo-type1-private.h6
-rw-r--r--src/cairo-type1-subset.c10
-rw-r--r--src/cairo-type3-glyph-surface-private.h6
-rw-r--r--src/cairo-type3-glyph-surface.c5
-rw-r--r--src/cairo-types-private.h29
-rw-r--r--src/cairo-user-font-private.h1
-rw-r--r--src/cairo-win32.c98
-rw-r--r--src/cairo-xlib-xrender-private.h7
-rw-r--r--src/cairoint.h14
-rwxr-xr-xsrc/check-doc-syntax.sh2
35 files changed, 539 insertions, 480 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 04dcae348..128bcc764 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -8,8 +8,10 @@ Makefile.in
*.lo
*.loT
*.pc
+Config.mk
+Config.mk.win32
cairo-features.h
-cairo-no-features.h
+cairo-supported-features.h
cairo.def
*.i
*.s
@@ -24,4 +26,5 @@ cairo.def
*~
.*.sw?
TAGS
+tags
check-has-hidden-symbols.i
diff --git a/src/Makefile.am b/src/Makefile.am
index 444714b3c..c292cad88 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,348 +1,60 @@
-backend_pkgconfigs =
+include $(srcdir)/Config.mk
-cairo_base_headers = cairo.h
+EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+BUILT_SOURCES =
-cairo_base_sources = \
- cairo.c \
- cairo.h \
- cairo-private.h \
- cairo-arc.c \
- cairo-arc-private.h \
- cairo-array.c \
- cairo-atomic.c \
- cairo-atomic-private.h \
- cairo-base85-stream.c \
- cairo-bentley-ottmann.c \
- cairo-cache.c \
- cairo-clip.c \
- cairo-clip-private.h \
- cairo-color.c \
- cairo-compiler-private.h \
- cairo-debug.c \
- cairo-fixed.c \
- cairo-font-face.c \
- cairo-font-options.c \
- cairo-freelist.c \
- cairo-freelist-private.h \
- cairo-gstate.c \
- cairo-gstate-private.h \
- cairo-hash.c \
- cairo-hash-private.h \
- cairo-hull.c \
- cairo-image-surface.c \
- cairo-lzw.c \
- cairo-misc.c \
- cairo-malloc-private.h \
- cairo-matrix.c \
- cairo-mutex.c \
- cairo-mutex-private.h \
- cairo-mutex-impl-private.h \
- cairo-mutex-type-private.h \
- cairo-path.c \
- cairo-path-private.h \
- cairo-path-bounds.c \
- cairo-path-fill.c \
- cairo-path-fixed.c \
- cairo-path-fixed-private.h \
- cairo-path-stroke.c \
- cairo-pattern.c \
- cairo-pen.c \
- cairo-polygon.c \
- cairo-rectangle.c \
- cairo-reference-count-private.h \
- cairo-region.c \
- cairo-region-private.h \
- cairo-scaled-font.c \
- cairo-scaled-font-private.h \
- cairo-skiplist.c \
- cairo-skiplist-private.h \
- cairo-slope.c \
- cairo-spline.c \
- cairo-stroke-style.c \
- cairo-surface.c \
- cairo-surface-fallback.c \
- cairo-surface-fallback-private.h \
- cairo-surface-private.h \
- cairo-traps.c \
- cairo-user-font.c \
- cairo-user-font-private.h \
- cairo-unicode.c \
- cairo-output-stream.c \
- cairo-output-stream-private.h \
- cairo-wideint.c \
- cairo-wideint-private.h \
- cairo-wideint-type-private.h \
- cairo-meta-surface.c \
- cairo-meta-surface-private.h \
- cairo-paginated-private.h \
- cairo-paginated-surface.c \
- cairo-paginated-surface-private.h \
- cairo-analysis-surface.c \
- cairo-analysis-surface-private.h \
- cairo-version.c \
- cairo-version.h \
- cairoint.h
-cairo_all_sources = $(cairo_base_sources) $(cairo_base_headers)
-cairo_headers = $(cairo_base_headers)
-cairo_sources = $(cairo_base_sources)
-
-font_subset_sources_base = \
- cairo-cff-subset.c \
- cairo-truetype-subset.c \
- cairo-type1-fallback.c \
- cairo-type1-private.h \
- cairo-truetype-subset-private.h \
- cairo-type3-glyph-surface.c \
- cairo-type3-glyph-surface-private.h \
- cairo-scaled-font-subsets.c \
- cairo-scaled-font-subsets-private.h
-cairo_all_sources += $(font_subset_sources_base)
-
-font_subset_sources_ft = cairo-type1-subset.c
-cairo_all_sources += $(font_subset_sources_ft)
-font_subset_sources = $(font_subset_sources_base)
-if CAIRO_HAS_FT_FONT
-font_subset_sources += $(font_subset_sources_ft)
-endif
-
-pdf_operators_sources = cairo-pdf-operators.c cairo-pdf-operators-private.h
-
-ps_headers = cairo-ps.h
-ps_sources = cairo-ps-surface.c cairo-ps-surface-private.h
-cairo_all_sources += $(ps_headers) $(ps_sources)
-if CAIRO_HAS_PS_SURFACE
-libcairo_pdf_operators_sources = $(pdf_operators_sources)
-libcairo_font_subset_sources = $(font_subset_sources)
-cairo_headers += $(ps_headers)
-cairo_sources += $(ps_sources)
-backend_pkgconfigs += cairo-ps.pc
-endif
-
-pdf_headers = cairo-pdf.h
-pdf_sources = cairo-pdf-surface.c cairo-pdf-surface-private.h \
- cairo-deflate-stream.c
-cairo_all_sources += $(pdf_headers) $(pdf_sources)
-if CAIRO_HAS_PDF_SURFACE
-libcairo_pdf_operators_sources = $(pdf_operators_sources)
-libcairo_font_subset_sources = $(font_subset_sources)
-cairo_headers += $(pdf_headers)
-cairo_sources += $(pdf_sources)
-backend_pkgconfigs += cairo-pdf.pc
-endif
-
-png_sources = cairo-png.c
-cairo_all_sources += $(png_sources)
-if CAIRO_HAS_PNG_FUNCTIONS
-cairo_sources += $(png_sources)
-backend_pkgconfigs += cairo-png.pc
-endif
-
-svg_headers = cairo-svg.h
-svg_sources = cairo-svg-surface.c cairo-svg-surface-private.h
-cairo_all_sources += $(svg_headers) $(svg_sources)
-if CAIRO_HAS_SVG_SURFACE
-libcairo_font_subset_sources = $(font_subset_sources)
-cairo_headers += $(svg_headers)
-cairo_sources += $(svg_sources)
-backend_pkgconfigs += cairo-svg.pc
-endif
-
-cairo_sources += $(libcairo_pdf_operators_sources)
-cairo_sources += $(libcairo_font_subset_sources)
-
-test_sources = test-fallback-surface.c test-fallback-surface.h \
- test-meta-surface.c test-meta-surface.h \
- test-paginated-surface.c test-paginated-surface.h
-cairo_all_sources += $(test_sources)
-if CAIRO_HAS_TEST_SURFACES
-cairo_sources += $(test_sources)
-endif
-
-xlib_headers = cairo-xlib.h
-xlib_sources = cairo-xlib-surface.c \
- cairo-xlib-surface-private.h \
- cairo-xlib-display.c \
- cairo-xlib-screen.c \
- cairo-xlib-visual.c \
- cairo-xlib-private.h \
- cairo-xlib-xrender-private.h
-cairo_all_sources += $(xlib_headers) $(xlib_sources)
-if CAIRO_HAS_XLIB_SURFACE
-cairo_headers += $(xlib_headers)
-cairo_sources += $(xlib_sources)
-backend_pkgconfigs += cairo-xlib.pc
-endif
-
-xlib_xrender_headers = cairo-xlib-xrender.h
-cairo_all_sources += $(xlib_xrender_headers)
-if CAIRO_HAS_XLIB_XRENDER_SURFACE
-cairo_headers += $(xlib_xrender_headers)
-backend_pkgconfigs += cairo-xlib-xrender.pc
-endif
-
-xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
-xcb_sources = cairo-xcb-surface.c
-cairo_all_sources += $(xcb_headers) $(xcb_sources)
-if CAIRO_HAS_XCB_SURFACE
-cairo_headers += $(xcb_headers)
-cairo_sources += $(xcb_sources)
-backend_pkgconfigs += cairo-xcb.pc
-endif
-
-quartz_headers = cairo-quartz.h
-quartz_sources = cairo-quartz-surface.c cairo-quartz-image-surface.c cairo-quartz-private.h
-cairo_all_sources += $(quartz_headers) $(quartz_sources)
-if CAIRO_HAS_QUARTZ_SURFACE
-cairo_headers += $(quartz_headers)
-cairo_sources += $(quartz_sources)
-backend_pkgconfigs += cairo-quartz.pc
-endif
-if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
-cairo_headers += cairo-quartz-image.h
-backend_pkgconfigs += cairo-quartz-image.pc
-endif
-
-quartz_font_sources = cairo-quartz-font.c
-cairo_all_sources += $(quartz_font_sources)
-if CAIRO_HAS_QUARTZ_FONT
-cairo_sources += $(quartz_font_sources)
-backend_pkgconfigs += cairo-quartz-font.pc
-endif
-
-os_win32_sources = cairo-win32.c
-cairo_all_sources += $(os_win32_sources)
if OS_WIN32
-cairo_sources += $(os_win32_sources)
export_symbols = -export-symbols cairo.def
cairo_def_dependency = cairo.def
endif
-win32_headers = cairo-win32.h
-win32_sources = cairo-win32-surface.c cairo-win32-printing-surface.c cairo-win32-private.h
-cairo_all_sources += $(win32_headers) $(win32_sources)
-if CAIRO_HAS_WIN32_SURFACE
-cairo_headers += $(win32_headers)
-cairo_sources += $(win32_sources)
-backend_pkgconfigs += cairo-win32.pc
-endif
+EXTRA_DIST += cairo-features-win32.h Config.mk.win32
+MAINTAINERCLEANFILES += cairo-features-win32.h Config.mk.win32
-win32_font_sources = cairo-win32-font.c
-cairo_all_sources += $(win32_font_sources)
-if CAIRO_HAS_WIN32_FONT
-cairo_sources += $(win32_font_sources)
-backend_pkgconfigs += cairo-win32-font.pc
-endif
-
-os2_headers = cairo-os2.h
-os2_sources = cairo-os2-surface.c cairo-os2-private.h
-cairo_all_sources += $(os2_headers) $(os2_sources)
-if CAIRO_HAS_OS2_SURFACE
-cairo_headers += $(os2_headers)
-cairo_sources += $(os2_sources)
-backend_pkgconfigs += cairo-os2.pc
-endif
-
-beos_headers = cairo-beos.h
-beos_sources = cairo-beos-surface.cpp
-cairo_all_sources += $(beos_headers) $(beos_sources)
-if CAIRO_HAS_BEOS_SURFACE
-cairo_headers += $(beos_headers)
-# automake is stupid enough to always use c++ linker if we enable the
-# following line, even if beos surface is not enabled. Disable it for now.
-#cairo_sources += $(beos_sources)
-backend_pkgconfigs += cairo-beos.pc
-endif
-
-glitz_headers = cairo-glitz.h
-glitz_sources = cairo-glitz-surface.c cairo-glitz-private.h
-cairo_all_sources += $(glitz_headers) $(glitz_sources)
-if CAIRO_HAS_GLITZ_SURFACE
-cairo_headers += $(glitz_headers)
-cairo_sources += $(glitz_sources)
-backend_pkgconfigs += cairo-glitz.pc
-endif
-
-directfb_headers = cairo-directfb.h
-directfb_sources = cairo-directfb-surface.c
-cairo_all_sources += $(directfb_headers) $(directfb_sources)
-if CAIRO_HAS_DIRECTFB_SURFACE
-cairo_headers += $(directfb_headers)
-cairo_sources += $(directfb_sources)
-backend_pkgconfigs += cairo-directfb.pc
-endif
-
-ft_headers = cairo-ft.h
-ft_sources = cairo-ft-font.c cairo-ft-private.h
-cairo_all_sources += $(ft_headers) $(ft_sources)
-if CAIRO_HAS_FT_FONT
-cairo_headers += $(ft_headers)
-cairo_sources += $(ft_sources)
-backend_pkgconfigs += cairo-ft.pc
-endif
+$(top_builddir)/config.h: $(top_srcdir)/config.h.in
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
-# These names match automake style variable definition conventions so
-# without these lines, automake will complain during the handling of
-# the libcairo_la_LIBADD below. (The INCLUDES is an autoconf only
-# term and automake does not care about it)
-FONTCONFIG_LIBS=@FONTCONFIG_LIBS@
-XRENDER_LIBS=@XRENDER_LIBS@
+all_cairo_files = \
+ $(cairo_all_headers) \
+ $(cairo_all_private) \
+ $(cairo_all_sources) \
+ $(NULL)
cairoincludedir = $(includedir)/cairo
-cairoinclude_HEADERS = \
- cairo-deprecated.h \
- $(top_srcdir)/cairo-version.h \
- $(cairo_headers)
-
-nodist_cairoinclude_HEADERS = \
- cairo-features.h
+cairoinclude_HEADERS = $(enabled_cairo_headers)
lib_LTLIBRARIES = libcairo.la
-# source files that cannot be passed to compiler directly.
-# mostly when they depend recursively on cairoint.h. that is,
-# cairoint.h includes them in the middle.
-cairo_special_sources = \
- cairo-cache-private.h \
- cairo-fixed-private.h \
- cairo-fixed-type-private.h \
- cairo-mutex-list-private.h \
- cairo-types-private.h
-
-libcairo_la_SOURCES = \
- $(cairo_sources) \
- $(cairo_special_sources)
-
-cairo_all_source_files = \
- $(cairo_all_sources) \
- $(cairo_special_sources)
-
+libcairo_la_SOURCES = \
+ $(enabled_cairo_headers) \
+ $(enabled_cairo_private) \
+ $(enabled_cairo_sources) \
+ $(NULL)
libcairo_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-
libcairo_la_CFLAGS = -I$(srcdir) $(CAIRO_CFLAGS)
-
-libcairo_la_LIBADD = $(CAIRO_LIBS) $(noinst_LTLIBRARIES) $(CAIRO_LDADD)
-
-libcairo_la_DEPENDENCIES = $(cairo_def_dependency) $(noinst_LTLIBRARIES)
+libcairo_la_LIBADD = $(CAIRO_LIBS) $(CAIRO_LDADD)
+libcairo_la_DEPENDENCIES = $(cairo_def_dependency)
+
+# Special headers
+cairoinclude_HEADERS += $(top_srcdir)/cairo-version.h
+nodist_cairoinclude_HEADERS = cairo-features.h
+libcairo_la_SOURCES += cairo-version.h cairo-features.h
+BUILT_SOURCES += cairo-features.h cairo-supported-features.h
+DISTCLEANFILES += cairo-features.h cairo-supported-features.h
+cairo-features.h cairo-supported-features.h:
+ cd $(top_builddir) && ./config.status src/$@
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = cairo.pc $(backend_pkgconfigs)
-DISTCLEANFILES = $(backend_pkgconfigs)
-EXTRA_DIST = cairo-backend.pc.in cairo-features-win32.h
-$(backend_pkgconfigs): $(top_srcdir)/configure
- cd $(top_builddir) && ./config.status --recheck
+pkgconfig_DATA = $(enabled_cairo_pkgconf)
-$(top_builddir)/config.h: $(top_srcdir)/config.h.in
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
-
-DISTCLEANFILES += cairo-features.h cairo-no-features.h
-cairo-features.h cairo-no-features.h:
- cd $(top_builddir) && ./config.status src/$@
-
-CLEANFILES = cairo.def
-cairo.def: $(cairo_headers) cairo-features.h
+CLEANFILES += cairo.def
+cairo.def: cairo-features.h $(enabled_cairo_headers)
@echo Generating $@
@(echo EXPORTS; \
- (cd $(srcdir); cat $(cairo_headers) || echo 'cairo_ERROR ()' ) | \
+ (cd $(srcdir); cat $(enabled_cairo_headers) || echo 'cairo_ERROR ()' ) | \
grep -v -E '^# *include' | \
( cat cairo-features.h - | $(CPP) - || echo 'cairo_ERROR ()' ) | \
grep -E '^cairo_.* \(' | \
@@ -352,40 +64,27 @@ cairo.def: $(cairo_headers) cairo-features.h
) >$@
@ ! grep -q cairo_ERROR $@ || ($(RM) $@; false)
-install-data-local:
- @if test -f "$(DESTDIR)$(includedir)/cairo.h" || test -f "$(DESTDIR)$(includedir)/cairo-features.h" ; then \
- echo "****************************************************************" ; \
- echo "*** Error: Old headers found. You should remove the following" ; \
- echo "*** files and then type 'make install' again." ; \
- ls $(includedir)/cairo*.h ; \
- echo "****************************************************************" ; \
- false ; \
- fi
-
-TESTS_ENVIRONMENT = srcdir="$(srcdir)" MAKE="$(MAKE)" cairo_all_source_files="$(cairo_all_source_files)"
+TESTS_ENVIRONMENT = srcdir="$(srcdir)" MAKE="$(MAKE)" all_cairo_files="$(all_cairo_files)" enabled_cairo_files="$(enabled_cairo_files)"
TESTS = check-def.sh check-plt.sh check-headers.sh check-cairoint.sh check-doc-syntax.sh
EXTRA_DIST += $(TESTS) check-has-hidden-symbols.c
-DISTCLEANFILES += check-has-hidden-symbols.i
-# Delete intermediate files as well
-clean-local:
- -${FIND} . -name '*.[is]' -print | ${XARGS} ${RM}
# The pre-processed result is used by check-{def,plt}.sh to determine whether
# cairo has been compiled with symbol hiding.
.c.i: $(cairoinclude_HEADERS) $(nodist_cairoinclude_HEADERS) cairoint.h $(top_builddir)/config.h
$(CPP) -DHAVE_CONFIG_H -I$(top_builddir) -I. $(libcairo_la_CFLAGS) $< -o $@
+CLEANFILES += *.i *.s
SPARSE = sparse
sparse:
- @status=true; for f in $(cairo_sources); do \
+ @status=true; for f in $(enabled_cairo_sources); do \
echo sparse $$f; \
$(SPARSE) -I$(top_builddir) $(libcairo_la_CFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
done; $$status
SPLINT = splint -badflag
splint:
- @status=true; for f in $(cairo_sources); do \
+ @status=true; for f in $(enabled_cairo_sources); do \
test "$$f" = "`echo "$$f" | sed 's/[.]h$$//'`" || continue; \
echo sparse $$f; \
$(SPLINT) -I$(top_builddir) $(libcairo_la_CFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
@@ -394,7 +93,7 @@ splint:
UNO = uno
uno:
@cpp_flags=`echo $(libcairo_la_CFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
- files=`echo $(cairo_sources) | sed 's/[^ ]*\.h//g'`; \
+ files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \
$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files
EXTRA_DIST += Makefile.win32
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index 5fcf60530..753fb9a9f 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -1,8 +1,9 @@
-
SUBMAKEFILE = 1
include ../Makefile.win32
+include Config.mk.win32
+
srcdir = `pwd`
SOURCES = \
diff --git a/src/README b/src/README
new file mode 100644
index 000000000..f29dd3ac0
--- /dev/null
+++ b/src/README
@@ -0,0 +1,58 @@
+Cairo Library Source Code
+=========================
+
+This directory contains the source code to the cairo library.
+
+
+Source Code Listing
+-------------------
+
+The canonical list of source files is the file Source.mk. See that
+file for how it works.
+
+
+New Backends
+------------
+
+The rule of the thumb for adding new backends is to see how other
+backends are integrated. Pick one of the simpler, unsupported, backends
+and search the entire tree for it, and go from there.
+
+To add new backends you need to basically:
+
+ * Modify $(top_srcdir)/configure.in to add checks for your backend.
+
+ * Modify Sources.mk to add source files for your backend,
+
+ * Modify $(top_srcdir)/boilerplate/ to add boilerplate code for
+ testing your new backend.
+
+
+New API
+-------
+
+After adding new API, run "make check" in this directory and fix any
+reported issues. Also add new API to the right location in
+$(top_srcdir)/doc/public/cairo-sections.txt and run "make check"
+in $(top_builddir)/doc/public to make sure that any newly added
+documentation is correctly hooked up.
+
+Do not forget to add tests for the new API. See next section.
+
+
+Tests
+-----
+
+There are some tests in this directory that check the source code and
+the build for various issues. The tests are very quick to run, and
+particularly should be run after any documentation or API changes. It
+does not hurt to run them after any source modification either. Run
+them simply by calling:
+
+ make check
+
+There are also extensive regression tests in $(top_srcdir)/test. It is
+a good idea to run that test suite for any changes made to the source
+code. Moreover, for any new feature, API, or bug fix, new tests should
+be added to the regression test suite to test the new code.
+
diff --git a/src/Sources.mk b/src/Sources.mk
new file mode 100644
index 000000000..8652dad94
--- /dev/null
+++ b/src/Sources.mk
@@ -0,0 +1,246 @@
+# Sources.mk
+#
+# This file is the canonical location listing all the source files used
+# to build the cairo library. Every source file is categorized as one of:
+#
+# * public header file
+# * private header file (must end in -private.h except for cairoint.h)
+# * source code file
+#
+# Every source file should be specified exactly once, grouped with the
+# backend/feature that uses the source file. If more than one
+# backend/feature use the file (like pdf_operators or font_subset files),
+# the files should be appended to to the base cairo files, and the code
+# inside them enabled/disabled using C preprocessor macros defined in
+# cairoint.h. See how pdf_operators or font_subset are handled.
+#
+# The sources are picked up according to the configured backends/features
+# by the generated file Config.mk or Config.mk.win32.
+#
+# These are a few special source files. Those are not included in this
+# file to not confuse build systems. Each build system must handle them
+# separately. These files include:
+#
+# * cairo-features.h:
+# This file is generated by configure and includes macros signifying
+# which backends/features are enabled. This file should be installed
+# like other public headers, but should NOT be distributed in the
+# cairo distribution.
+#
+# * cairo-features-win32.h:
+# This is a dummy file for use as cairo-featurs.h when building on
+# win32. This file is not used during the build and should NOT be
+# installed.
+#
+# * cairo-version.h:
+# This is a dummy header file used during the build, but it should
+# NOT be installed. Its sole purpose is to make sure changes in the
+# cairo version do not trigger a full rebuild of the library, but
+# just the functions actually using the version information.
+#
+# * $(top_srcdir)/cairo-version.h:
+# This is the real file holding the cairo version number. This file
+# should be installed like other public headers. This is used during
+# the build by cairo-version.c only.
+#
+# * cairo-supported-features.h:
+# This file is generated by configure and includes macros signifying
+# all supported supported backends/features. This is used by gtk-doc
+# to generate documentation for all those macros, enabled or not.
+# This file is NOT used during the build of the library and should NOT
+# be installed or distributed.
+#
+# Please follow the strict syntax of this file, including keeping file
+# lists sorted.
+#
+
+cairo_headers = cairo.h cairo-deprecated.h
+cairo_private = \
+ cairoint.h \
+ cairo-analysis-surface-private.h \
+ cairo-arc-private.h \
+ cairo-atomic-private.h \
+ cairo-cache-private.h \
+ cairo-clip-private.h \
+ cairo-compiler-private.h \
+ cairo-fixed-private.h \
+ cairo-fixed-type-private.h \
+ cairo-freelist-private.h \
+ cairo-gstate-private.h \
+ cairo-hash-private.h \
+ cairo-malloc-private.h \
+ cairo-meta-surface-private.h \
+ cairo-mutex-impl-private.h \
+ cairo-mutex-list-private.h \
+ cairo-mutex-private.h \
+ cairo-mutex-type-private.h \
+ cairo-output-stream-private.h \
+ cairo-paginated-private.h \
+ cairo-paginated-surface-private.h \
+ cairo-path-fixed-private.h \
+ cairo-path-private.h \
+ cairo-private.h \
+ cairo-reference-count-private.h \
+ cairo-region-private.h \
+ cairo-scaled-font-private.h \
+ cairo-skiplist-private.h \
+ cairo-surface-fallback-private.h \
+ cairo-surface-private.h \
+ cairo-types-private.h \
+ cairo-user-font-private.h \
+ cairo-wideint-private.h \
+ cairo-wideint-type-private.h \
+ $(NULL)
+cairo_sources = \
+ cairo-analysis-surface.c \
+ cairo-arc.c \
+ cairo-array.c \
+ cairo-atomic.c \
+ cairo-base85-stream.c \
+ cairo-bentley-ottmann.c \
+ cairo.c \
+ cairo-cache.c \
+ cairo-clip.c \
+ cairo-color.c \
+ cairo-debug.c \
+ cairo-fixed.c \
+ cairo-font-face.c \
+ cairo-font-options.c \
+ cairo-freelist.c \
+ cairo-gstate.c \
+ cairo-hash.c \
+ cairo-hull.c \
+ cairo-image-surface.c \
+ cairo-lzw.c \
+ cairo-matrix.c \
+ cairo-meta-surface.c \
+ cairo-misc.c \
+ cairo-mutex.c \
+ cairo-output-stream.c \
+ cairo-paginated-surface.c \
+ cairo-path-bounds.c \
+ cairo-path.c \
+ cairo-path-fill.c \
+ cairo-path-fixed.c \
+ cairo-path-stroke.c \
+ cairo-pattern.c \
+ cairo-pen.c \
+ cairo-polygon.c \
+ cairo-rectangle.c \
+ cairo-region.c \
+ cairo-scaled-font.c \
+ cairo-skiplist.c \
+ cairo-slope.c \
+ cairo-spline.c \
+ cairo-stroke-style.c \
+ cairo-surface.c \
+ cairo-surface-fallback.c \
+ cairo-traps.c \
+ cairo-unicode.c \
+ cairo-user-font.c \
+ cairo-version.c \
+ cairo-wideint.c \
+ $(NULL)
+
+_cairo_font_subset_private = \
+ cairo-scaled-font-subsets-private.h \
+ cairo-truetype-subset-private.h \
+ cairo-type1-private.h \
+ cairo-type3-glyph-surface-private.h \
+ $(NULL)
+_cairo_font_subset_sources = \
+ cairo-cff-subset.c \
+ cairo-scaled-font-subsets.c \
+ cairo-truetype-subset.c \
+ cairo-type1-fallback.c \
+ cairo-type1-subset.c \
+ cairo-type3-glyph-surface.c \
+ $(NULL)
+cairo_private += $(_cairo_font_subset_private)
+cairo_sources += $(_cairo_font_subset_sources)
+
+_cairo_pdf_operators_private = cairo-pdf-operators-private.h
+_cairo_pdf_operators_sources = cairo-pdf-operators.c
+cairo_private += $(_cairo_pdf_operators_private)
+cairo_sources += $(_cairo_pdf_operators_sources)
+
+cairo_png_sources = cairo-png.c
+
+cairo_ps_headers = cairo-ps.h
+cairo_ps_private = cairo-ps-surface-private.h
+cairo_ps_sources = cairo-ps-surface.c
+
+cairo_pdf_headers = cairo-pdf.h
+cairo_pdf_private = cairo-pdf-surface-private.h
+cairo_pdf_sources = cairo-pdf-surface.c cairo-deflate-stream.c
+
+cairo_svg_headers = cairo-svg.h
+cairo_svg_private = cairo-svg-surface-private.h
+cairo_svg_sources = cairo-svg-surface.c
+
+cairo_ft_headers = cairo-ft.h
+cairo_ft_private = cairo-ft-private.h
+cairo_ft_sources = cairo-ft-font.c
+
+# These are private, even though they look like public headers
+cairo_test_surfaces_private = \
+ test-fallback-surface.h \
+ test-meta-surface.h \
+ test-paginated-surface.h \
+ $(NULL)
+cairo_test_surfaces_sources = \
+ test-fallback-surface.c \
+ test-meta-surface.c \
+ test-paginated-surface.c \
+ $(NULL)
+
+cairo_xlib_headers = cairo-xlib.h
+cairo_xlib_private = \
+ cairo-xlib-private.h \
+ cairo-xlib-surface-private.h \
+ cairo-xlib-xrender-private.h \
+ $(NULL)
+cairo_xlib_sources = \
+ cairo-xlib-display.c \
+ cairo-xlib-screen.c \
+ cairo-xlib-surface.c \
+ cairo-xlib-visual.c \
+ $(NULL)
+
+cairo_xlib_xrender_headers = cairo-xlib-xrender.h
+
+# XXX split xcb-xrender. or better yet, merge it into xcb. xcb is so recent
+# that it's hard to imagine having xcb but not render.
+cairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
+cairo_xcb_sources = cairo-xcb-surface.c
+
+cairo_quartz_headers = cairo-quartz.h
+cairo_quartz_private = cairo-quartz-private.h
+cairo_quartz_sources = cairo-quartz-surface.c
+
+cairo_quratz_image_headers = cairo-quartz-image.h
+cairo_quratz_image_sources = cairo-quartz-image-surface.c
+
+cairo_quartz_font_sources = cairo-quartz-font.c
+
+cairo_win32_headers = cairo-win32.h
+cairo_win32_private = cairo-win32-private.h
+cairo_win32_sources = cairo-win32-surface.c cairo-win32-printing-surface.c
+
+cairo_win32_font_sources = cairo-win32-font.c
+
+cairo_os2_headers = cairo-os2.h
+cairo_os2_private = cairo-os2-private.h
+cairo_os2_sources = cairo-os2-surface.c
+
+# automake is stupid enough to always use c++ linker if we enable the
+# following lines, even if beos surface is not enabled. Disable it for now.
+cairo_beos_headers = cairo-beos.h
+#cairo_beos_sources = cairo-beos-surface.cpp
+
+cairo_glitz_headers = cairo-glitz.h
+cairo_glitz_private = cairo-glitz-private.h
+cairo_glitz_sources = cairo-glitz-surface.c
+
+cairo_directfb_headers = cairo-directfb.h
+cairo_directfb_sources = cairo-directfb-surface.c
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index 53c5a175d..008cc68a3 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -41,6 +41,9 @@
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-truetype-subset-private.h"
#include <string.h>
@@ -2282,3 +2285,5 @@ _cairo_cff_fallback_fini (cairo_cff_subset_t *subset)
free (subset->widths);
free (subset->data);
}
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h
index 2e1eabd66..36c0fbdcf 100644
--- a/src/cairo-clip-private.h
+++ b/src/cairo-clip-private.h
@@ -36,8 +36,11 @@
#ifndef CAIRO_CLIP_PRIVATE_H
#define CAIRO_CLIP_PRIVATE_H
+#include "cairo-types-private.h"
#include "cairo-compiler-private.h"
#include "cairo-path-fixed-private.h"
+#include "cairo-reference-count-private.h"
+#include "cairo-region-private.h"
extern const cairo_private cairo_rectangle_list_t _cairo_rectangles_nil;
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index 6c14048a8..295b5875b 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -38,7 +38,9 @@
#ifndef CAIRO_COMPILER_PRIVATE_H
#define CAIRO_COMPILER_PRIVATE_H
-CAIRO_BEGIN_DECLS
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
#if __GNUC__ >= 3 && defined(__ELF__) && !defined(__sun)
# define slim_hidden_proto(name) slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private
@@ -126,6 +128,4 @@ CAIRO_BEGIN_DECLS
#define inline __inline__
#endif
-CAIRO_END_DECLS
-
#endif
diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h
index 218c4c009..48791c234 100644
--- a/src/cairo-freelist-private.h
+++ b/src/cairo-freelist-private.h
@@ -23,6 +23,7 @@
#define CAIRO_FREELIST_H
#include "cairo-types-private.h"
+#include "cairo-compiler-private.h"
/* Opaque implementation types. */
typedef struct _cairo_freelist cairo_freelist_t;
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index 9a0ede08b..b927c9418 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -3,6 +3,7 @@
*
* Copyright © 2002 University of Southern California
* Copyright © 2005 Red Hat, Inc.
+ * Copyright © 2007 Adrian Johnson
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -34,6 +35,7 @@
*
* Contributor(s):
* Carl D. Worth <cworth@cworth.org>
+ * Adrian Johnson <ajohnson@redneon.com>
*/
#include "cairoint.h"
@@ -599,3 +601,69 @@ _cairo_lround (double d)
#undef MSW
#undef LSW
}
+
+
+#ifdef _WIN32
+
+#define WIN32_LEAN_AND_MEAN
+/* We require Windows 2000 features such as ETO_PDY */
+#if !defined(WINVER) || (WINVER < 0x0500)
+# define WINVER 0x0500
+#endif
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
+# define _WIN32_WINNT 0x0500
+#endif
+
+#include <windows.h>
+#include <io.h>
+
+/* tmpfile() replacment for Windows.
+ *
+ * On Windows tmpfile() creates the file in the root directory. This
+ * may fail due to unsufficient privileges.
+ */
+FILE *
+_cairo_win32_tmpfile (void)
+{
+ DWORD path_len;
+ WCHAR path_name[MAX_PATH + 1];
+ WCHAR file_name[MAX_PATH + 1];
+ HANDLE handle;
+ int fd;
+ FILE *fp;
+
+ path_len = GetTempPathW (MAX_PATH, path_name);
+ if (path_len <= 0 || path_len >= MAX_PATH)
+ return NULL;
+
+ if (GetTempFileNameW (path_name, L"ps_", 0, file_name) == 0)
+ return NULL;
+
+ handle = CreateFileW (file_name,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE,
+ NULL);
+ if (handle == INVALID_HANDLE_VALUE) {
+ DeleteFileW (file_name);
+ return NULL;
+ }
+
+ fd = _open_osfhandle((intptr_t) handle, 0);
+ if (fd < 0) {
+ CloseHandle (handle);
+ return NULL;
+ }
+
+ fp = fdopen(fd, "w+b");
+ if (fp == NULL) {
+ _close(fd);
+ return NULL;
+ }
+
+ return fp;
+}
+
+#endif /* _WIN32 */
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index db3393a6c..db65bd188 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -45,10 +45,6 @@
#include "config.h"
#endif
-#include "cairo-features.h"
-
-CAIRO_BEGIN_DECLS
-
/* A fully qualified no-operation statement */
#define CAIRO_MUTEX_IMPL_NOOP do {/*no-op*/} while (0)
@@ -221,6 +217,4 @@ CAIRO_BEGIN_DECLS
#endif
-CAIRO_END_DECLS
-
#endif
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 61b87d7ad..d4bf68b13 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -41,6 +41,10 @@
#ifndef CAIRO_MUTEX_PRIVATE_H
#define CAIRO_MUTEX_PRIVATE_H
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "cairo-mutex-type-private.h"
CAIRO_BEGIN_DECLS
diff --git a/src/cairo-mutex-type-private.h b/src/cairo-mutex-type-private.h
index d8079a34a..2314be1d0 100644
--- a/src/cairo-mutex-type-private.h
+++ b/src/cairo-mutex-type-private.h
@@ -41,12 +41,6 @@
#ifndef CAIRO_MUTEX_TYPE_PRIVATE_H
#define CAIRO_MUTEX_TYPE_PRIVATE_H
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "cairo-features.h"
-
#include "cairo-compiler-private.h"
#include "cairo-mutex-impl-private.h"
diff --git a/src/cairo-output-stream-private.h b/src/cairo-output-stream-private.h
index 15cd2c03b..37239f264 100644
--- a/src/cairo-output-stream-private.h
+++ b/src/cairo-output-stream-private.h
@@ -39,6 +39,10 @@
#include "cairo-compiler-private.h"
#include "cairo-types-private.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
typedef cairo_status_t (*cairo_output_stream_write_func_t) (cairo_output_stream_t *output_stream,
const unsigned char *data,
unsigned int length);
diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h
index 9fcb2e18b..4a5990d48 100644
--- a/src/cairo-path-fixed-private.h
+++ b/src/cairo-path-fixed-private.h
@@ -36,6 +36,8 @@
#ifndef CAIRO_PATH_FIXED_PRIVATE_H
#define CAIRO_PATH_FIXED_PRIVATE_H
+#include "cairo-types-private.h"
+
enum cairo_path_op {
CAIRO_PATH_OP_MOVE_TO = 0,
CAIRO_PATH_OP_LINE_TO = 1,
diff --git a/src/cairo-pdf-operators-private.h b/src/cairo-pdf-operators-private.h
index 1c23da5ae..a85839bb1 100644
--- a/src/cairo-pdf-operators-private.h
+++ b/src/cairo-pdf-operators-private.h
@@ -162,5 +162,4 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators,
cairo_bool_t backward,
cairo_scaled_font_t *scaled_font);
-
#endif /* CAIRO_PDF_OPERATORS_H */
diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index 472937537..435503cab 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -40,6 +40,9 @@
*/
#include "cairoint.h"
+
+#if CAIRO_HAS_PDF_OPERATORS
+
#include "cairo-pdf-operators-private.h"
#include "cairo-path-fixed-private.h"
#include "cairo-output-stream-private.h"
@@ -1425,3 +1428,5 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators,
return _cairo_output_stream_get_status (pdf_operators->stream);
}
+
+#endif /* CAIRO_HAS_PDF_OPERATORS */
diff --git a/src/cairo-ps-surface-private.h b/src/cairo-ps-surface-private.h
index 95a5dc55f..79ac983ae 100644
--- a/src/cairo-ps-surface-private.h
+++ b/src/cairo-ps-surface-private.h
@@ -46,6 +46,8 @@
#include "cairo-surface-private.h"
#include "cairo-pdf-operators-private.h"
+#include <time.h>
+
typedef struct cairo_ps_surface {
cairo_surface_t base;
diff --git a/src/cairo-reference-count-private.h b/src/cairo-reference-count-private.h
index aef8a1f83..8dbc1abcd 100644
--- a/src/cairo-reference-count-private.h
+++ b/src/cairo-reference-count-private.h
@@ -37,6 +37,10 @@
#ifndef CAIRO_REFRENCE_COUNT_PRIVATE_H
#define CAIRO_REFRENCE_COUNT_PRIVATE_H
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "cairo-atomic-private.h"
CAIRO_BEGIN_DECLS
diff --git a/src/cairo-region-private.h b/src/cairo-region-private.h
index 53c1e8a05..1902500de 100644
--- a/src/cairo-region-private.h
+++ b/src/cairo-region-private.h
@@ -40,6 +40,7 @@
#include <pixman.h>
#include "cairo-compiler-private.h"
+#include "cairo-types-private.h"
/* #cairo_region_t is defined in cairoint.h */
diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h
index e87731812..c7991a7e9 100644
--- a/src/cairo-scaled-font-subsets-private.h
+++ b/src/cairo-scaled-font-subsets-private.h
@@ -39,6 +39,8 @@
#include "cairoint.h"
+#if CAIRO_HAS_FONT_SUBSET
+
typedef struct _cairo_scaled_font_subsets_glyph {
unsigned int font_id;
unsigned int subset_id;
@@ -421,6 +423,9 @@ typedef struct _cairo_type1_subset {
unsigned long trailer_length;
} cairo_type1_subset_t;
+
+#if CAIRO_HAS_FT_FONT
+
/**
* _cairo_type1_subset_init:
* @type1_subset: a #cairo_type1_subset_t to initialize
@@ -454,6 +459,9 @@ _cairo_type1_subset_init (cairo_type1_subset_t *type_subset,
cairo_private void
_cairo_type1_subset_fini (cairo_type1_subset_t *subset);
+#endif /* CAIRO_HAS_FT_FONT */
+
+
/**
* _cairo_type1_scaled_font_is_type1:
* @scaled_font: a #cairo_scaled_font_t
@@ -592,4 +600,6 @@ _cairo_truetype_index_to_ucs4 (cairo_scaled_font_t *scaled_font,
unsigned long index,
uint32_t *ucs4);
+#endif /* CAIRO_HAS_FONT_SUBSET */
+
#endif /* CAIRO_SCALED_FONT_SUBSETS_PRIVATE_H */
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index f4ba92659..9d951441a 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -42,6 +42,9 @@
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-user-font-private.h"
@@ -1014,3 +1017,5 @@ CLEANUP_HASH:
return status;
}
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-truetype-subset-private.h b/src/cairo-truetype-subset-private.h
index e4be77ce1..397a9f389 100644
--- a/src/cairo-truetype-subset-private.h
+++ b/src/cairo-truetype-subset-private.h
@@ -39,6 +39,8 @@
#include "cairoint.h"
+#if CAIRO_HAS_FONT_SUBSET
+
/* The structs defined here should strictly follow the TrueType
* specification and not be padded. We use only 16-bit integer
* in their definition to guarantee that. The fields of type
@@ -192,4 +194,6 @@ typedef struct _tt_glyph_data {
tt_composite_glyph_t glyph;
} tt_glyph_data_t;
+#endif /* CAIRO_HAS_FONT_SUBSET */
+
#endif /* CAIRO_TRUETYPE_SUBSET_PRIVATE_H */
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 892ce412d..20bb7c67f 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -43,6 +43,8 @@
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-truetype-subset-private.h"
@@ -1323,3 +1325,5 @@ cleanup:
return status;
}
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index 539ddf227..75503103a 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -35,6 +35,9 @@
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-type1-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-path-fixed-private.h"
@@ -873,3 +876,5 @@ _cairo_type2_charstrings_fini (cairo_type2_charstrings_t *type2_subset)
free (type2_subset->widths);
}
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-type1-private.h b/src/cairo-type1-private.h
index ae28e058d..171c22490 100644
--- a/src/cairo-type1-private.h
+++ b/src/cairo-type1-private.h
@@ -36,10 +36,16 @@
#ifndef CAIRO_TYPE1_PRIVATE_H
#define CAIRO_TYPE1_PRIVATE_H
+#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
/* Magic constants for the type1 eexec encryption */
#define CAIRO_TYPE1_ENCRYPT_C1 ((unsigned short) 52845)
#define CAIRO_TYPE1_ENCRYPT_C2 ((unsigned short) 22719)
#define CAIRO_TYPE1_PRIVATE_DICT_KEY ((unsigned short) 55665)
#define CAIRO_TYPE1_CHARSTRING_KEY ((unsigned short) 4330)
+#endif /* CAIRO_HAS_FONT_SUBSET */
+
#endif /* CAIRO_TYPE1_PRIVATE_H */
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index b51418186..8e1d3292a 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -38,13 +38,19 @@
* http://partners.adobe.com/public/developer/en/font/T1_SPEC.PDF
*/
+
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-type1-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-output-stream-private.h"
/* XXX: Eventually, we need to handle other font backends */
+#if CAIRO_HAS_FT_FONT
+
#include "cairo-ft-private.h"
#include <ft2build.h>
@@ -1405,3 +1411,7 @@ _cairo_type1_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font)
return is_type1;
}
+
+#endif /* CAIRO_HAS_FT_FONT */
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-type3-glyph-surface-private.h b/src/cairo-type3-glyph-surface-private.h
index 698198864..47aba01c8 100644
--- a/src/cairo-type3-glyph-surface-private.h
+++ b/src/cairo-type3-glyph-surface-private.h
@@ -37,6 +37,10 @@
#ifndef CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H
#define CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H
+#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-surface-private.h"
#include "cairo-pdf-operators-private.h"
@@ -71,4 +75,6 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
cairo_box_t *bbox,
double *width);
+#endif /* CAIRO_HAS_FONT_SUBSET */
+
#endif /* CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H */
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index eab756e3e..4c3afb40a 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -35,6 +35,9 @@
*/
#include "cairoint.h"
+
+#if CAIRO_HAS_FONT_SUBSET
+
#include "cairo-type3-glyph-surface-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-meta-surface-private.h"
@@ -443,3 +446,5 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
return status;
}
+
+#endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index f2a6f6312..91bfa8a5d 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -45,17 +45,27 @@
#include "cairo-fixed-type-private.h"
typedef struct _cairo_array cairo_array_t;
-typedef struct _cairo_hash_table cairo_hash_table_t;
typedef struct _cairo_cache cairo_cache_t;
-typedef struct _cairo_hash_entry cairo_hash_entry_t;
-typedef struct _cairo_surface_backend cairo_surface_backend_t;
typedef struct _cairo_clip cairo_clip_t;
+typedef struct _cairo_clip_path cairo_clip_path_t;
+typedef struct _cairo_color cairo_color_t;
+typedef struct _cairo_font_face_backend cairo_font_face_backend_t;
+typedef struct _cairo_gstate cairo_gstate_t;
+typedef struct _cairo_hash_entry cairo_hash_entry_t;
+typedef struct _cairo_hash_table cairo_hash_table_t;
+typedef struct _cairo_image_surface cairo_image_surface_t;
typedef struct _cairo_output_stream cairo_output_stream_t;
-typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
typedef struct _cairo_paginated_surface_backend cairo_paginated_surface_backend_t;
+typedef struct _cairo_path_fixed cairo_path_fixed_t;
+typedef struct _cairo_rectangle_int16 cairo_glyph_size_t;
+typedef struct _cairo_region cairo_region_t;
typedef struct _cairo_scaled_font_backend cairo_scaled_font_backend_t;
-typedef struct _cairo_font_face_backend cairo_font_face_backend_t;
+typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
+typedef struct _cairo_solid_pattern cairo_solid_pattern_t;
+typedef struct _cairo_surface_backend cairo_surface_backend_t;
+typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
+
typedef cairo_array_t cairo_user_data_array_t;
/**
@@ -156,8 +166,6 @@ typedef enum _cairo_internal_surface_type {
CAIRO_INTERNAL_SURFACE_TYPE_TYPE3_GLYPH
} cairo_internal_surface_type_t;
-typedef struct _cairo_region cairo_region_t;
-
typedef struct _cairo_point {
cairo_fixed_t x;
cairo_fixed_t y;
@@ -199,8 +207,6 @@ struct _cairo_rectangle_int32 {
uint32_t width, height;
};
-typedef struct _cairo_rectangle_int16 cairo_glyph_size_t;
-
struct _cairo_point_int16 {
int16_t x, y;
};
@@ -233,13 +239,11 @@ typedef enum _cairo_direction {
CAIRO_DIRECTION_REVERSE
} cairo_direction_t;
-typedef struct _cairo_path_fixed cairo_path_fixed_t;
typedef enum _cairo_clip_mode {
CAIRO_CLIP_MODE_PATH,
CAIRO_CLIP_MODE_REGION,
CAIRO_CLIP_MODE_MASK
} cairo_clip_mode_t;
-typedef struct _cairo_clip_path cairo_clip_path_t;
typedef struct _cairo_edge {
cairo_line_t edge;
@@ -292,9 +296,6 @@ typedef struct _cairo_pen {
cairo_pen_vertex_t vertices_embedded[32];
} cairo_pen_t;
-typedef struct _cairo_color cairo_color_t;
-typedef struct _cairo_image_surface cairo_image_surface_t;
-
typedef struct _cairo_stroke_style {
double line_width;
cairo_line_cap_t line_cap;
diff --git a/src/cairo-user-font-private.h b/src/cairo-user-font-private.h
index d75c24b68..2a39ff97a 100644
--- a/src/cairo-user-font-private.h
+++ b/src/cairo-user-font-private.h
@@ -38,6 +38,7 @@
#define CAIRO_USER_FONT_PRIVATE_H
#include "cairo.h"
+#include "cairo-compiler-private.h"
cairo_private cairo_bool_t
_cairo_font_face_is_user (cairo_font_face_t *font_face);
diff --git a/src/cairo-win32.c b/src/cairo-win32.c
deleted file mode 100644
index a656ff8e6..000000000
--- a/src/cairo-win32.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
-/* Cairo - a vector graphics library with display and print output
- *
- * Copyright © 2007 Adrian Johnson
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Adrian Johnson.
- *
- * Contributor(s):
- * Adrian Johnson <ajohnson@redneon.com>
- */
-
-#define WIN32_LEAN_AND_MEAN
-/* We require Windows 2000 features such as ETO_PDY */
-#if !defined(WINVER) || (WINVER < 0x0500)
-# define WINVER 0x0500
-#endif
-#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
-# define _WIN32_WINNT 0x0500
-#endif
-
-#include "cairoint.h"
-
-#include <windows.h>
-#include <io.h>
-
-/* tmpfile() replacment for Windows.
- *
- * On Windows tmpfile() creates the file in the root directory. This
- * may fail due to unsufficient privileges.
- */
-FILE *
-_cairo_win32_tmpfile (void)
-{
- DWORD path_len;
- WCHAR path_name[MAX_PATH + 1];
- WCHAR file_name[MAX_PATH + 1];
- HANDLE handle;
- int fd;
- FILE *fp;
-
- path_len = GetTempPathW (MAX_PATH, path_name);
- if (path_len <= 0 || path_len >= MAX_PATH)
- return NULL;
-
- if (GetTempFileNameW (path_name, L"ps_", 0, file_name) == 0)
- return NULL;
-
- handle = CreateFileW (file_name,
- GENERIC_READ | GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE,
- NULL);
- if (handle == INVALID_HANDLE_VALUE) {
- DeleteFileW (file_name);
- return NULL;
- }
-
- fd = _open_osfhandle((intptr_t) handle, 0);
- if (fd < 0) {
- CloseHandle (handle);
- return NULL;
- }
-
- fp = fdopen(fd, "w+b");
- if (fp == NULL) {
- _close(fd);
- return NULL;
- }
-
- return fp;
-}
diff --git a/src/cairo-xlib-xrender-private.h b/src/cairo-xlib-xrender-private.h
index a61a67e52..329262c77 100644
--- a/src/cairo-xlib-xrender-private.h
+++ b/src/cairo-xlib-xrender-private.h
@@ -33,6 +33,11 @@
#ifndef CAIRO_XLIB_XRENDER_PRIVATE_H
#define CAIRO_XLIB_XRENDER_PRIVATE_H
+#include "cairo-features.h"
+#include "cairo-compiler-private.h"
+
+#include <X11/Xlib.h>
+
#if CAIRO_HAS_XLIB_XRENDER_SURFACE
#include "cairo-xlib-xrender.h"
@@ -52,7 +57,7 @@
* take a pointer as first argument */
__attribute__((__unused__)) static void _void_consume (void *p, ...) { }
-__attribute__((__unused__)) static void * _voidp_consume (void *p, ...) { return NULL; }
+__attribute__((__unused__)) static void * _voidp_consume (void *p, ...) { return (void *)0; }
__attribute__((__unused__)) static int _int_consume (void *p, ...) { return 0; }
__attribute__((__unused__)) static void _void_consume_free (Display *p, XID n) { }
diff --git a/src/cairoint.h b/src/cairoint.h
index 698654629..bffceb3e0 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -75,6 +75,14 @@
#include "cairo-compiler-private.h"
+#if defined(CAIRO_HAS_PS_SURFACE) || defined(CAIRO_HAS_PDF_SURFACE) || defined(CAIRO_HAS_SVG_SURFACE)
+#define CAIRO_HAS_FONT_SUBSET 1
+#endif
+
+#if defined(CAIRO_HAS_PS_SURFACE) || defined(CAIRO_HAS_PDF_SURFACE)
+#define CAIRO_HAS_PDF_OPERATORS 1
+#endif
+
CAIRO_BEGIN_DECLS
#ifdef _WIN32
@@ -316,8 +324,6 @@ _cairo_user_data_array_set_data (cairo_user_data_array_t *array,
cairo_private unsigned long
_cairo_hash_string (const char *c);
-typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
-
/*
* A #cairo_unscaled_font_t is just an opaque handle we use in the
* glyph cache.
@@ -504,8 +510,6 @@ extern const cairo_private struct _cairo_scaled_font_backend _cairo_quartz_scale
#endif
-typedef struct _cairo_solid_pattern cairo_solid_pattern_t;
-
struct _cairo_surface_backend {
cairo_surface_type_t type;
@@ -972,8 +976,6 @@ typedef struct _cairo_traps {
#define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
#define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
-typedef struct _cairo_gstate cairo_gstate_t;
-
typedef struct _cairo_stroke_face {
cairo_point_t ccw;
cairo_point_t point;
diff --git a/src/check-doc-syntax.sh b/src/check-doc-syntax.sh
index bd07c4d19..98ea61e94 100755
--- a/src/check-doc-syntax.sh
+++ b/src/check-doc-syntax.sh
@@ -17,7 +17,7 @@ echo Checking documentation for incorrect syntax
# Note: this test is also run from doc/public/ to check the SGML files
if test "x$SGML_DOCS" = x; then
- FILES=$cairo_all_source_files
+ FILES=$all_cairo_files
if test "x$FILES" = x; then
FILES=`find "$srcdir" -name '*.h' -or -name '*.c' -or -name '*.cpp'`
fi