<project name="cairo" default="dist" basedir=".">
    <description>
        Build file for the Cairo 2D graphics library
    </description>

  <!-- set global properties for this build -->
  <property name="version"     location="1.3.2"/>
  <property name="src"         location="src"/>
  <property name="gtk"         location="c:/gtk210"/>
  <property name="lib"         location="lib"/>
  <property name="build"       location="build"/>
  <property name="dist"        location="cairo"/>

  <target name="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${dist}"/>
    <makefile file="config.h">
        /* config.h.  Generated from config.h.in by configure.  */
        /* config.h.in.  Generated from configure.in by autoheader.  */
        
        /* define if glitz backend can be tested against agl */
        /* #undef CAIRO_CAN_TEST_GLITZ_AGL_SURFACE */
        
        /* define if glitz backend can be tested against egl */
        /* #undef CAIRO_CAN_TEST_GLITZ_EGL_SURFACE */
        
        /* define if glitz backend can be tested against glx */
        /* #undef CAIRO_CAN_TEST_GLITZ_GLX_SURFACE */
        
        /* define if glitz backend can be tested against wgl */
        /* #undef CAIRO_CAN_TEST_GLITZ_WGL_SURFACE */
        
        /* Define to 1 if the PDF backend can be tested (need poppler and other
           dependencies for pdf2png) */
        /* #undef CAIRO_CAN_TEST_PDF_SURFACE */
        
        /* Define to 1 if the SVG backend can be tested */
        /* #undef CAIRO_CAN_TEST_SVG_SURFACE */
        
        /* define in the extra test surface have been built into cairo for the test
           suite */
        /* #undef CAIRO_HAS_TEST_SURFACES */
        
        /* Define to 1 if your system stores words within floats with the most
           significant word first */
        /* #undef FLOAT_WORDS_BIGENDIAN */
        
        /* Define to 1 if you have the &lt;dlfcn.h&gt; header file. */
        /* #undef HAVE_DLFCN_H */
        
        /* Define to 1 if you have the `FcFini' function. */
        /* #undef HAVE_FCFINI */
        
        /* FT_Bitmap_Size structure includes y_ppem field */
        #define HAVE_FT_BITMAP_SIZE_Y_PPEM 1
        
        /* Define to 1 if you have the `FT_GlyphSlot_Embolden' function. */
        #define HAVE_FT_GLYPHSLOT_EMBOLDEN 1
        
        /* Define to 1 if you have the `FT_Load_Sfnt_Table' function. */
        #define HAVE_FT_LOAD_SFNT_TABLE 1
        
        /* Whether you have gcov */
        /* #undef HAVE_GCOV */
        
        /* Define to 1 if you have the &lt;inttypes.h&gt; header file. */
        #define HAVE_INTTYPES_H 1
        
        /* Define to 1 if you have the &lt;memory.h&gt; header file. */
        #define HAVE_MEMORY_H 1
        
        /* Define to 1 if you have the &lt;pthread.h&gt; header file. */
        /* #undef HAVE_PTHREAD_H */
        
        /* Define to 1 if you have the &lt;signal.h&gt; header file. */
        #define HAVE_SIGNAL_H 1
        
        /* Define to 1 if you have the &lt;stdint.h&gt; header file. */
        #define HAVE_STDINT_H 1
        
        /* Define to 1 if you have the &lt;stdlib.h&gt; header file. */
        #define HAVE_STDLIB_H 1
        
        /* Define to 1 if you have the &lt;strings.h&gt; header file. */
        #define HAVE_STRINGS_H 1
        
        /* Define to 1 if you have the &lt;string.h&gt; header file. */
        #define HAVE_STRING_H 1
        
        /* Define to 1 if you have the &lt;sys/int_types.h&gt; header file. */
        /* #undef HAVE_SYS_INT_TYPES_H */
        
        /* Define to 1 if you have the &lt;sys/stat.h&gt; header file. */
        #define HAVE_SYS_STAT_H 1
        
        /* Define to 1 if you have the &lt;sys/types.h&gt; header file. */
        #define HAVE_SYS_TYPES_H 1
        
        /* Define to 1 if the system has the type `uint128_t'. */
        /* #undef HAVE_UINT128_T */
        
        /* Define to 1 if the system has the type `uint64_t'. */
        #define HAVE_UINT64_T 1
        
        /* Define to 1 if you have the &lt;unistd.h&gt; header file. */
        #define HAVE_UNISTD_H 1
        
        /* Define to 1 if you have the `vasnprintf' function. */
        /* #undef HAVE_VASNPRINTF */
        
        /* Define to 1 if you have the `XrmFinalize' function. */
        /* #undef HAVE_XRMFINALIZE */
        
        /* Name of package */
        #define PACKAGE "cairo"
        
        /* Define to the address where bug reports for this package should be sent. */
        #define PACKAGE_BUGREPORT "http://bugs.freedesktop.org/enter_bug.cgi?product=cairo"
        
        /* Define to the full name of this package. */
        #define PACKAGE_NAME "cairo"
        
        /* Define to the full name and version of this package. */
        #define PACKAGE_STRING "cairo ${version}"
        
        /* Define to the one symbol short name of this package. */
        #define PACKAGE_TARNAME "cairo"
        
        /* Define to the version of this package. */
        #define PACKAGE_VERSION "${version}"
        
        /* Define to 1 if you have the ANSI C header files. */
        #define STDC_HEADERS 1
        
        /* use MMX compiler intrinsics */
        /* #undef USE_MMX */
        
        /* Version number of package */
        #define VERSION "${version}"
        
        /* Define to 1 if your processor stores words with the most significant byte
           first (like Motorola and SPARC, unlike Intel and VAX). */
        /* #undef WORDS_BIGENDIAN */
        
        /* Define to 1 if the X Window System is missing or not being used. */
        #define X_DISPLAY_MISSING 1

    </makefile>
    <makefile file="src/cairo-features.h">
        /* Generated by configure.  Do not edit */
        #ifndef CAIRO_FEATURES_H
        #define CAIRO_FEATURES_H
        
        #ifdef  __cplusplus
        # define CAIRO_BEGIN_DECLS  extern "C" {
        # define CAIRO_END_DECLS    }
        #else
        # define CAIRO_BEGIN_DECLS
        # define CAIRO_END_DECLS
        #endif
        
        #ifndef cairo_public
        # define cairo_public
        #endif
        
        #define CAIRO_VERSION_MAJOR 1
        #define CAIRO_VERSION_MINOR 3
        #define CAIRO_VERSION_MICRO 2
        
        #define CAIRO_VERSION_STRING "1.3.2"
        
        #define CAIRO_HAS_PDF_SURFACE 1
        #define CAIRO_HAS_PS_SURFACE 1
        #define CAIRO_HAS_SVG_SURFACE 1
        #define CAIRO_HAS_FT_FONT 1
        #define CAIRO_HAS_PNG_FUNCTIONS 1
        #define CAIRO_HAS_WIN32_FONT 1
        #define CAIRO_HAS_WIN32_SURFACE 1
        
        #endif

    </makefile>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile from source to build -->
    <cc cc="gcc" cxx="g++" destdir="${build}/obj">
	    <fileset dir=".">
            <!-- THINGS TO INCLUDE -->
            <include name="src/.*"/>
            <include name="pixman/.*"/>
            <!-- THINGS TO EXCLUDE -->
	        <exclude name="src/cairo-beos-surface.cpp"/>
	        <exclude name="src/cairo-atsui-font.c"/>
	        <exclude name="src/cairo-directfb-surface.c"/>
	        <exclude name="src/cairo-glitz-surface.c"/>
	        <exclude name="src/cairo-nquartz-surface.c"/>
	        <exclude name="src/cairo-os2-surface.c"/>
	        <exclude name="src/cairo-quartz-surface.c"/>
	        <exclude name="src/cairo-xcb-surface.c"/>
	        <exclude name="src/cairo-xlib-screen.c"/>
	        <exclude name="src/cairo-xlib-surface.c"/>
	        <exclude name="src/test.*"/>
	        <exclude name="pixman/src/fbmmx.c"/>
	    </fileset>
        <flags>
            -Wall -g -O3
			-mms-bitfields
        </flags>
        <defines>
            -DHAVE_CONFIG_H
        </defines>
        <includes>
            -I${gtk}/include
            -I${gtk}/include/freetype2
        </includes>
	</cc>
  </target>
  
  <target name="lib" depends="compile">
    <!--
    <staticlib file="${build}/libcairo.a">
	   <fileset dir="${build}/obj">
	   </fileset>
	</staticlib>
	-->
    <sharedlib file="${build}/libcairo-2.dll"
             def="${src}/cairo.def"
             import="${build}/libcairo.dll.a">
	   <fileset dir="${build}/obj">
	   </fileset>
	   <libs>
        -mwindows -L${gtk}/lib
       -lpng13 -lfreetype.dll
        -lfontconfig  -lz -lm
	   </libs>
	</sharedlib>
  </target>


  <target name="test" depends="lib">
     <!--
     <link out="test/test.exe">
         <fileset dir=".">
             <include name="test/cairo-test.c"/>
             <include name="${build}/libcairo.dll.a"/>
         </fileset>
         <flags>
             -D_MSC_VER -I${src} -Iboilerplate
         </flags>
     </link>
     -->
  </target>

  <target name="dist" depends="test"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <copy file="${build}/libcairo.dll.a" todir="${dist}/lib"/>
    <copy file="${build}/libcairo-2.dll" todir="${dist}/bin"/>

    <!-- include files -->
    <copy file="${src}/cairo.h"            todir="${dist}/include"/>
    <copy file="${src}/cairo-deprecated.h" todir="${dist}/include"/>
    <copy file="${src}/cairo-features.h"   todir="${dist}/include"/>
    <copy file="${src}/cairo-ft.h"         todir="${dist}/include"/>
    <copy file="${src}/cairo-pdf.h"        todir="${dist}/include"/>
    <copy file="${src}/cairo-ps.h"         todir="${dist}/include"/>
    <copy file="${src}/cairo-svg.h"        todir="${dist}/include"/>
    <copy file="${src}/cairo-win32.h"      todir="${dist}/include"/>

  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

