<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant build for JOGL.  This build has been tested with ANT 1.5.3.  The
   - optional.jar that contains the optional ANT tasks must be in the ANT
   - classpath (typically the ant/lib directory).
   -
   - A clean download of JOGL is required for this build.
   -
   - This build has no dependence on environment variables; the needed
   - ones (e.g. java.home, ANT_HOME) are all set by the Ant wrapper shell
   - script, by the virtual machine, or elsewhere. However, on all platforms,
   - the C compiler and linker should be in the path. All other paths that
   - need to be set are in host.properties.
   -
   - NOTE:  because the GlueGen config files have their own relative paths
   -        which cannot be overridden by GlueGen, GlueGen MUST be run from
   -        the "make" directory. This also means that this build.xml MUST
   -        be run from the "make" directory.
   -
   - Public targets:
   -   all: (default; autodetects OS and chooses C compiler from jogl.properties)
   -   clean:        clean all built
   -   javadoc:      create the standard developer Javadoc (recommended)
   -                 (Note: should build all first - may be dependence in the future)
   -   javadoc.spec:   create the standard developer Javadoc but exclude com.sun.* classes
   -   javadoc.dev.win32:
   -   javadoc.dev.x11:
   -   javadoc.dev.macosx: create the internal developer Javadoc.  This includes the
   -                       Java and C file generators. Note that it is only supported
   -                       to create the Javadoc for the platform on which you are
   -                       currently running.
   - 
   - Note: on Windows the "win32.c.compiler" property in jogl.properties
   - is required to select the appropriate C compiler. See the example
   - jogl.properties in this directory for valid values. On Mac OS X
   - universal binaries may also be built by setting the "macosxfat"
   - property in jogl.properties; again see the example file in this
   - directory.
   -   
   - Optional properties:
   -   -Djogl.cg=1 when combined with the build or javadoc targets will cause
   -   the experimental binding to NVidia's Cg language to be built.
   -
   - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the
   - ANT build, including the GlueGen and StaticGLInfo tasks, the building of
   - the Java generated sources, the first and second phase Java compiles, and
   - the building of the jar file. Thanks to Alex Radeski for the bulk of the
   - port to the ant-contrib CPPTask framework. Thanks to Athomas Goldberg for
   - the original OS detection code.
   -->
<project name="JOGL" basedir="." default="all">

  <!-- This is the version of JOGL you are building -->
  <property name="base_version" value="1.1.1"/>
    
  <!-- Uncomment this property definition to cause a full release build to be done -->
  <!-- without needing to specify the RI target on the command line  -->
  <property name="RImanifestfile" value="joglRIversion" />

  <!-- Pull in GlueGen cpptasks build file -->
  <property name="gluegen.root" value="../../gluegen" />
  <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />

    <!-- ================================================================== -->
    <!-- 
       - Base initialization and detection of operating system.
      -->
    <target name="base.init" depends="gluegen.cpptasks.detect.os">
        <!-- Set the project root directory to be up one directory. -->
        <property name="project.root" value=".." />
    
        <!-- Set the configuration and build files to this directory. -->
        <property name="make" value="." />
    </target>

    <target name="base.init.sourcelevel.1" unless="gluegen.nsig">
        <property name="jogl.sourcelevel" value="1.4" />
    </target>

    <target name="base.init.sourcelevel.2" if="gluegen.nsig">
        <property name="jogl.sourcelevel" value="1.5" />
    </target>

   <!-- On jpackage.org-compatible systems, antlr.jar can be found in /usr/share/java -->
   <available property="antlr.jar" file="/usr/share/java/antlr.jar"
              value="/usr/share/java/antlr.jar"/>

    <!-- ================================================================== -->
    <!-- 
       - Load user properties which override build defaults.
      -->
    <target name="load.user.properties" depends="base.init,base.init.sourcelevel.1,base.init.sourcelevel.2" unless="user.properties.file">
        <!-- Load the user specified properties file that defines various host
           - specific paths.  The user will be notified if this is does not
           - exist. -->
        <property name="user.properties.file" value="${user.home}/jogl.properties" />
        <property file="${user.properties.file}" />
        <echo message="Loaded ${user.properties.file}." />
        <property file="${user.home}/gluegen.properties" />
        <echo message="Loaded ${user.home}/gluegen.properties." />
        <fail message="antlr.jar was not specified in jogl.properties or gluegen.properties. Please see README.txt for instructions" unless="antlr.jar"/>
        <echo message="antlr.jar=${antlr.jar}" />
    </target>

    <!-- ================================================================== -->
    <!-- 
       - Set up java.home.dir appropriately on all platforms.
      -->
    <target name="setup.java.home.dir.nonmacosx" depends="load.user.properties" unless="isOSX">
      <!-- java home dir is up one directory as java.home points to '<java-install-dir>/jre' -->
      <property name="java.home.dir" value="${java.home}/.." />
    </target>
    <target name="setup.java.home.dir.macosx" depends="load.user.properties" if="isOSX">
      <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" />
    </target>
    <target name="setup.java.home.dir" depends="setup.java.home.dir.nonmacosx,setup.java.home.dir.macosx"/>

    <!-- ================================================================== -->
    <!-- 
       - Declare all paths and user defined variables.
      -->
    <target name="declare.common" description="Declare properties" depends="setup.java.home.dir, gluegen.cpptasks.detect.compiler">
        <!-- The location and name of the configuration ANT file that will 
           - validate to ensure that all user-define variables are set. -->
        <property name="validate.user.properties" value="${make}/validate-properties.xml" />
           
        <!-- GlueGen properties. -->
        <!-- NOTE that these require a checked-out GlueGen workspace as a -->
        <!-- sibling of the JOGL workspace. -->
        <property name="gluegen.make.dir" value="../../gluegen/make" />
        <property name="gluegen.build.xml" value="${gluegen.make.dir}/build.xml" />
        <property name="gluegen.jar" value="../../gluegen/build/gluegen.jar" />
        <property name="gluegen-rt.jar" value="../../gluegen/build/gluegen-rt.jar" />
                                                
        <!-- Names of directories relative to the project root.
             Some of these are used in FileMappers later for dependence information
             and need exact string matching, which is why they use file.separator
             instead of "/". -->
        <property name="rootrel.src.java" value="src/classes" />
        <property name="rootrel.src.c.jogl" value="src/native/jogl" />
        <property name="rootrel.build" value="build" />
        <property name="rootrel.src.generated" value="${rootrel.build}/gensrc" />
        <property name="rootrel.generated.c.jogl" value="${rootrel.src.generated}/native/jogl" />
        <property name="rootrel.generated.c.cg" value="${rootrel.src.generated}/native/jogl_cg" />
        <property name="rootrel.obj" value="${rootrel.build}/obj" />
        <property name="rootrel.obj.jogl" value="${rootrel.obj}/jogl" />
        <property name="rootrel.obj.cg" value="${rootrel.obj}/jogl_cg" />

        <!-- The source directories. -->
        <property name="src.java" value="${project.root}/${rootrel.src.java}" />
        <property name="src.c"    value="${project.root}/${rootrel.src.c}" />
        <property name="build"    value="${project.root}/${rootrel.build}" />
        
        <!-- The generated source directories. -->
        <property name="src.generated" value="${build}/gensrc" />
        <property name="src.generated.java" value="${src.generated}/classes" />
        <property name="src.generated.java.cg" value="${src.generated}/classes/com/sun/opengl/cg" />
        <property name="src.generated.c" value="${src.generated}/native/jogl" />
        <property name="src.generated.c.cg" value="${src.generated}/native/jogl_cg" />
        
        <!-- The compiler output directories. -->
        <property name="classes" value="${build}/classes" />
        <property name="obj"      value="${project.root}/${rootrel.obj}" />
        <property name="obj.jogl" value="${project.root}/${rootrel.obj.jogl}" />
        <property name="obj.cg"   value="${project.root}/${rootrel.obj.cg}" />

        <!-- The GL headers from which Java files are generated -->
        <property name="config" value="${project.root}/make" />
        <property name="stub.includes" value="${config}/stub_includes" />
        <property name="stub.includes.dir" value="stub_includes" /> <!-- NOTE:  this MUST be relative for FileSet -->
        <property name="stub.includes.x11" value="${stub.includes}/x11" />
        <property name="stub.includes.opengl" value="${stub.includes}/opengl" />
        <property name="stub.includes.common" value="${stub.includes}/common" />
        <dirset id="stub.includes.fileset.all" dir=".">
            <include name="${stub.includes.dir}/opengl/**" />
            <include name="${stub.includes.dir}/macosx/**" />
            <include name="${stub.includes.dir}/win32/**" />
            <include name="${stub.includes.dir}/x11/**" />
            <include name="${stub.includes.dir}/common/**" />
        </dirset>
        <fileset id="stub.includes.dependencies.fileset.1" dir="${stub.includes.dir}">
            <include name="opengl/**,macosx/**,win32/**,x11/**,common/**" />
        </fileset>
        <fileset id="stub.includes.dependencies.fileset.2" file="${gluegen.jar}" />
        <fileset id="stub.includes.dependencies.fileset.3" dir=".">
            <include name="*.cfg" />
            <include name="gl*.java" />
            <include name="*.c" />
            <exclude name="cg-common.cfg" />
        </fileset>
        <dirset id="stub.includes.cg.fileset.all" dir=".">
            <include name="${stub.includes.dir}/opengl/**" />
            <include name="${stub.includes.dir}/cg/**" />
            <include name="${stub.includes.dir}/macosx/**" />
            <include name="${stub.includes.dir}/win32/**" />
            <include name="${stub.includes.dir}/x11/**" />
            <include name="${stub.includes.dir}/common/**" />
        </dirset>
        <fileset id="stub.includes.cg.dependencies.fileset" dir=".">
            <include name="${stub.includes.dir}/cg/**" />
            <include name="cg-common.cfg" />
            <include name="cg-common-CustomJavaCode.java" />
        </fileset>

        <property name="java.includes.dir" value="${java.home.dir}/include" /> <!-- NOTE:  this MUST be relative for FileSet -->
        <property name="java.includes.dir.win32" value="${java.includes.dir}/win32" />
        <property name="java.includes.dir.linux" value="${java.includes.dir}/linux" />
        <property name="java.includes.dir.solaris" value="${java.includes.dir}/solaris" />
        <property name="java.includes.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" />
        <property name="java.includes.dir.freebsd" value="${java.includes.dir}/freebsd" />
        <property name="java.includes.dir.hpux" value="${java.includes.dir}/hp-ux" />
        <property name="java.lib.dir.win32" value="${java.home.dir}/lib" />
        <property name="java.lib.dir.linux" value="${java.home.dir}/jre/lib/i386" />
        <property name="java.lib.dir.linux.amd64" value="${java.home.dir}/jre/lib/amd64" />
        <property name="java.lib.dir.linux.ia64" value="${java.home.dir}/jre/lib/ia64" />
        <property name="java.lib.dir.hpux" value="${java.home.dir}/jre/lib/PA_RISC2.0" />
	<condition property="cpu" value="sparc">
            <os name="SunOS" arch="sparc" />
        </condition>
	<condition property="cpu" value="sparcv9">
            <os name="SunOS" arch="sparcv9" />
        </condition>
	<condition property="cpu" value="i386">
            <os name="SunOS" arch="x86" />
        </condition>

	<condition property="cpu" value="amd64">
            <os name="SunOS" arch="amd64" />
        </condition>

        <property name="java.lib.dir.solaris" value="${java.home.dir}/jre/lib/${cpu}" />
        <property name="java.lib.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Libraries" />
        <property name="gl.headers" value="${stub.includes.dir}/opengl/**/*.h" /> <!-- NOTE:  this MUST be relative for FileSet --> <!-- CHECK:  this may need to be pruned for each platform -->

        <!-- Java files to exclude based on platform (relative to "src.java") -->
        <property name="java.excludes.win32" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**" />
        <property name="java.excludes.x11" value="com/sun/opengl/impl/windows/**, com/sun/opengl/impl/macosx/**" />
        <property name="java.excludes.macosx" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/windows/**" />

        <!-- Create the classpath that includes GlueGen and
           - ANTLR. This requires the user-defined "antlr.jar"
           - property. -->
        <path id="gluegen.classpath">
          <pathelement location="${gluegen.jar}" />
          <pathelement location="${antlr.jar}" />
        </path>

        <!-- Create the classpath that includes GlueGen and
           - the current classes for building the composable pipelines.
           -->
        <path id="pipeline.classpath">
          <pathelement location="${gluegen.jar}" />
          <pathelement location="${classes}" />
        </path>

        <!-- The resulting jogl.jar. -->
        <property name="jogl.jar" value="${build}/jogl.jar" />

        <!-- The javadoc dirs. -->
        <property name="javadoc" value="${project.root}/javadoc_public" />
        <property name="javadoc.spec" value="${project.root}/javadoc_spec" />
        <property name="javadoc.dev" value="${project.root}/javadoc_jogl_dev" />
        <property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" />
        <property name="javadoc.windowtitle" value="JOGL API -- JSR-231 ${base_version} Specification" />
        <property name="javadoc.overview" value="spec-overview.html" />
        <property name="javadoc.spec.packagenames" value="javax.media.opengl,javax.media.opengl.glu" />
        <property name="javadoc.packagenames" value="${javadoc.spec.packagenames},com.sun.opengl.util,com.sun.opengl.util.j2d,com.sun.opengl.util.texture,com.sun.opengl.util.texture.spi" />
        <property name="javadoc.dev.packagenames.win32"  value="com.sun.opengl.impl.windows" />
        <property name="javadoc.dev.packagenames.x11"    value="com.sun.opengl.impl.x11" />
        <property name="javadoc.dev.packagenames.macosx" value="com.sun.opengl.impl.macosx" />
        <property name="javadoc.dev.packagenames" value="javax.media.opengl,javax.media.opengl.glu,com.sun.opengl.impl,com.sun.opengl.util,com.sun.gluegen,com.sun.gluegen.runtime" />
	<property name="javadoc.bottom" value="Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to &lt;a href=&quot;http://jcp.org/en/jsr/detail?id=231&quot;&gt;license terms&lt;/a&gt;." />
    </target>
    
    <!-- ================================================================== -->
    <!--
       - Platform specific declares.
      -->
    <target name="declare.win32.vc6" if="isVC6">
      <echo message="Win32.VC6" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.win32.msvc.jogl" />
    </target>
    
    <target name="declare.win32.vc7" if="isVC7">
      <echo message="Win32.VC7" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.win32.msvc.jogl" />
    </target>
    
    <target name="declare.win32.vc8" if="isVC8">
      <echo message="Win32.VC8" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.win32.msvc.jogl" />
    </target>
    
    <target name="declare.win32.vc8_x64" if="isVC8_X64">
      <echo message="Win32.VC8_X64" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.msvc" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.win32.msvc.jogl" />
    </target>
    
    <target name="declare.win32.mingw" if="isMingW">
      <echo message="Win32.MingW" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.win32.mingw" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.win32.mingw.jogl" />
    </target>

    <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.vc8,declare.win32.vc8_x64,declare.win32.mingw" if="isWindows">
        <!-- Set platform configuration files. -->
        <property name="gl.cfg"                                 value="${config}/gl-win32.cfg" />
        <property name="gl.cfg.nsig"                            value="${config}/gl-win32-nsig.cfg" />
        <property name="glext.platform.cfg"                     value="${config}/wglext.cfg" />
        <property name="glu.cfg"                                value="${config}/glu-win32.cfg" />
        <property name="jawt.cfg"                               value="${config}/jawt-win32.cfg" />
        <property name="window.cfg"                             value="${config}/wingdi-win32.cfg" />

        <!-- Set platform headers. -->
        <property name="glext.platform.header"                  value="${stub.includes.dir}/win32/wglext.c" />

        <!-- Set platform directories. -->
        <property name="stub.includes.platform"                 value="${stub.includes}/win32" />
        <property name="java.includes.dir.platform"             value="${java.includes.dir.win32}" />
        <property name="java.lib.dir.platform"                  value="${java.lib.dir.win32}" />
        <property name="java.excludes.platform"                 value="${java.excludes.win32}" />
        <property name="stub.includes.fileset.platform.params"  value="${stub.includes.dir}/win32/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" />

        <!-- Set Javadoc properties. -->
        <property name="javadoc.dev.packagenames.platform"      value="${javadoc.dev.packagenames.win32}" />
    </target>          

    <target name="declare.x11" depends="init" if="isX11">
        <!-- Set platform configuration files. -->
        <property name="gl.cfg"                               value="${config}/gl-x11.cfg" />
        <property name="gl.cfg.nsig"                          value="${config}/gl-x11-nsig.cfg" />
        <property name="glext.platform.cfg"                   value="${config}/glxext.cfg" />
        <property name="glu.cfg"                              value="${config}/glu-x11.cfg" />
        <property name="jawt.cfg"                             value="${config}/jawt-x11.cfg" />
        <property name="window.cfg"                           value="${config}/glx-x11.cfg" />

        <!-- Set platform headers. -->
        <property name="glext.platform.header"                value="${stub.includes.dir}/x11/glxext.c" />

        <!-- Set platform directories. -->
        <property name="stub.includes.platform"               value="${stub.includes.x11}" />
        <property name="java.excludes.platform"               value="${java.excludes.x11}" />
        <property name="stub.includes.fileset.platform.params"  
                  value="${stub.includes.dir}/opengl/** ${stub.includes.dir}/x11/** ${stub.includes.dir}/common/**" />

        <!-- Set Javadoc properties. -->
        <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.x11}" />
    </target>

    <target name="declare.linux.x86" if="isLinuxX86">
      <echo message="Linux.x86" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.linux}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.linux}" />       

      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.linux.jogl" /> 
    </target>
    
    <target name="declare.linux.amd64" if="isLinuxAMD64">
      <echo message="Linux.AMD64" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.linux}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.linux.amd64}" />       

      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.amd64" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.linux.amd64.jogl" /> 
    </target>
    
    <target name="declare.linux.ia64" if="isLinuxIA64">
      <echo message="Linux.IA64" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.linux}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.linux.ia64}" />       

      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.linux.jogl" /> 
    </target>

    <target name="declare.linux" depends="declare.linux.x86,declare.linux.amd64,declare.linux.ia64,declare.x11" if="isLinux" />

    <target name="declare.solaris32" depends="declare.x11" if="isSolaris32Bit">
      <echo message="Solaris" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.solaris}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.solaris}" />

      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.solaris.jogl" /> 
    </target>
  
 
    <target name="declare.solaris.sparcv9" depends="declare.x11" if="isSolarisSparcv9">
      <echo message="SolarisSparcv9" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.solaris}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.solaris}" />

      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.sparcv9" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.solaris.sparcv9.jogl" /> 
    </target>
   

    <target name="declare.solaris.amd64" depends="declare.x11" if="isSolarisAMD64">
      <echo message="SolarisAMD64" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.solaris}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.solaris}" />

      <property name="compiler.cfg.id"                      value="compiler.cfg.solaris.amd64" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.solaris.amd64.jogl" /> 
    </target>
   
 
    <target name="declare.macosx" if="isOSX">
      <echo message="MacOSX" />
      <!-- Set platform configuration files. -->
      <property name="gl.cfg"                               value="${config}/gl-macosx.cfg" />
      <property name="gl.cfg.nsig"                          value="${config}/gl-macosx-nsig.cfg" />
      <property name="glext.platform.cfg"                   value="${config}/cglext.cfg" />
      <property name="glu.cfg"                              value="${config}/glu-macosx.cfg" />
      <property name="jawt.cfg"                             value="${config}/jawt-macosx.cfg" />
      <property name="window.cfg"                           value="${config}/cgl-macosx.cfg" />

      <!-- Set platform headers. -->
      <property name="glext.platform.header"                value="${stub.includes.dir}/macosx/cglext.c" />

      <!-- Set platform directories. -->
      <property name="stub.includes.platform"               value="${stub.includes}/macosx" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.macosx}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.macosx}" />
      <property name="java.excludes.platform"               value="${java.excludes.macosx}" />
      <property name="stub.includes.fileset.platform.params" value="${stub.includes.dir}/macosx/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" />

      <!-- Set Javadoc properties. -->
      <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.macosx}" />

      <property name="compiler.cfg.id"                      value="compiler.cfg.macosx" /> 
      <property name="linker.cfg.id.core"                   value="linker.cfg.macosx.jogl" /> 
    </target>
    
    <target name="declare.freebsd" depends="declare.x11" if="isFreeBSD">
      <echo message="FreeBSD" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.freebsd}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.linux}" />

      <property name="compiler.cfg.id"                      value="compiler.cfg.freebsd.jogl" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.linux.jogl" />
    </target>

    <target name="declare.hpux" depends="declare.x11" if="isHPUX">
      <echo message="HP-UX" />
      <property name="java.includes.dir.platform"           value="${java.includes.dir.hpux}" />
      <property name="java.lib.dir.platform"                value="${java.lib.dir.hpux}" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.hpux" />
      <property name="linker.cfg.id.core"                   value="linker.cfg.hpux.jogl" />
    </target>

    <!-- ================================================================== -->
    <!-- 
       - Initialize all parameters required for the build and create any
       - required directories.
      -->
    <target name="init" depends="declare.common">
        <!-- Call the external config validator script to make sure the config is ok and consistent -->
        <ant antfile="${validate.user.properties}" inheritall="true"/>
        
        <!-- Create the required output directories. -->
        <mkdir dir="${src.generated.java}" />
        <mkdir dir="${src.generated.c}" />
        <mkdir dir="${classes}" />
        <mkdir dir="${obj}" />
        <mkdir dir="${obj.jogl}" />
        <mkdir dir="${obj.cg}" />
    </target>

    <target name="declare" depends="init,declare.win32,declare.linux,declare.solaris32,declare.solaris.sparcv9,declare.solaris.amd64,declare.macosx,declare.freebsd,declare.hpux" />

    <!-- ================================================================== -->
    <!-- GlueGen and BuildStaticGLInfo creation, task setup and Java file generation -->
    <!--
       - Build GlueGen
      -->
    <target name="build.gluegen" depends="init">
        <!-- Run the GlueGen build to ensure that the GlueGen ANT task
           - has been built. -->
        <!-- FIXME: remove passing down of antlr.jar when gluegen.properties is on all
             nightly build machines -->
        <ant antfile="${gluegen.build.xml}" dir="${gluegen.make.dir}" target="all" inheritAll="false">
          <propertyset>
            <propertyref name="antlr.jar" />
            <propertyref name="gluegen.nsig" />
          </propertyset>
        </ant>
    </target>

    <!--
       - Check to see whether we need to rebuild the generated sources.
      -->
    <target name="java.generate.check">
        <!-- Blow away all target files if any dependencies are violated
             (the uptodate task doesn't allow arbitrary source and target filesets but should) -->
        <dependset>
            <srcfileset refid="stub.includes.dependencies.fileset.1" />
            <srcfileset refid="stub.includes.dependencies.fileset.2" />
            <srcfileset refid="stub.includes.dependencies.fileset.3" />
            <targetfileset dir="${src.generated}">
                <include name="**/*.java" />
                <include name="**/*.c" />
            </targetfileset>
        </dependset>

        <!-- Now check for the presence of one well-known file -->
        <uptodate property="java.generate.skip"
                  targetfile="${src.generated.java}/javax/media/opengl/GL.java">
            <srcfiles refid="stub.includes.dependencies.fileset.1" />
            <srcfiles refid="stub.includes.dependencies.fileset.2" />
            <srcfiles refid="stub.includes.dependencies.fileset.3" />
        </uptodate>
    </target>

    <target name="java.generate.gl" unless="gluegen.nsig">
        <!-- Generate GL interface and implementation -->
        <echo message="Generating GL interface and implementation" />
        <gluegen src="${stub.includes.common}/gl.c" 
                 config="${gl.cfg}"
                 includeRefid="stub.includes.fileset.all"
                 emitter="com.sun.gluegen.opengl.GLEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>
    </target>

    <target name="java.generate.gl.nsig" if="gluegen.nsig">
        <!-- Generate GL interface and implementation -->
        <echo message="Generating GL interface and implementation" />
        <gluegen src="${stub.includes.common}/gl.c" 
                 config="${gl.cfg.nsig}"
                 includeRefid="stub.includes.fileset.all"
                 emitter="com.sun.gluegen.nativesig.NativeSignatureEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>
    </target>

    <!--
       - Setup the generating ANT tasks and use it to generate the Java files 
       - from the C GL headers.  This involves setting the taskdef and creating
       - the classpath reference id then running the task on each header.
      -->
    <target name="java.generate" depends="build.gluegen, java.generate.check" unless="java.generate.skip">
        <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT -->
        <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
                 classpathref="gluegen.classpath" />
        <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask"
                 classpathref="gluegen.classpath" />
                 
        <!-- Use the GlueGen and BuildStaticGLInfo tasks to generate the 
           - Java files -->

        <!-- Generate GL interface and implementation -->
        <antcall target="java.generate.gl"      inheritRefs="true" />
        <antcall target="java.generate.gl.nsig" inheritRefs="true" />

	<!-- Generate platform-specific extension class (WGLExt, GLXExt, etc.) -->
        <echo message="Generating platform-specific OpenGL extension class" />
        <gluegen src="${glext.platform.header}" 
                 config="${glext.platform.cfg}"
                 includeRefid="stub.includes.fileset.all"
                 emitter="com.sun.gluegen.opengl.GLEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>

	<!-- Generate WGL/GLX/CGL implementation class -->
        <echo message="Generating WGL/GLX/CGL implementation class" />
	<dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.fileset.platform.params}" />
        <gluegen src="${stub.includes.platform}/window-system.c" 
                 config="${window.cfg}"
                 includeRefid="stub.includes.fileset.platform"
                 emitter="com.sun.gluegen.opengl.GLEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>

	<!-- Generate JAWT class -->
        <!-- NOTE:  the "literalInclude" in this GlueGen call is simply to
           -        get around the fact that neither FileSet nor DirSet can
           -        handle different drives in an effective manner. -->
        <echo message="Generating JAWT interface class" />
        <echo message="java.home.dir=${java.home.dir}" />
        <gluegen src="${java.includes.dir.platform}/jawt_md.h" 
                 config="${jawt.cfg}"
                 literalInclude="${java.includes.dir}"
                 includeRefid="stub.includes.fileset.platform"
                 emitter="com.sun.gluegen.JavaEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>

	<!-- Generate StaticGLInfo class -->
        <echo message="Generating StaticGLInfo class" />
        <staticglgen package="com.sun.opengl.impl"
                     headers="${gl.headers}"
                     outputdir="${src.generated.java}/com/sun/opengl/impl">
            <classpath refid="gluegen.classpath" />
        </staticglgen>

	<!-- Generate GLU class -->
        <echo message="Generating GLU class" />
        <gluegen src="${stub.includes.common}/glu.c" 
                 config="${glu.cfg}"
                 includeRefid="stub.includes.fileset.all"
                 emitter="com.sun.gluegen.opengl.GLEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>

        <!-- Inform the user that the generators have successfully created 
           - the necessary Java files -->
        <echo message="" />
        <echo message="GlueGen and BuildStaticGLInfo have successfully generated files." />
    
    </target>      

    <target name="java.generate.cg.check">
        <!-- Blow away all target files if any dependencies are violated
             (the uptodate task doesn't allow arbitrary source and target filesets but should) -->
        <dependset>
            <srcfileset refid="stub.includes.cg.dependencies.fileset" />
            <targetfileset dir=".">
                <include name="${src.generated.java.cg}/**/*.java" />
                <include name="${src.generated.c.cg}/**/*.c" />
            </targetfileset>
        </dependset>

        <!-- Now check for the presence of one well-known file -->
        <uptodate property="java.generate.cg.skip">
            <srcfiles refid="stub.includes.cg.dependencies.fileset" />
            <mapper type="merge" to="${src.generated.java}/com/sun/opengl/cg/CgGL.java" />
        </uptodate>
    </target>

    <!--
       - Setup the generating ANT tasks and use it to generate the Java files 
       - from the C GL headers.  This involves setting the taskdef and creating
       - the classpath reference id then running the task on each header.
      -->
    <target name="java.generate.cg" depends="java.generate.cg.check" if="jogl.cg" unless="java.generate.cg.skip">
        <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT -->
        <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
                 classpathref="gluegen.classpath" />
        <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask"
                 classpathref="gluegen.classpath" />

        <!-- Generate CgGL interface class -->
        <gluegen src="${stub.includes.common}/cg.c" 
                 config="cg-common.cfg"
                 includeRefid="stub.includes.cg.fileset.all"
                 emitter="com.sun.gluegen.JavaEmitter">
            <classpath refid="gluegen.classpath" />
        </gluegen>
    </target>

    <!-- ================================================================== -->
    <!-- 
       - Build and dependency rules for the composable pipeline
      -->
    <target name="java.generate.composable.pipeline.check">
        <!-- Blow away the DebugGL.java and TraceGL.java sources if GL.class has changed
             (the uptodate element doesn't support arbitrary source and destination files) -->
        <dependset>
            <srcfilelist dir="${classes}/javax/media/opengl" files="GL.class" />
            <targetfileset dir="${src.generated.java}/javax/media/opengl"
                           includes="DebugGL.java,TraceGL.java" />
        </dependset>
                           
        <!-- Now choose one of the two to test to see if we have to regenerate -->
        <uptodate property="java.generate.composable.pipeline.skip"
                  srcfile="${classes}/javax/media/opengl/GL.class"
                  targetfile="${src.generated.java}/javax/media/opengl/DebugGL.java" />
    </target>        

    <target name="java.generate.composable.pipeline" depends="java.generate.composable.pipeline.check" unless="java.generate.composable.pipeline.skip">
        <java classname="com.sun.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true">
            <arg value="javax.media.opengl.GL" />
            <arg value="${src.generated.java}/javax/media/opengl" />
            <classpath refid="pipeline.classpath" />
        </java>
    </target>          

    <!-- ================================================================== -->
    <!-- 
       - Compile the original and generated source.  The composable pipelines
       - will be generated.
      -->
    <target name="java.compile.firstpass" depends="java.generate,java.generate.cg">
        <!-- Perform the first pass Java compile. -->
        <javac srcdir="${src.generated.java}"
               destdir="${classes}"
               classpath="${gluegen-rt.jar}"
               includes="javax/media/opengl/GL.java"
               fork="yes"
               memoryMaximumSize="128m"
               source="1.4" debug="true" debuglevel="source,lines">
        </javac>
    </target>

    <target name="java.compile.secondpass" depends="java.generate.composable.pipeline">
        <!-- Perform the second pass Java compile; everything. -->
        <javac destdir="${classes}"
               excludes="${java.excludes.platform}"
               source="${jogl.sourcelevel}"
               classpath="${gluegen-rt.jar}"
               fork="yes"
               memoryMaximumSize="128m"
               debug="true" debuglevel="source,lines">
            <src path="${src.java}" />
            <src path="${src.generated.java}" />
        </javac>
    </target>


    <target name="java.compile" depends="java.compile.firstpass,java.compile.secondpass" />

    <!-- ================================================================== -->
    <!-- 
       - Compile the native C code for JOGL (and optionally the Cg binding).
      -->

    <target name="c.configure" depends="gluegen.cpptasks.configure.compiler">
      <!-- compiler configuration -->
      <!-- Note that we can use the base setups in the gluegen-cpptasks for most of these -->

      <compiler id="compiler.cfg.freebsd.jogl" extends="compiler.cfg.freebsd">
        <!-- Need to force X11R6 headers on to include path after stub_includes -->
        <includepath path="stub_includes/opengl"/>
        <includepath path="/usr/X11R6/include" />
      </compiler>

      <!-- linker configuration -->
 
      <linker id="linker.cfg.linux.jogl" extends="linker.cfg.linux">
        <syslibset dir="/usr/X11R6/lib" libs="GL, X11"/>
        <syslibset dir="/usr/X11R6/lib" libs="Xxf86vm" />
        <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
      </linker>

      <linker id="linker.cfg.linux.amd64.jogl" name="gcc">
        <syslibset dir="/usr/X11R6/lib64" libs="GL, X11"/>
        <syslibset dir="/usr/X11R6/lib64" libs="Xxf86vm" />
        <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
      </linker>

      <linker id="linker.cfg.solaris.jogl" extends="linker.cfg.solaris">
        <syslibset libs="GL, X11"/>
        <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
      </linker>

      <linker id="linker.cfg.solaris.sparcv9.jogl" extends="linker.cfg.solaris.sparcv9">
        <linkerarg value="-xarch=v9a" />
        <syslibset dir="/usr/openwin/lib/sparcv9" libs="GL"/>
        <syslibset dir="/usr/lib/sparcv9" libs="X11"/>
      </linker>

      <linker id="linker.cfg.solaris.amd64.jogl" extends="linker.cfg.solaris.amd64">
        <linkerarg value="-xarch=amd64" />
        <syslibset dir="/usr/lib/amd64" libs="GL"/>
        <syslibset dir="/usr/lib/amd64" libs="X11"/>
      </linker>

      <linker id="linker.cfg.win32.mingw.jogl" extends="linker.cfg.win32.mingw">
        <linkerarg value="-Wl,--kill-at" />        <!-- remove @ from function names -->
        <syslibset libs="opengl32, glu32, gdi32, kernel32"/>
        <syslibset dir="${windows.cg.lib}" libs="cg, cgGL" if="c.compiler.use-cglib"/>
      </linker>

      <linker id="linker.cfg.win32.msvc.jogl" extends="linker.cfg.win32.msvc">
        <syslibset libs="opengl32, gdi32, user32, kernel32" />
        <syslibset dir="${windows.cg.lib}" libs="cg, cgGL" if="c.compiler.use-cglib"/>
      </linker>

      <linker id="linker.cfg.macosx.jogl" extends="linker.cfg.macosx">
        <linkerarg value="-framework" />
        <linkerarg value="Cocoa" />
        <linkerarg value="-framework" />
        <linkerarg value="OpenGL" />
        <linkerarg value="-framework" if="c.compiler.use-cglib" />
        <linkerarg value="Cg" if="c.compiler.use-cglib" />
      </linker>

      <linker id="linker.cfg.hpux.jogl" extends="linker.cfg.hpux">
        <syslibset dir="/opt/graphics/OpenGL/lib" libs="GL, GLU"/>
        <syslibset dir="/usr/lib" libs="X11"/>
      </linker>

      <patternset id="c.src.files.jogl">
        <include name="${rootrel.src.c.jogl}/InternalBufferUtils.c"/>
        <include name="${rootrel.src.c.jogl}/*.m" if="isOSX"/>
        <include name="${rootrel.generated.c.jogl}/*GL*.c"/>
        <include name="${rootrel.src.c.jogl}/XineramaHelper.c" if="isX11"/>
        <!-- Xinerama supporting functions for Linux only (for now) -->
        <!-- Also supported on Solaris, but works differently -->
        <include name="${rootrel.src.c.jogl}/Xinerama.c" if="isLinux"/>
      </patternset>

      <patternset id="c.src.files.jogl_awt">
        <include name="${rootrel.src.c.jogl}/JAWT*.c"/>
        <include name="${rootrel.generated.c.jogl}/JAWT*.c"/>
      </patternset>
      
      <patternset id="c.src.files.cg">
        <include name="${rootrel.generated.c.cg}/*.c"/>
      </patternset>

    </target>

    <target name="c.build" depends="c.configure">
      <fail message="Requires '${c.compiler.src.files}'" unless="c.compiler.src.files"/>
      <fail message="Requires '${compiler.cfg.id}'"      unless="compiler.cfg.id"/>
      <fail message="Requires '${linker.cfg.id}'"        unless="linker.cfg.id"/>
      <fail message="Requires '${output.lib.name}'"      unless="output.lib.name"/>

      <echo message="Output lib name = ${output.lib.name}" />

      <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
      <property name="c.compiler.debug"     value="false" /> 
      <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } --> 
      <property name="c.compiler.optimise"  value="none" /> 

      <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>

      <condition property="c.compiler.needs-libjvm">
        <and>
          <isset property="isHPUX"/>
          <isset property="c.compiler.use-jawt"/>
        </and>
      </condition>

      <cc outtype="shared" 
          objdir="${obj.jogl}" 
          outfile="${obj}/${output.lib.name}"
          optimize="${c.compiler.optimise}" 
          debug="${c.compiler.debug}"
          multithreaded="true" 
          exceptions="false" 
          rtti="false">   

        <!-- TODO: versioninfo  companyname="java.net"
                      legalcopyright="Copyright"
                      productname="JOGL" 
                      productversion="x.y.z"
                      description="Description"
                      fileversion="x.y.z" 
                      filecomments="File Comment" /-->      

        <fileset dir="${project.root}"><patternset refid="${c.compiler.src.files}"/></fileset>

        <compiler extends="${compiler.cfg.id}" >
          <sysincludepath path="${java.includes.dir}"/>
          <sysincludepath path="${java.includes.dir.platform}"/>
          <includepath path="stub_includes/opengl"/>
          <includepath path="stub_includes/cg" if="c.compiler.use-cglib"/>        
          <!-- This must come last to not override real include paths -->
          <!-- includepath path="stub_includes/macosx" if="isOSX" / -->
        </compiler>

        <linker extends="${linker.cfg.id}">
          <syslibset dir="${java.lib.dir.platform}" libs="jawt" if="c.compiler.use-jawt"/>
          <syslibset dir="${java.lib.dir.platform}/server" libs="jvm" if="c.compiler.needs-libjvm"/>
        </linker>
      </cc>
    </target>  

    <target name="c.rename.jogl.libs.mingw" if="isMingW">
      <!-- FIXME: this is a hack; the cpptask should have an option to change the
           suffix or at least understand the override from .so to .dll -->
      <move file="${obj}/libjogl.so" tofile="${obj}/jogl.dll" />
      <move file="${obj}/libjogl_awt.so" tofile="${obj}/jogl_awt.dll" />
      <move file="${obj}/libjogl_cg.so" tofile="${obj}/jogl_cg.dll" failonerror="false" />
    </target>

    <target name="c.rename.jogl.libs.macosx" if="isOSX">
      <!-- FIXME: this is a hack; the cpptask should have an option to change the
           suffix or at least understand the override from dylib to jnilib -->
      <move file="${obj}/libjogl.dylib" tofile="${obj}/libjogl.jnilib" />
      <move file="${obj}/libjogl_awt.dylib" tofile="${obj}/libjogl_awt.jnilib" />
      <move file="${obj}/libjogl_cg.dylib" tofile="${obj}/libjogl_cg.jnilib" failonerror="false" />
      <antcall target="c.fixup.jawt.version.macosx" inheritrefs="true" />
    </target>

    <target name="c.fixup.jawt.version.macosx" if="macosxfat">
      <!-- Edit the link to the JAWT version in the resulting jnilib
           file; this isn't strictly needed but seems to allow the
           universal binaries to work on 10.3 machines as well, which
           is desirable for some end users -->
      <apply executable="install_name_tool">
        <arg value="-change" />
        <arg value="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjawt.dylib" />
        <arg value="/System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib" />
        <srcfile />
        <fileset dir="${obj}" includes="libjogl_awt.jnilib" />
      </apply>
    </target>

    <target name="c.build.jogl.core">
      <antcall target="c.build" inheritRefs="true">
        <param name="c.compiler.src.files" value="c.src.files.jogl"/>
        <param name="output.lib.name" value="jogl"/>
        <param name="linker.cfg.id" value="${linker.cfg.id.core}"/>
      </antcall>
    </target>

    <target name="c.build.jogl.awt">
      <antcall target="c.build" inheritRefs="true">
        <param name="c.compiler.src.files" value="c.src.files.jogl_awt"/>
        <param name="c.compiler.use-jawt" value="true"/>
        <param name="output.lib.name" value="jogl_awt"/>
        <param name="linker.cfg.id" value="${linker.cfg.id.core}"/>
      </antcall>
    </target>

    <target name="c.build.jogl.cg" if="jogl.cg">
      <antcall target="c.build" inheritRefs="true">
        <param name="c.compiler.src.files" value="c.src.files.cg"/>
        <param name="c.compiler.use-cglib" value="true"/>
        <param name="output.lib.name" value="jogl_cg"/>
        <param name="linker.cfg.id" value="${linker.cfg.id.core}"/>
      </antcall>
    </target>
    
    <target name="c.manifest.cg" if="jogl.cg">
      <exec executable="mt">
        <arg value="-manifest"/>
        <arg value="${obj}/jogl_cg.dll.manifest"/>
        <arg value="-outputresource:${obj}/jogl_cg.dll;#2"/>
      </exec>
    </target>

    <target name="c.manifest" if="isVC8Family">
      <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll -->
      <exec executable="mt">
        <arg value="-manifest"/>
        <arg value="${obj}/jogl.dll.manifest"/>
        <arg value="-outputresource:${obj}/jogl.dll;#2"/>
      </exec>
      <exec executable="mt">
        <arg value="-manifest"/>
        <arg value="${obj}/jogl_awt.dll.manifest"/>
        <arg value="-outputresource:${obj}/jogl_awt.dll;#2"/>
      </exec>
      <antcall target="c.manifest.cg" inheritRefs="true" />
    </target>

    <target name="c.build.jogl" depends="c.build.jogl.core,c.build.jogl.awt,c.build.jogl.cg">
      <antcall target="c.rename.jogl.libs.mingw" inheritRefs="true" />
      <antcall target="c.rename.jogl.libs.macosx" inheritRefs="true" />
      <antcall target="c.manifest" inheritRefs="true" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Build the jogl.jar file.
      -->
    <target name="jar" depends="java.compile,cond-if-RImanifest,cond-else-RImanifest"/>

    <target name="check-RIcond">
      <condition property="RIcond-is-true">
         <isset property="RImanifestfile"/>
      </condition>
    </target>

    <target name="cond-if-RImanifest" depends="check-RIcond" if="RIcond-is-true">
        <copy file="joglRIversion"
          tofile="tempversion"
          overwrite="true">
          <filterset>
              <filter token="VERSION" value="${base_version}-pre-${timestamp}"/>
              <filter token="BASEVERSION" value="${base_version}"/>
          </filterset>
        </copy>
        <jar manifest="tempversion" destfile="${jogl.jar}">
            <fileset dir="${classes}">
                <include name="javax/media/opengl/**" />
                <include name="com/sun/gluegen/runtime/**" />
                <include name="com/sun/opengl/**" />
            </fileset>
        </jar>
        <delete file="tempversion"/>
    </target>
  
 
    <target name="cond-else-RImanifest" depends="check-RIcond" unless="RIcond-is-true">
        <tstamp>
             <format property="timestamp" pattern="yyyyMMdd-HH:mm:ss"/>
        </tstamp>
        <copy file="joglversion"
          tofile="tempversion"
          overwrite="true">
          <filterset>
              <filter token="VERSION" value="${base_version}-pre-${timestamp}"/>
              <filter token="BASEVERSION" value="${base_version}"/>
          </filterset>
        </copy>
        <jar manifest="tempversion" destfile="${jogl.jar}">
            <fileset dir="${classes}">
                <include name="javax/media/opengl/**" />
                <include name="com/sun/gluegen/runtime/**" />
                <include name="com/sun/opengl/**" />
            </fileset>
        </jar>
        <delete file="tempversion"/>
    </target>

    <!-- ================================================================== -->
    <!--
       - Build the Javadocs for the sources.
       - NOTE:  these are not entirely correct as the javadocs targets depend 
       -        on the platform specific build targets.  To circumvent any 
       -        errors, ensure that the source is built first.
      -->
    <target name="javadoc.nocg" depends="setup.java.home.dir,init" unless="jogl.cg">
        <!-- Build the general Javadoc -->
        <javadoc packagenames="${javadoc.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"        
                 destdir="${javadoc}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
		 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>

    <!-- Same as above but with Cg directories added -->
    <target name="javadoc.cg" depends="setup.java.home.dir,init" if="jogl.cg">
        <!-- Build the general Javadoc -->
        <javadoc packagenames="${javadoc.packagenames},com.sun.opengl.cg"
                 sourcepath="${src.java};${src.generated.java}"        
                 destdir="${javadoc}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
		 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>

    <target name="javadoc" depends="javadoc.nocg,javadoc.cg" />

    <target name="javadoc.spec.nocg" depends="setup.java.home.dir,init" unless="jogl.cg">
        <!-- Build the general Javadoc -->
        <javadoc packagenames="${javadoc.spec.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"
                 destdir="${javadoc.spec}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}"
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
                 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>
                                                                                                                                   
    <!-- Same as above since Cg directories are not part of spec -->
    <target name="javadoc.spec.cg" depends="setup.java.home.dir,init" if="jogl.cg">
        <!-- Build the general Javadoc -->
        <javadoc packagenames="${javadoc.spec.packagenames}"
                 sourcepath="${src.java};${src.generated.java}"
                 destdir="${javadoc.spec}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}"
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
                 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>

    <target name="javadoc.spec" depends="javadoc.spec.nocg,javadoc.spec.cg" />

    <target name="javadoc.dev.nocg" unless="jogl.cg">
        <!-- Build the internal developer Javadoc -->
        <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform}"
                 sourcepath="${src.java};${src.generated.java}"        
                 destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
		 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>

    <!-- Same as above but with Cg directories added -->
    <target name="javadoc.dev.cg" if="jogl.cg">
        <!-- Build the internal developer Javadoc -->
        <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform},com.sun.opengl.cg"
                 sourcepath="${src.java};${src.generated.java}"        
                 destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}"
                 overview="${javadoc.overview}" 
                 source="1.4"
                 linkoffline="${javadoc.link} 142-packages"
		 bottom="${javadoc.bottom}" >
          <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
        </javadoc>
    </target>

    <target name="javadoc.dev.win32"  depends="setup.java.home.dir,init,declare.win32,javadoc.dev.nocg,javadoc.dev.cg" />
    <target name="javadoc.dev.x11"    depends="setup.java.home.dir,init,declare.x11,javadoc.dev.nocg,javadoc.dev.cg" />
    <target name="javadoc.dev.macosx" depends="setup.java.home.dir,init,declare.macosx,javadoc.dev.nocg,javadoc.dev.cg" />

    <!-- ================================================================== -->
    <!--
       - Build the platform-independent distribution out of jars built for
       - Windows, Linux and Mac OS X; the Java sources for Jogl can't be
       - fully cross-compiled at this time. To run this target, you need to
       - specify the property jogl.dist.dir as a System property (i.e.,
       - "ant -Djogl.dist.dir=../dist dist"); directories named jogl-linux,
       - jogl-win, and jogl-macosx need to be inside that directory and each
       - of those directories needs to contain both the jogl.jar for that
       - platform as well as the native code (libjogl.so, jogl.dll, or
       - libjogl.jnilib). Also builds jars containing the native code for
       - Windows, Linux, Mac OS X, Solaris/SPARC and Solaris/x86.
      -->
    <target name="dist.dir.check" unless="jogl.dist.dir">
        <fail>
  
    ******************************************************************
    ** To build the Jogl distribution out of the platform-specific  **
    ** component jars and native code, the property jogl.dist.dir   **
    ** needs to be specified on the command line. Please read the   **
    ** comments associated with the "dist" target in the build.xml. **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.windows" if="jogl.dist.dir">
        <condition property="windows.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-win/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-win/32/jogl.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/32/jogl_awt.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/32/jogl_cg.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/32/gluegen-rt.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/32/gluegen-rt-natives-windows-i586.jar" />
	  </and>
	</condition>
	<fail unless="windows.complete">
    ******************************************************************
    ** Files are missing from the Windows build. This will cause    **	
    ** the distribution to be incomplete. Please check the status   **
    ** of the Windows build and try again.                          **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.windows-amd64" if="jogl.dist.dir">
        <condition property="windows-amd64.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-win/64/jogl.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/64/jogl_awt.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/64/jogl_cg.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/64/gluegen-rt.dll" />
	    <available file="${jogl.dist.dir}/jogl-win/64/gluegen-rt-natives-windows-amd64.jar" />
	  </and>
	</condition>
	<fail unless="windows-amd64.complete">
    *********************************************************************
    ** Files are missing from the Windows/AMD64 build. This will cause **	
    ** the distribution to be incomplete. Please check the status      **
    ** of the Windows/AMD64 build and try again.                       **
    *********************************************************************
        </fail>
    </target>

    <target name="dist.check.linux" if="jogl.dist.dir">
        <condition property="linux.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-linux/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-linux/32/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/32/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/32/libjogl_cg.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/32/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/32/gluegen-rt-natives-linux-i586.jar" />
	    <!-- Assume we also copy over these generated files in the Linux build -->
	    <!-- in order to satisfy requests from end users that we provide these -->
	    <!-- files for easier source browsing in IDEs                          -->
	    <available file="${jogl.dist.dir}/jogl-linux/DebugGL.java" />
	    <available file="${jogl.dist.dir}/jogl-linux/TraceGL.java" />
	    <available file="${jogl.dist.dir}/jogl-linux/GL.java" />
	    <available file="${jogl.dist.dir}/jogl-linux/GLU.java" />
	  </and>
	</condition>
	<fail unless="linux.complete">
    ******************************************************************
    ** Files are missing from the Linux build. This will cause      **	
    ** the distribution to be incomplete. Please check the status   **
    ** of the Linux build and try again.                            **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.linux-amd64" if="jogl.dist.dir">
        <condition property="linux-amd64.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-linux/64/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/64/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/64/libjogl_cg.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/64/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-linux/64/gluegen-rt-natives-linux-amd64.jar" />
	  </and>
	</condition>
	<fail unless="linux-amd64.complete">
    *******************************************************************
    ** Files are missing from the Linux/AMD64 build. This will cause **	
    ** the distribution to be incomplete. Please check the status    **
    ** of the Linux/AMD64 build and try again.                       **
    *******************************************************************
        </fail>
    </target>

    <target name="dist.check.macosx" if="jogl.dist.dir">
        <condition property="macosx.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-macosx/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl_awt.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl_cg.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/ppc/libgluegen-rt.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/ppc/gluegen-rt-natives-macosx-ppc.jar" />
	  </and>
	</condition>
	<fail unless="macosx.complete">
    ******************************************************************
    ** Files are missing from the Mac OS X build. This will cause   **	
    ** the distribution to be incomplete. Please check the status   **
    ** of the Mac OS X build and try again.                         **
    ******************************************************************
        </fail>
    </target>


    <target name="dist.check.macosxfat" if="jogl.dist.dir">
        <condition property="macosxfat.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-macosx/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl_awt.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl_cg.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/fat/libgluegen-rt.jnilib" />
	    <available file="${jogl.dist.dir}/jogl-macosx/fat/gluegen-rt-natives-macosx-universal.jar" />
	  </and>
	</condition>
	<fail unless="macosxfat.complete">
    ******************************************************************
    ** Files are missing from the Mac OS X build. This will cause   **	
    ** the distribution to be incomplete. Please check the status   **
    ** of the Mac OS X build and try again.                         **
    ******************************************************************
        </fail>
    </target>



    <target name="dist.check.solsparc" if="jogl.dist.dir">
        <condition property="solsparc.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-solsparc/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/32/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/32/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/32/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/32/gluegen-rt-natives-solaris-sparc.jar" />
	  </and>
	</condition>
	<fail unless="solsparc.complete">
    ******************************************************************
    ** Files are missing from the Solaris/SPARC build. This will    **	
    ** cause the distribution to be incomplete. Please check the    **
    ** status of the Solaris/SPARC build and try again.             **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.solsparcv9" if="jogl.dist.dir">
        <condition property="solsparcv9.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-solsparc/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/64/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/64/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/64/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-solsparc/64/gluegen-rt-natives-solaris-sparcv9.jar" />
	  </and>
	</condition>
	<fail unless="solsparcv9.complete">
    ******************************************************************
    ** Files are missing from the Solaris/SPARCv9 build. This will  **	
    ** cause the distribution to be incomplete. Please check the    **
    ** status of the Solaris/SPARCv9 build and try again.           **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.solx86" if="jogl.dist.dir">
        <condition property="solx86.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-solx86/jogl.jar" />
	    <available file="${jogl.dist.dir}/jogl-solx86/32/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/32/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/32/libjogl_cg.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/32/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/32/gluegen-rt-natives-solaris-i586.jar" />
	  </and>
	</condition>
	<fail unless="solx86.complete">
    ******************************************************************
    ** Files are missing from the Solaris/x86 build. This will      **	
    ** cause the distribution to be incomplete. Please check the    **
    ** status of the Solaris/x86 build and try again.               **
    ******************************************************************
        </fail>
    </target>

    <target name="dist.check.solamd64" if="jogl.dist.dir">
        <condition property="solamd64.complete">
	  <and>
	    <available file="${jogl.dist.dir}/jogl-solx86/64/libjogl.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/64/libjogl_awt.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/64/libgluegen-rt.so" />
	    <available file="${jogl.dist.dir}/jogl-solx86/64/gluegen-rt-natives-solaris-amd64.jar" />
	  </and>
	</condition>
	<fail unless="solamd64.complete">
    ******************************************************************
    ** Files are missing from the Solaris/x86/64 (amd64) build. This * 
    ** will cause the distribution                                  **
    ** to be incomplete. Please check the                           **
    ** status of the Solaris/x86 (amd64) build and try again.       **
    ******************************************************************
        </fail>
    </target>

    <!-- Helper task for dist target below -->
    <!-- Required parameters: -->
    <!--   zip.os.arch    = the os/arch combination for this zip file (i.e., "windows-i586") -->
    <!--   zip.src.so.dir = the directory containing the .so's / .dll's / .jnilib's for this platform-->
    <target name="dist.build.zip">
        <property name="jogl.tmp.version" value="jogl-${tmp.version}-${zip.os.arch}" />
        <!-- Create all needed directories -->
        <delete dir="${jogl.dist.dir}/tmp" failonerror="false" />
        <mkdir dir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
        <!-- Copy in files -->
        <copy todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib">
            <fileset dir="${zip.src.so.dir}" includes="*${zip.so.suffix}" />
        </copy>
        <copy file="${jogl.dist.dir}/jogl.jar" todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
        <copy file="${jogl.dist.dir}/gluegen-rt.jar" todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
        <copy file="../CHANGELOG.txt"          todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}" />
        <copy file="../COPYRIGHT.txt"          todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}" />
        <copy file="../LICENSE.txt"            tofile="${jogl.dist.dir}/tmp/${jogl.tmp.version}/LICENSE-JOGL-${tmp.version}.txt" />
        <copy file="README-zip-bundles.txt"
          tofile="${jogl.dist.dir}/tmp/${jogl.tmp.version}/README.txt"
          overwrite="true">
          <filterset>
              <filter token="VERSION" value="${tmp.version}"/>
          </filterset>
        </copy>
        <copy file="../doc/userguide/index.html" tofile="${jogl.dist.dir}/tmp/${jogl.tmp.version}/Userguide.html" />
        <!-- zip it up -->
        <zip destfile="${jogl.dist.dir}/${jogl.tmp.version}.zip"
	     basedir="${jogl.dist.dir}/tmp"
	     includes="${jogl.tmp.version}/**" />
    </target>

    <target name="setup-version-RI" if="RImanifestfile">
        <property name="tmp.version" value="${base_version}" />
    </target>

    <target name="setup-version-non-RI" unless="RImanifestfile">
        <tstamp>
             <format property="timestamp" pattern="yyyyMMdd"/>
        </tstamp>
        <property name="tmp.version" value="${base_version}-pre-${timestamp}" />
    </target>

    <target name="dist" depends="dist.dir.check,dist.check.windows,dist.check.windows-amd64,dist.check.linux,dist.check.linux-amd64,dist.check.macosx,dist.check.macosxfat,dist.check.solsparc,dist.check.solsparcv9,dist.check.solx86,dist.check.solamd64,setup-version-RI,setup-version-non-RI">
        <delete>
            <fileset dir="${jogl.dist.dir}" includes="*.jar" />
        </delete>
        <delete>
            <fileset dir="${jogl.dist.dir}" includes="*.zip" />
        </delete>
        <delete dir="${jogl.dist.dir}/tmp" failonerror="false" />
        <delete dir="${jogl.dist.dir}/META-INF" failonerror="false" />
        <!-- Extract manifest from one of the jars to re-use it in the dist jar -->
        <unjar src="${jogl.dist.dir}/jogl-win/jogl.jar" dest="${jogl.dist.dir}" >
            <patternset>
                <include name="META-INF/MANIFEST.MF" />
            </patternset>
        </unjar>
        <!-- Build jar files suitable for Java Web Start -->
        <jar manifest="${jogl.dist.dir}/META-INF/MANIFEST.MF" destfile="${jogl.dist.dir}/jogl.jar" duplicate="preserve">
	    <zipgroupfileset dir="${jogl.dist.dir}"
	                     includes="jogl-win/jogl.jar, jogl-linux/jogl.jar, jogl-macosx/jogl.jar" />
        </jar>
        <!-- Apply Pack200 repacking to allow later compression by that mechanism -->
        <apply executable="pack200" verbose="true" >
            <arg value="--repack" />
            <fileset file="${jogl.dist.dir}/jogl.jar" />
        </apply>
        <jar destfile="${jogl.dist.dir}/jogl-natives-windows-i586.jar"
             basedir="${jogl.dist.dir}/jogl-win/32"
             includes="jogl.dll,jogl_awt.dll,jogl_cg.dll" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-windows-amd64.jar"
             basedir="${jogl.dist.dir}/jogl-win/64"
             includes="jogl.dll,jogl_awt.dll,jogl_cg.dll" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-linux-i586.jar"
             basedir="${jogl.dist.dir}/jogl-linux/32"
             includes="libjogl.so,libjogl_awt.so,libjogl_cg.so" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-linux-amd64.jar"
             basedir="${jogl.dist.dir}/jogl-linux/64"
             includes="libjogl.so,libjogl_awt.so,libjogl_cg.so" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-macosx-ppc.jar"
             basedir="${jogl.dist.dir}/jogl-macosx/ppc"
             includes="libjogl.jnilib,libjogl_awt.jnilib,libjogl_cg.jnilib" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-macosx-universal.jar"
             basedir="${jogl.dist.dir}/jogl-macosx/fat"
             includes="libjogl.jnilib,libjogl_awt.jnilib,libjogl_cg.jnilib" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-solaris-sparc.jar"
             basedir="${jogl.dist.dir}/jogl-solsparc/32"
             includes="libjogl.so,libjogl_awt.so" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-solaris-sparcv9.jar"
             basedir="${jogl.dist.dir}/jogl-solsparc/64"
             includes="libjogl.so,libjogl_awt.so" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-solaris-i586.jar"
             basedir="${jogl.dist.dir}/jogl-solx86/32"
             includes="libjogl.so,libjogl_awt.so,libjogl_cg.so" />
        <jar destfile="${jogl.dist.dir}/jogl-natives-solaris-amd64.jar"
             basedir="${jogl.dist.dir}/jogl-solx86/64"
             includes="libjogl.so,libjogl_awt.so" />
        <!-- Copy gluegen-rt.jar from Linux build (arbitrary; this jar is platform-independent) -->
        <copy file="${jogl.dist.dir}/jogl-linux/gluegen-rt.jar" todir="${jogl.dist.dir}" />
        <!-- Copy gluegen-rt native jars out of platform-specific subdirectories -->
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-win/32" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-win/64" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-linux/32" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-linux/64" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-macosx/ppc" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-macosx/fat" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-solsparc/32" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-solsparc/64" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-solx86/32" includes="gluegen-natives-*.jar" />
        </copy>
        <copy todir="${jogl.dist.dir}">
            <fileset dir="${jogl.dist.dir}/jogl-solx86/64" includes="gluegen-natives-*.jar" />
        </copy>

	<!-- Build a source archive as well -->
	<!-- First copy the generated files out of the Linux build results into the appropriate -->
	<!-- directory of this source tree (so that they'll be blown away properly with an -->
	<!-- "ant clean") -->
	<mkdir dir="../build/gensrc/classes/javax/media/opengl/glu" />
	<copy file="${jogl.dist.dir}/jogl-linux/DebugGL.java" todir="../build/gensrc/classes/javax/media/opengl" />
	<copy file="${jogl.dist.dir}/jogl-linux/TraceGL.java" todir="../build/gensrc/classes/javax/media/opengl" />
	<copy file="${jogl.dist.dir}/jogl-linux/GL.java"      todir="../build/gensrc/classes/javax/media/opengl" />
	<copy file="${jogl.dist.dir}/jogl-linux/GLU.java"     todir="../build/gensrc/classes/javax/media/opengl/glu" />
        <zip destfile="${jogl.dist.dir}/jogl-${tmp.version}-src.zip"
	     basedir="../.."
	     includes="gluegen/LICENSE.txt,gluegen/doc/**,gluegen/make/**,gluegen/src/**,jogl/*.txt,jogl/build/gensrc/classes/javax/media/opengl/**,jogl/doc/**,jogl/make/**,jogl/src/**"
	     excludes="**/*.class,**/*~"
	     />
        <!-- Create zip archives suitable for developers -->
        <!-- Unfortunately, we have to replicate the os/arch name combinations from
             gluegen-cpptasks.xml. The reason for this is that we can't generate these
             zip archives on the platform where the builds run; we have to run the dist
             target in order to get the platform-independent jogl.jar. -->
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="linux-i586" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-linux/32" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="linux-amd64" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-linux/64" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="macosx-ppc" />
            <param name="zip.so.suffix"  value=".jnilib" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-macosx/ppc" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="macosx-universal" />
            <param name="zip.so.suffix"  value=".jnilib" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-macosx/fat" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="solaris-i586" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solx86/32" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="solaris-amd64" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solx86/64" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="solaris-sparc" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solsparc/32" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="solaris-sparcv9" />
            <param name="zip.so.suffix"  value=".so" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solsparc/64" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="windows-i586" />
            <param name="zip.so.suffix"  value=".dll" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-win/32" />
        </antcall>
        <antcall target="dist.build.zip" inheritAll="true">
            <param name="zip.os.arch"    value="windows-amd64" />
            <param name="zip.so.suffix"  value=".dll" />
            <param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-win/64" />
        </antcall>
        <!-- Create one last zip archive by hand, this one containing all of the -->
        <!-- Java Web Start jar files (for easier redistribution) -->
        <zip destfile="${jogl.dist.dir}/jogl-${tmp.version}-webstart.zip"
	     basedir="${jogl.dist.dir}"
	     includes="*.jar" />
        <!-- Create a version.txt file indicating which version we just built -->
        <echo message="${tmp.version}" file="${jogl.dist.dir}/version.txt" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Clean up all that is built.
      -->
    <target name="clean" description="Remove all build products" depends="declare.common">
        <delete includeEmptyDirs="true" quiet="true">
            <fileset dir="${build}" />
            <fileset dir="${javadoc}" />
            <fileset dir="${javadoc.spec}" />
            <fileset dir="${javadoc.dev}" />
        </delete>
    </target>

    <!-- ================================================================== -->
    <!--
       - Build everything.
      -->
    <target name="all" description="Build JOGL JAR file(s) and native libraries." depends="setup.java.home.dir,init,declare">
        <!-- Generate, compile, and build the jar for the Java sources. -->
        <antcall target="jar" inheritRefs="true" />
        
        <!-- Compile the native C sources . -->
        <antcall target="c.build.jogl" inheritRefs="true" />
    </target>


    <!-- ================================================================== -->
    <!--
       - Build everything and use Sun's Implementation tag in the manifest to
       - indicate this is the Reference Implementation.
      -->
    <target name="RI">
        <!-- Set property for using the RI manifest file so jogl.jar is versioned
           - properly
          -->
          <property name="RImanifestfile" value="joglRIversion" />
          <antcall target="all" inheritRefs="true" />
    </target>
</project>
