summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/build.xml19
-rw-r--r--make/lib/gluegen.compiler.linux-32bit.xml38
-rw-r--r--make/make.gluegen.all.linux-x86.sh1
-rw-r--r--test/junit/com/sun/gluegen/BasicTest.java2
-rw-r--r--test/junit/com/sun/gluegen/BuildUtil.java29
-rw-r--r--test/junit/com/sun/gluegen/StructAccessorTest.java2
-rw-r--r--test/junit/com/sun/gluegen/build.xml25
7 files changed, 88 insertions, 28 deletions
diff --git a/make/build.xml b/make/build.xml
index 75c28f5..2209d57 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -571,26 +571,29 @@
</target>
<target name="test" depends="init">
- <mkdir dir="${gluegen.root}/build/test/build/classes"/>
- <mkdir dir="${gluegen.root}/build/test/results"/>
+ <mkdir dir="${build}/test/build/classes"/>
+ <mkdir dir="${build}/test/results"/>
<property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
- <javac destdir="${gluegen.root}/build/test/build/classes" failonerror="false" source="1.5" srcdir="${gluegen.root}/test/junit" debug="true" debuglevel="lines,vars,source">
- <classpath path="${gluegen.root}/make/lib/junit-4.5.jar:${gluegen.root}/build/classes:${gluegen.root}/build/test/gensrc/java:${tools.jar}:${ant.core.lib}"/>
+ <javac destdir="${build}/test/build/classes" failonerror="false" source="1.5" srcdir="${gluegen.root}/test/junit" debug="true" debuglevel="lines,vars,source">
+ <classpath path="${gluegen.root}/make/lib/junit-4.5.jar:${build}/classes:${build}/test/gensrc/java:${tools.jar}:${ant.core.lib}"/>
</javac>
<junit forkmode="once" showoutput="true" fork="true">
- <jvmarg value="-Djava.library.path=${gluegen.root}/build/test/build/natives"/>
- <batchtest todir="${gluegen.root}/build/test/results">
- <fileset dir="${gluegen.root}/build/test/build/classes">
+ <jvmarg value="-Djava.library.path=${build}/test/build/natives"/>
+ <jvmarg value="-Drootrel.build=${rootrel.build}"/>
+ <jvmarg value="-Dos.arch=${os.arch}"/>
+ <jvmarg value="-Dgluegen.user.compiler.file=${gluegen.user.compiler.file}"/>
+ <batchtest todir="${build}/test/results">
+ <fileset dir="${build}/test/build/classes">
<include name="com/sun/gluegen/**Test*"/>
</fileset>
<formatter usefile="false" type="brief"/>
<formatter usefile="true" type="xml"/>
</batchtest>
<classpath>
- <path path="${gluegen.root}/build/test/build/classes:${gluegen.root}/build/test/gensrc/java:${gluegen.root}/build/classes:${antlr.jar}:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/>
+ <path path="${build}/test/build/classes:${build}/test/gensrc/java:${build}/classes:${antlr.jar}:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/>
</classpath>
</junit>
</target>
diff --git a/make/lib/gluegen.compiler.linux-32bit.xml b/make/lib/gluegen.compiler.linux-32bit.xml
new file mode 100644
index 0000000..ce1554c
--- /dev/null
+++ b/make/lib/gluegen.compiler.linux-32bit.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ This is an example of how to add custom compiler/linker
+ arguments for a crosscompiler.
+
+ You can use such files with setting the property 'gluegen.user.compiler.file', ie:
+
+ -Dgluegen.user.compiler.file=`pwd`/lib/gluegen.compiler.xml
+
+ or by having such file in your home directory, ie:
+
+ ~/gluegen.compiler.xml
+
+ In case you want to compile for 32bit on a 64bit machine,
+ you might also need to set the 'os.arch' to 'x86'.
+ Example: gluegen/make/make.gluegen.all.linux-x86.sh
+
+ More properties need to be overwritten in case you like to change the
+ target OS .. and/or components, see gluegen-cpptasks.xml for more information.
+ -->
+
+<project name="GlueGen-cpptasks" basedir="." >
+
+<target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir">
+ <compiler id="compiler.cfg.linux" name="gcc">
+ <compilerarg value="-m32" />
+ <compilerarg value="-Wall" />
+ <defineset>
+ <define name="LINUX" />
+ </defineset>
+ </compiler>
+
+ <linker id="linker.cfg.linux" name="gcc">
+ <linkerarg value="-m32" />
+ </linker>
+</target>
+</project>
diff --git a/make/make.gluegen.all.linux-x86.sh b/make/make.gluegen.all.linux-x86.sh
index 87352c3..b76d85f 100644
--- a/make/make.gluegen.all.linux-x86.sh
+++ b/make/make.gluegen.all.linux-x86.sh
@@ -10,6 +10,7 @@
# -DisX11=true \
ant \
+ -Dgluegen.user.compiler.file=`pwd`/lib/gluegen.compiler.linux-32bit.xml \
-Drootrel.build=build-x86 \
-Dos.arch=x86 \
$* 2>&1 | tee make.gluegen.all.linux-x86.log
diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java
index a43d3e5..144128c 100644
--- a/test/junit/com/sun/gluegen/BasicTest.java
+++ b/test/junit/com/sun/gluegen/BasicTest.java
@@ -44,7 +44,7 @@ public class BasicTest {
@Test
public void bindingTest() throws Exception {
- String nativesPath = gluegenRoot + "/build/test/build/natives";
+ String nativesPath = testOutput + "/build/natives";
System.load(nativesPath + "/librofl.so");
Class<?> clazz = Class.forName("test.BindingTest");
diff --git a/test/junit/com/sun/gluegen/BuildUtil.java b/test/junit/com/sun/gluegen/BuildUtil.java
index de4f8e2..4477d7b 100644
--- a/test/junit/com/sun/gluegen/BuildUtil.java
+++ b/test/junit/com/sun/gluegen/BuildUtil.java
@@ -17,7 +17,8 @@ public final class BuildUtil {
public static final String gluegenRoot;
public static final String path;
- public static final String output;
+ public static final String testOutput;
+ public static final String rootrel_build;
static {
@@ -25,6 +26,13 @@ public final class BuildUtil {
out.println("OS: " + System.getProperty("os.name"));
out.println("VM: " + System.getProperty("java.vm.name"));
+ String rootrel_build_tmp = System.getProperty("rootrel.build");
+ if(null==rootrel_build_tmp || rootrel_build_tmp.length()==0) {
+ rootrel_build_tmp = "build" ;
+ }
+ rootrel_build = rootrel_build_tmp;
+ out.println("rootrel.build: " + rootrel_build);
+
// setup paths
try {
File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI());
@@ -36,10 +44,10 @@ public final class BuildUtil {
}
path = gluegenRoot + "/test/junit/com/sun/gluegen";
- output = gluegenRoot + "/build/test";
+ testOutput = gluegenRoot + "/" + rootrel_build + "/test";
out.println("path: "+path);
- out.println("output: "+output);
+ out.println("testOutput: "+testOutput);
out.println(" - - - - - - - - - - - - ");
cleanGeneratedFiles();
@@ -47,6 +55,9 @@ public final class BuildUtil {
//setup ant build file
project = new Project();
project.setBaseDir(new File(gluegenRoot));
+ project.setProperty("rootrel.build", rootrel_build);
+ passSystemProperty(project, "gluegen.user.compiler.file");
+ passSystemProperty(project, "os.arch");
DefaultLogger logger = new DefaultLogger();
logger.setErrorPrintStream(out);
@@ -64,9 +75,17 @@ public final class BuildUtil {
ProjectHelper.configureProject(project, buildFile);
}
+ public static Project passSystemProperty(Project p, String name) {
+ String tmp = System.getProperty(name);
+ if(null!=tmp && tmp.length()>0) {
+ p.setProperty(name, tmp);
+ }
+ return p;
+ }
+
public static void cleanGeneratedFiles() {
out.println("cleaning generated files");
- deleteDirectory(new File(output+"/gensrc"));
+ deleteDirectory(new File(testOutput+"/gensrc"));
out.println("done");
}
@@ -95,7 +114,7 @@ public final class BuildUtil {
out.println("generate binding: " + bindingName);
GlueGen.main( "-I"+path,
- "-O"+output+"/gensrc",
+ "-O"+testOutput+"/gensrc",
// "-Ecom.sun.gluegen.DebugEmitter",
"-C"+path+"/"+bindingName+".cfg",
path+"/"+bindingName+".h" );
diff --git a/test/junit/com/sun/gluegen/StructAccessorTest.java b/test/junit/com/sun/gluegen/StructAccessorTest.java
index 0cd2953..3562077 100644
--- a/test/junit/com/sun/gluegen/StructAccessorTest.java
+++ b/test/junit/com/sun/gluegen/StructAccessorTest.java
@@ -46,7 +46,7 @@ public class StructAccessorTest {
// compile testcase
String source = gluegenRoot + "/test/junit/com/sun/gluegen/StructValidator.java";
- compile(new File(source), gluegenRoot+"/build/test/build/classes");
+ compile(new File(source), testOutput + "/build/classes");
// invoke test
Class<?> test = Class.forName("com.sun.gluegen.StructValidator");
diff --git a/test/junit/com/sun/gluegen/build.xml b/test/junit/com/sun/gluegen/build.xml
index c52101e..ab71431 100644
--- a/test/junit/com/sun/gluegen/build.xml
+++ b/test/junit/com/sun/gluegen/build.xml
@@ -4,9 +4,15 @@
<description>Tests GlueGen</description>
+ <condition property="rootrel.build" value="build">
+ <not>
+ <isset property="rootrel.build"/>
+ </not>
+ </condition>
+
<property name="gluegen.root" value="${basedir}" />
- <property name="src.dir" value="${gluegen.root}/build/test/gensrc/java" />
- <property name="build.dir" value="${gluegen.root}/build/test/build" />
+ <property name="src.dir" value="${gluegen.root}/${rootrel.build}/test/gensrc/java" />
+ <property name="build.dir" value="${gluegen.root}/${rootrel.build}/test/build" />
<!-- Pull in GlueGen cpptasks build file -->
<import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
@@ -25,7 +31,7 @@
<javac destdir="${build.dir.java}" source="1.5" failonerror="true" debug="true" verbose="true" debuglevel="lines,vars,source">
<src path="${src.dir}"/>
- <classpath path="${gluegen.root}/build/classes:${src.dir}:${gluegen.root}/build/antlr-3.2.jar:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/>
+ <classpath path="${gluegen.root}/${rootrel.build}/classes:${src.dir}:${gluegen.root}/${rootrel.build}/antlr-3.2.jar:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/>
</javac>
<echo message=" - - - java files compiled - - - "/>
@@ -74,7 +80,7 @@
<echo message=" - - - natives compiled - - - "/>
<copy todir="${natives.dir}">
- <fileset dir="${gluegen.root}/build/obj">
+ <fileset dir="${gluegen.root}/${rootrel.build}/obj">
<include name="*.so"/>
</fileset>
</copy>
@@ -82,15 +88,8 @@
</target>
<target name="c.configure.linux" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler">
-
- <echo message="configure for Linux.AMD64 build" />
-
- <linker id="linker.cfg.linux.amd64.test">
- <linkerparam name="-m64"/>
- </linker>
-
- <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
- <property name="linker.cfg.id" value="linker.cfg.linux.amd64.test" />
+ <property name="compiler.cfg.id" value="${compiler.cfg.id.base}" />
+ <property name="linker.cfg.id" value="${linker.cfg.id.base}" />
</target>
</project>