diff options
Diffstat (limited to 'make')
-rwxr-xr-x | make/build.xml | 163 | ||||
-rwxr-xr-x | make/gluegen-cpptasks.xml | 175 | ||||
-rwxr-xr-x | make/gluegen.properties | 17 | ||||
-rw-r--r-- | make/lib/cpptasks-patch.tar.gz | bin | 0 -> 7743 bytes | |||
-rwxr-xr-x | make/lib/cpptasks-version.txt | 4 | ||||
-rwxr-xr-x | make/lib/cpptasks.jar | bin | 0 -> 345356 bytes | |||
-rwxr-xr-x | make/validate-properties.xml | 51 |
7 files changed, 410 insertions, 0 deletions
diff --git a/make/build.xml b/make/build.xml new file mode 100755 index 0000000..440d194 --- /dev/null +++ b/make/build.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + - Ant build for GlueGen and corresponding ANT tasks. Also builds + - JOGL-specific BuildStaticGLInfo and its corresponding ANT task. + - + - This build has been tested with ANT 1.6.2 and ANTLR 2.7.4. + - + - Public targets: + - all: clean and build GlueGen and GlueGen Ant task + - clean: clean all built + --> +<project name="GlueGen" basedir="." default="all"> + <target name="load.user.properties" 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}/gluegen.properties" /> + <property file="${user.properties.file}" /> + <echo message="Loaded ${user.properties.file}." /> + <fail message="antlr.jar was not specified in gluegen.properties. Please see README.txt for instructions" unless="antlr.jar"/> + <echo message="antlr.jar=${antlr.jar}" /> + </target> + + <target name="init" depends="load.user.properties"> + <!-- Declare all paths and user defined variables. --> + + <!-- The source directories. --> + <property name="src.java" value="../src/java" /> + <property name="build" value="../build" /> + + <!-- The generated source directories. --> + <property name="src.generated" value="../build/gensrc" /> + <property name="src.generated.java" value="../build/gensrc/java" /> + + <!-- The compiler output directories. --> + <property name="classes" value="${build}/classes" /> + + <!-- Call the external config validator script to make sure the config is ok and consistent --> + <ant antfile="validate-properties.xml" inheritall="true"/> + + <!-- Create the required output directories. --> + <mkdir dir="${src.generated.java}" /> + <mkdir dir="${classes}" /> + + <!-- Create the classpath for ANTLR. This requires the user-defined + - "antlr.jar" property. --> + <path id="antlr.classpath"> + <pathelement location="${antlr.jar}" /> + </path> + + <!-- The location of the GlueGen source and the C grammar files. --> + <property name="gluegen" value="${src.java}/com/sun/gluegen" /> + <property name="c.grammar" value="${gluegen}/cgram" /> + + <!-- The resulting location of the generated Java files from the + - C grammar via ANTLR. --> + <property name="gluegen.build" value="${src.generated.java}/com/sun/gluegen" /> + <property name="generated.java.from.grammar" value="${gluegen.build}/cgram" /> + </target> + + <!-- + - Using ANTLR generate the specified Java files. + - + - @param target the grammar file to process + - @param output.dir the directory to write the generated files to. If + - the directory does not exist, it will be created. + --> + <target name="generate.c.grammar"> + <!-- Generate the Java files --> + <antlr target="${output.dir}/${target}" outputdirectory="${output.dir}"> + <classpath refid="antlr.classpath" /> + </antlr> + </target> + + <!-- + - Using ANTLR generate the specified Java files with an overridden + - grammar file. + - + - @param target the grammar file to process + - @param glib the overridding grammar file + - @param output.dir the directory to write the generated files to. If + - the directory does not exist, it will be created. + --> + <target name="generate.c.grammar.glib"> + <!-- Generate the Java files --> + <antlr target="${output.dir}/${target}" glib="${output.dir}/${glib}" outputdirectory="${output.dir}"> + <classpath refid="antlr.classpath" /> + </antlr> + </target> + + <!-- ================================================================== --> + <!-- + - Build GlueGen. + --> + <target name="gluegen.build" depends="init"> + <!-- Because ANTLR looks for importVocab files in the current + working directory, it likes to have all of its files, + including supergrammars, in one place, so copy all of the + grammars to the output directory up front so we don't put + temporary files into the source tree --> + <mkdir dir="${generated.java.from.grammar}" /> + <copy todir="${generated.java.from.grammar}"> + <fileset dir="${c.grammar}"> + <include name="*.g" /> + </fileset> + </copy> + + <!-- Generate the Java files from the C grammar using ANTLR. --> + <antcall target="generate.c.grammar"> + <param name="output.dir" value="${generated.java.from.grammar}" /> + <param name="target" value="StdCParser.g" /> + </antcall> + <antcall target="generate.c.grammar.glib"> + <param name="output.dir" value="${generated.java.from.grammar}" /> + <param name="target" value="GnuCParser.g" /> + <param name="glib" value="StdCParser.g" /> + </antcall> + <antcall target="generate.c.grammar"> + <param name="output.dir" value="${generated.java.from.grammar}" /> + <param name="target" value="GnuCTreeParser.g" /> + </antcall> + <antcall target="generate.c.grammar.glib"> + <param name="output.dir" value="${generated.java.from.grammar}" /> + <param name="target" value="GnuCEmitter.g" /> + <param name="glib" value="GnuCTreeParser.g" /> + </antcall> + <antcall target="generate.c.grammar.glib"> + <param name="output.dir" value="${generated.java.from.grammar}" /> + <param name="target" value="HeaderParser.g" /> + <param name="glib" value="GnuCTreeParser.g" /> + </antcall> + + <!-- Build GlueGen using the generated Java files along with the + - original source. --> + <javac destdir="${classes}" source="1.4" debug="true" debuglevel="source,lines"> + <src path="${src.java}" /> + <src path="${src.generated.java}" /> + <classpath refid="antlr.classpath" /> + </javac> + + <!-- Build gluegen.jar. --> + <jar destfile="${build}/gluegen.jar"> + <fileset dir="${classes}"> + <include name="**/*.class" /> + </fileset> + </jar> + + <!-- Build gluegen-rt.jar. --> + <jar destfile="${build}/gluegen-rt.jar"> + <fileset dir="${classes}"> + <include name="com/sun/gluegen/runtime/*.class" /> + </fileset> + </jar> + </target> + + <target name="all" depends="gluegen.build" /> + + <target name="clean"> + <delete includeEmptyDirs="true" quiet="true"> + <fileset dir="../build" /> + </delete> + </target> +</project> diff --git a/make/gluegen-cpptasks.xml b/make/gluegen-cpptasks.xml new file mode 100755 index 0000000..8d10498 --- /dev/null +++ b/make/gluegen-cpptasks.xml @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + - Ant project file which sets up cpptasks to compile native code + - generated by GlueGen for multiple supported platforms. This Ant + - project file is not intended to be executed standalone, but imported + - by other projects which use GlueGen to generate native code and + - need to compile that native code. + - + - Before importing this file, the property "gluegen.root" must be + - defined; this is the relative path from the current working + - directory (e.g., from which the parent project's build.xml is being + - executed) to the top of the checked-out GlueGen workspace. + - + - This Ant project file depends on the following properties being set + - externally: + - + - win32.c.compiler (required to be set on Windows): + - one of "vc6", "vc7", "vc8", or "mingw". + - c.compiler.debug: + - set to "true" if debug version of the compiled + - C code is desired. + - macosxfat: + - set to "true" if universal / fat binaries (both PowerPC + - and Intel code) are desired on Mac OS X. Requires + - support for cross-compilation from the underlying C + - compiler. + - + - The gluegen.cpptasks.detect.os target sets the following + - properties appropriately. They are only set to "true" if the OS/CPU + - configuration is exactly as specified. + - + - isFreeBSD + - isIA64 + - isOSX + - isLinux + - isLinuxAMD64 + - isLinuxIA64 + - isLinuxX86 + - isSolaris + - isWindows + - isUnix + - isX11 + - + - The gluegen.cpptasks.detect.compiler target sets the following + - properties appropriately. They are only set to "true" if the OS/compiler + - configuration is exactly as specified. + - + - isVC6 + - isVC7 + - isVC8 + - isMingW + --> +<project name="GlueGen-cpptasks" basedir="."> + <!-- import cpptasks --> + <typedef resource="net/sf/antcontrib/cpptasks/antlib.xml" classpath="${gluegen.root}/make/lib/cpptasks.jar"/> + + <!-- Detect OS and compiler configuration --> + <target name="gluegen.cpptasks.detect.os" unless="gluegen.cpptasks.detected.os"> + <condition property="isOSX"> + <and> + <os family="mac"/> + <os family="unix"/> + </and> + </condition> + <condition property="isUnix"> + <and> + <os family="unix" /> + <not> + <os family="mac" /> + </not> + </and> + </condition> + <condition property="isLinux"> + <os name="Linux" /> + </condition> + <condition property="isSolaris"> + <os name="SunOS" /> + </condition> + <condition property="isWindows"> + <os family="windows" /> + </condition> + <condition property="isFreeBSD"> + <os name="FreeBSD" /> + </condition> + <condition property="isLinuxX86"> + <and> + <istrue value="${isLinux}" /> + <os arch="x86" /> + </and> + </condition> + <condition property="isLinuxAMD64"> + <and> + <istrue value="${isLinux}" /> + <os arch="AMD64" /> + </and> + </condition> + <condition property="isLinuxIA64"> + <and> + <istrue value="${isLinux}" /> + <os arch="IA64" /> + </and> + </condition> + <condition property="isIA64"> + <os arch="IA64" /> + </condition> + <!-- Note: assumes X11 platform by default --> + <condition property="isX11"> + <and> + <isfalse value="${isWindows}" /> + <isfalse value="${isOSX}" /> + </and> + </condition> + + <echo message="OS X=${isOSX}" /> + <echo message="Windows=${isWindows}" /> + <echo message="Unix=${isUnix}" /> + <echo message="Linux=${isLinux}" /> + <echo message="Solaris=${isSolaris}" /> + <echo message="FreeBSD=${isFreeBSD}" /> + <echo message="LinuxAMD64=${isLinuxAMD64}" /> + <echo message="LinuxIA64=${isLinuxIA64}" /> + <echo message="IA64=${isIA64}" /> + <echo message="X11=${isX11}" /> + + <property name="gluegen.cpptasks.detected.os" value="true" /> + </target> + + <!-- Detect compiler setup, in particular on Windows; separated + - out because this must sometimes be called late in the setup process + --> + <target name="gluegen.cpptasks.detect.compiler"> + <!-- Set up compiler selection on Windows --> + <condition property="isVC6"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="vc6" /> + </and> + </condition> + <condition property="isVC7"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="vc7" /> + </and> + </condition> + <condition property="isVC8"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="vc8" /> + </and> + </condition> + <condition property="isMingW"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="mingw" /> + </and> + </condition> + <condition property="WindowsFailure"> + <and> + <istrue value="${isWindows}" /> + <isfalse value="${isVC6}" /> + <isfalse value="${isVC7}" /> + <isfalse value="${isVC8}" /> + <isfalse value="${isMingW}" /> + </and> + </condition> + <fail message="Must specify either win32.c.compiler in jogl.properties or use e.g. win32.vc6 build target" if="WindowsFailure" /> + <echo message="VC6=${isVC6}" /> + <echo message="VC7=${isVC7}" /> + <echo message="VC8=${isVC8}" /> + <echo message="MingW=${isMingW}" /> + + <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally --> + <property name="c.compiler.debug" value="false" /> + </target> +</project> diff --git a/make/gluegen.properties b/make/gluegen.properties new file mode 100755 index 0000000..9ca1f06 --- /dev/null +++ b/make/gluegen.properties @@ -0,0 +1,17 @@ +############################################################################### +# The host specific properties. The build will inform you of required +# properties. This file must be copied into your home directory (pointed +# to by the Java system property user.home) and the copy modified appropriately. +############################################################################### +# +# The required antlr.jar property that is the full path to the antlr.jar +# including the name of the jar +# +# Windows +antlr.jar=C:/Users/kbr/ANTLR/antlr-2.7.2/antlr.jar +# Linux +# antlr.jar=/home/kbr/antlr-2.7.2/antlr.jar +# Mac OS X +# antlr.jar=/Users/kbr/antlr-2.7.2/antlr.jar +# Solaris +# antlr.jar=/export/kbr/ANTLR/antlr-2.7.2/antlr.jar diff --git a/make/lib/cpptasks-patch.tar.gz b/make/lib/cpptasks-patch.tar.gz Binary files differnew file mode 100644 index 0000000..22f1cde --- /dev/null +++ b/make/lib/cpptasks-patch.tar.gz diff --git a/make/lib/cpptasks-version.txt b/make/lib/cpptasks-version.txt new file mode 100755 index 0000000..2e7dd72 --- /dev/null +++ b/make/lib/cpptasks-version.txt @@ -0,0 +1,4 @@ +Current cpptasks is from CVS repository at +:pserver:[email protected]:/cvsroot/ant-contrib +as of 10/5/2005 with patches applied for Forte C compiler (Bug +1314266) and fat binary generation on Mac OS X (Bug 1313421). diff --git a/make/lib/cpptasks.jar b/make/lib/cpptasks.jar Binary files differnew file mode 100755 index 0000000..005691c --- /dev/null +++ b/make/lib/cpptasks.jar diff --git a/make/validate-properties.xml b/make/validate-properties.xml new file mode 100755 index 0000000..195fb2a --- /dev/null +++ b/make/validate-properties.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + - A validator for all of the user-defined properties. It will be called + - from build.xml in the "init" task. + --> +<project name="Configuration validator" default="validate"> + + <!-- ================================================================== --> + <!-- + - Ensure that "antlr.jar" is set. + --> + <target name="antlr.jar.validate" unless="antlr.jar"> + <fail> + + ******************************************************************** + ** The property "antlr.jar" was not set in the GlueGen properties ** + ** file ** + ** "${user.properties.file}" ** + ** (or this file was not found). ** + ** ** + ** Please set "antlr.jar" to to the full path of the ANTLR jar ** + ** including the jar itself. ** + ******************************************************************** + </fail> + </target> + + <!-- + - Make sure that gluegen.jar is not on the CLASSPATH; this can cause + - builds to fail since if this Java process has the jar file open + - we can not overwrite it. + --> + <target name="java.class.path.validate"> + <available property="gluegen.jar.on.class.path" classname="com.sun.gluegen.GlueGen" /> + <fail if="gluegen.jar.on.class.path"> + ******************************************************************* + ** Your CLASSPATH environment variable appears to be set (some ** + ** GlueGen classes are currently visible to the build.) This can ** + ** cause the build to fail. Please unset your CLASSPATH ** + ** variable and restart the build. ** + ******************************************************************* + </fail> + </target> + + <!-- ================================================================== --> + <!-- + - Validate the required properties + --> + <target name="validate" depends="antlr.jar.validate, java.class.path.validate" + description="Validate required properties" /> + +</project> |