Mercurial > hg > tema
changeset 14:992793931a2f
Add dist.native task (compiles Tema to native code).
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Tue, 24 Mar 2009 17:57:28 +0300 |
parents | ac5f1bc82b13 |
children | e9d13c7ffeb1 |
files | build.xml compile-native |
diffstat | 2 files changed, 37 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/build.xml Tue Mar 24 16:00:55 2009 +0300 +++ b/build.xml Tue Mar 24 17:57:28 2009 +0300 @@ -10,11 +10,15 @@ <property name="doc" value="doc"/> <property name="lib" value="${dist}/lib"/> <property name="jar_file" value="tema.jar"/> + <property name="native_file" value="tema"/> + <property name="main_class" value="kryshen.tema.Tema"/> + <property name="task_class" value="kryshen.tema.ant.TemaTask"/> <property name="ant_jar" value="/usr/share/java/ant.jar"/> + <property name="gcj" value="gcj"/> <path id="project.libs"> - <fileset dir="${lib}"> + <fileset id="project.libs.fileset" dir="${lib}"> <include name="**/*.jar"/> </fileset> </path> @@ -36,16 +40,39 @@ <fileset dir="${res}"/> </copy> </target> - + <target name="dist" depends="compile"> <jar jarfile="${dist}/${jar_file}" manifest="${src}/Manifest.mf"> <fileset dir="${build}" includes="**/*.class"/> <fileset dir="${build}" includes="**/*.template"/> </jar> </target> - + + <target name="dist.native" depends="compile"> + <property name="demo_template" value="kryshen/tema/demo/demo.template"/> + + <exec executable="${gcj}"> + <arg value="-c"/> + <arg value="-o"/> + <arg value="${build}/${demo_template}.o" /> + <arg value="--resource" /> + <arg value="${demo_template}" /> + <arg value="${build}/${demo_template}" /> + </exec> + + <apply executable="${gcj}" parallel="true"> + <fileset dir="${build}" + includes="**/*.class **/*.o" + excludes="kryshen/tema/ant/**"/> + <fileset refid="project.libs.fileset"/> + <arg value="--main=${main_class}"/> + <arg value="-o"/> + <arg value="${dist}/${native_file}"/> + </apply> + </target> + <target name="run" depends="compile"> - <java classname="kryshen.tema.Tema" fork="true"> + <java classname="${main_class}" fork="true"> <classpath> <pathelement location="${build}"/> <path refid="project.libs"/> @@ -54,7 +81,7 @@ </target> <target name="run.demo" depends="compile"> - <java classname="kryshen.tema.Tema" fork="true"> + <java classname="${main_class}" fork="true"> <classpath> <pathelement location="${build}"/> <path refid="project.libs"/> @@ -65,7 +92,7 @@ <target name="doc.manual" depends="dist"> <taskdef name="tema" - classname="kryshen.tema.ant.TemaTask" + classname="${task_class}" classpath="${dist}/tema.jar"/> <tema infile="${doc}/manual/manual.tema" @@ -88,17 +115,20 @@ compression="gzip"> <tarfileset dir="${basedir}" prefix="${ant.project.name}-${version}"> + <exclude name=".hg/**"/> + <exclude name=".hg*"/> <exclude name="${build}/**"/> <exclude name="misc/**"/> <exclude name="test/**"/> <exclude name="nbproject/**"/> <exclude name="${dist}/${ant.project.name}-*.tar.gz"/> <exclude name="${dist}/tema"/> + <exclude name="${dist}/tema.sh"/> </tarfileset> <tarfileset dir="${basedir}" prefix="${ant.project.name}-${version}" mode="755"> - <include name="${dist}/tema"/> + <include name="${dist}/tema.sh"/> </tarfileset> </tar> </target>
--- a/compile-native Tue Mar 24 16:00:55 2009 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# -# Compile Tema to native code using GCJ. -# - -ant compile - -compile_classes=$(find build -name '*.class' | grep -v tema/ant) - -gcj -o build/demo.template.o -c --resource kryshen/tema/demo/demo.template build/kryshen/tema/demo/demo.template -gcj -g --main=kryshen.tema.Tema -o dist/tema dist/lib/commons-cli-1.1.jar $compile_classes build/demo.template.o - -rm build/demo.template.o