source: tags/0.12.0/j/build.xml

Last change on this file was 11434, checked in by ehuelsmann, 15 years ago

Merge open-external-format branch back to trunk.

  • Property svn:eol-style set to LF
File size: 17.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="antlib:org.apache.tools.ant"
3   name="abcl-master" default="help" basedir=".">
4    <description>Armed Bear Common Lisp</description>
5
6    <target name="abcl" depends="abcl.wrapper"/>
7
8    <property file="build.properties"/>
9
10    <property name="build.dir" 
11        value="${basedir}/build"/>
12    <property name="build.classes.dir" 
13        value="${build.dir}/classes"/>
14    <property name="src.dir" 
15        value="${basedir}/src"/>
16    <property name="dist.dir" 
17        value="${basedir}/dist"/>
18    <property name="abcl.jar.path"
19        value="${dist.dir}/abcl.jar"/>
20    <property name="j.jar.path"
21        value="${dist.dir}/j.jar"/>
22
23    <target name="help">
24      <echo>Main Ant targets:
25 abcl.compile 
26   -- compile ABCL to ${build.classes.dir}
27 abcl.jar     
28   -- create packaged ${abcl.jar.path}
29 abcl.wrapper 
30   -- create executable wrapper for ABCL
31 abcl.source.zip abcl.source.tar
32    -- create source distributions in ${dist.dir}
33 abcl.clean
34    -- remove ABCL intermediate files</echo>
35      <echo>Corresponding targets for J exist, but currently aren't as well tested.
36      </echo>
37    </target>
38
39    <property name="abcl.version.path"
40        value="${build.classes.dir}/org/armedbear/lisp/version"/>
41    <property name="abcl.build.path"
42        value="${build.classes.dir}/org/armedbear/lisp/build"/>
43    <property name="j.version.path"
44        value="${build.classes.dir}/org/armedbear/j/version"/>
45    <property name="j.build.path"
46        value="${build.classes.dir}/org/armedbear/j/build"/>
47
48    <target name="abcl.stamp" depends="abcl.compile">
49      <tstamp>
50         <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
51      </tstamp>
52      <mkdir dir="${abcl.build.path}/.."/>
53      <echo message="${build}" file="${abcl.build.path}"/>   
54      <condition property="unix"> 
55  <or>
56    <os family="unix"/>
57    <os family="mac"/>
58  </or>
59      </condition>
60
61      <condition property="windows"> <os family="windows"/></condition>
62
63      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
64     property="abcl.lisp.p"/>
65
66      <antcall target="abcl.stamp.version"/>
67      <antcall target="abcl.stamp.hostname"/>
68    </target>
69
70    <target name="j.stamp" depends="abcl.stamp,j.compile">
71      <echo message="${build}" file="${j.build.path}"/>   
72    </target>
73
74    <target name="abcl.stamp.version" depends="abcl.compile">
75      <java fork="true"
76      classpath="${build.classes.dir}"
77      outputproperty="abcl.version"
78      classname="org.armedbear.lisp.Main">
79  <arg value="--noinit"/>
80  <arg value="--noinform"/>
81  <arg value="--eval"/>
82  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
83      </java>
84
85      <echo>Building ABCL version: ${abcl.version}</echo>
86      <mkdir dir="${abcl.version.path}/.."/>
87      <echo message="${abcl.version}" file="${abcl.version.path}"/> 
88    </target>
89
90    <target name="abcl.stamp.hostname">
91      <property name="j.build.path"
92    value="${build.classes.dir}/org/armedbear/j/build"/>
93      <exec executable="hostname" outputproperty="abcl.hostname"/>
94      <echo>abcl.hostname: ${abcl.hostname}</echo>
95    </target>
96
97    <target name="j.stamp.hostname">
98      <echo message="${abcl.hostname}" file="${j.build.path}" append="yes"/>
99    </target>
100
101    <patternset id="abcl.source.java">
102      <include name="org/armedbear/lisp/*.java"/>
103      <include name="org/armedbear/lisp/util/*.java"/>
104      <include name="org/armedbear/Main.java"/>
105    </patternset>
106   
107    <patternset id="abcl.source.lisp">
108      <include name="org/armedbear/lisp/*.lisp"/>
109      <include name="org/armedbear/lisp/tests/*.lisp"/>
110      <include name="org/armedbear/lisp/java/awt/*.lisp"/>
111      <include name="org/armedbear/lisp/java/awt/*.java"/>
112    </patternset>
113
114    <!-- Lisp files required at runtime -->
115    <patternset id="abcl.source.lisp.dist">
116      <include name="org/armedbear/lisp/boot.lisp"/>
117    </patternset>
118
119    <patternset id="abcl.objects">
120      <include name="org/armedbear/lisp/*.class"/>
121      <include name="org/armedbear/lisp/util/*.class"/>
122      <include name="org/armedbear/lisp/*.cls"/> 
123      <include name="org/armedbear/lisp/*.abcl"/>
124      <patternset refid="abcl.source.lisp.dist"/>
125    </patternset>
126   
127    <patternset id="j.source">
128      <include name="Main.java"/>
129      <include name="gnu/regexp/*.java"/>
130      <include name="org/armedbear/j/**/*.java"/>
131      <!-- Assumed to need the org.armedbear.lisp.awt.* classes as ABCL
132           itself doesn't seem to need them. -->
133      <include name="org/armedbear/lisp/awt/*.class"/>
134    </patternset>
135
136    <patternset id="j.objects">
137      <patternset refid="abcl.objects"/>
138      <include name="Main.class"/>
139      <include name="gnu/regexp/*.class"/>
140      <include name="org/armedbear/j/**/*.class"/>
141    </patternset>
142
143    <patternset id="j.resources.src">
144      <include name="**/*.keywords"/>
145      <include name="org/armedbear/j/version"/>
146      <include name="org/armedbear/j/build"/>
147      <include name="org/armedbear/j/snapshot"/>
148      <include name="org/armedbear/j/images/*.png"/>
149      <include name="gnu/regexp/MessagesBundle.properties"/>
150    </patternset>
151
152    <patternset id="j.resources.top">
153      <include name="COPYING"/>
154      <include name="doc/*.html"/>
155      <include name="doc/*.css"/>
156      <include name="themes/*"/>
157      <include name="examples/*"/>
158    </patternset>
159
160    <path id="abcl.classpath.dist">
161      <pathelement location="${abcl.jar.path}"/>
162    </path>
163   
164    <path id="abcl.classpath.build">
165      <pathelement location="${build.classes.dir}"/>
166    </path>
167
168    <target name="abcl.compile" depends="abcl.pre-compile,abcl.compile.lisp">
169      <echo>Compiled ABCL with java version: ${java.version}</echo>
170    </target>
171
172    <target name="j.pre-compile" depends="abcl.pre-compile"/>
173
174    <target name="abcl.pre-compile">
175      <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
176                                                atleast="1.7"/> -->
177      <mkdir dir="${build.dir}"/>
178      <mkdir dir="${build.classes.dir}"/>
179
180      <property name="j.compile.version.path"
181    value="${build.classes.dir}/org/armedbear/j/version"/>
182
183      <property name="java.path"
184    value="${java.home}/bin/java"/>
185
186      <exec executable="hostname" os="unix" 
187      outputproperty="abcl.compile.hostname"/>
188      <exec executable="uname" os="unix" 
189      outputproperty="abcl.compile.uname">
190  <arg value="-a"/>
191      </exec>
192
193      <exec executable="hostname" os="Linux" outputproperty="hostname"/>
194
195      <condition property="abcl.java.version">
196  <or>
197    <matches string="${java.version}" pattern="1\.5"/>
198    <matches string="${java.version}" pattern="1\.6\.0_1[0-9]"/>
199  </or> 
200      </condition>
201      <echo>java.version: ${java.version}</echo>
202    </target>
203   
204    <target name="abcl.java.warning" 
205      depends="abcl.pre-compile"
206      unless="abcl.java.version">
207      <echo>WARNING: Java version ${java.version} not recommended.</echo>
208    </target>
209 
210    <target name="abcl.compile.java" 
211      depends="abcl.pre-compile,abcl.java.warning">
212      <tstamp>
213  <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
214      </tstamp>
215
216      <javac destdir="${build.classes.dir}"
217       debug="true"
218       target="1.5">
219  <src path="${src.dir}"/>
220  <patternset refid="abcl.source.java"/>
221      </javac>
222      <echo message="${build}" 
223      file="${build.classes.dir}/org/armedbear/lisp/build"/>
224    </target>
225
226    <target name="j.compile" depends="j.pre-compile">
227      <javac destdir="${build.classes.dir}"
228       debug="true"
229       target="1.5">
230  <src path="${src.dir}"/>
231  <patternset refid="j.source"/>
232      </javac>
233    </target>
234
235    <target name="abcl.copy.lisp">
236      <copy todir="${build.classes.dir}" preservelastmodified="yes">
237  <fileset dir="${src.dir}">
238    <patternset refid="abcl.source.lisp"/>
239  </fileset>
240      </copy>
241    </target>
242
243    <!-- Adjust the patternset for ABCL source to use the much faster
244         Ant 'uptodate' task to check if we need to compile the system
245         fasls. -->
246    <patternset id="abcl.source.lisp.fasls">
247      <patternset refid="abcl.source.lisp"/>
248      <exclude name="org/armedbear/lisp/tests/*.lisp"/>
249      <exclude name="org/armedbear/lisp/boot.lisp"/>
250      <exclude name="org/armedbear/lisp/emacs.lisp"/>
251      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
252      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
253      <exclude name="org/armedbear/lisp/j.lisp"/>
254    </patternset>
255
256    <target name="abcl.fasls.uptodate">
257      <uptodate property="abcl.fasls.uptodate.p" value="true">
258  <srcfiles dir="${build.classes.dir}">
259    <patternset refid="abcl.source.lisp.fasls"/>
260  </srcfiles>
261  <mapper type="glob" from="*.lisp" to="*.abcl"/>
262      </uptodate>
263    </target>
264   
265    <target name="abcl.compile.lisp" 
266      depends="abcl.copy.lisp,abcl.compile.java,abcl.fasls.uptodate"
267      unless="abcl.fasls.uptodate.p">
268      <java classpath="${build.classes.dir}"
269      fork="true"
270      classname="org.armedbear.lisp.Main">
271  <arg value="--noinit"/>
272  <arg value="--eval"/>
273  <arg value="(compile-system :zip nil :quit t)"/>
274      </java>
275    </target>
276
277    <target name="abcl.jar" depends="abcl.compile,abcl.stamp">
278      <mkdir dir="${dist.dir}"/>
279      <loadfile property="abcl.version"
280      srcFile="${abcl.version.path}"/>
281      <jar destfile="${abcl.jar.path}"
282     compress="true"
283     basedir="${build.classes.dir}">
284  <patternset refid="abcl.objects"/>
285  <manifest>
286    <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
287    <section name="org/armedbear/lisp">
288      <attribute name="Implementation-Title" 
289           value="ABCL"/>
290      <attribute name="Implementation-Version" 
291           value="${abcl.version}"/>
292      <attribute name="Implementation-Build" 
293           value="${build}"/>
294    </section>
295  </manifest>
296      </jar>
297    </target>
298   
299    <target name="abcl.debug.jpda" depends="abcl.jar">
300      <description>Invoke ABCL with JPDA listener on port 6789</description>
301      <java fork="true"
302      classpathref="abcl.classpath.dist"
303      classname="org.armedbear.lisp.Main">
304  <jvmarg 
305      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
306      </java>
307    </target>
308
309    <target name="abcl.run" depends="abcl.jar">
310      <java fork="true"
311      classpathref="abcl.classpath.dist"
312      classname="org.armedbear.lisp.Main">
313      </java>
314    </target>
315
316    <target name="abcl.wrapper" 
317      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
318      <description>
319  Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
320      </description>
321      <!-- Set from commandline or in 'build.properties' -->
322      <property name="additional.jars" value=""/>
323      <path id="abcl.runtime.classpath">
324  <pathelement location="${abcl.jar.path}"/>
325  <pathelement path="${additional.jars}"/>
326      </path>
327      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
328      <property name="java.options" value=""/>
329
330      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
331  <filterset>
332    <filter token="JAVA" 
333      value="${java.path}"/>
334    <filter token="ABCL_JAVA_OPTIONS" 
335      value= "${java.options}"/>
336    <filter token="ABCL_LIBPATH" 
337      value="${basedir}/src/org/armedbear/lisp/libabcl.so"/>
338    <filter token="ABCL_CLASSPATH" 
339      value="${toString:abcl.runtime.classpath}"/>
340  </filterset>
341      </copy>
342      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
343      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
344    </target>
345
346    <target name="abcl.wrapper.unix" if="unix">
347      <property name="abcl.wrapper.file" value="abcl"/>
348      <property name="abcl.wrapper.in.file" value="abcl.in"/>
349    </target>
350
351    <target name="abcl.wrapper.windows" if="windows">
352      <property name="abcl.wrapper.file" value="abcl.bat"/>
353      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
354    </target>
355
356    <target name="j.jar" depends="j.compile,j.stamp">
357      <copy todir="${build.classes.dir}">
358  <fileset dir="${basedir}/src">
359    <patternset refid="j.objects"/>
360    <patternset refid="j.resources.src"/>
361  </fileset>
362      </copy>
363      <jar destfile="${j.jar.path}" 
364     compress="true"
365     basedir="${build.classes.dir}">
366  <patternset refid="j.objects"/>
367  <patternset refid="j.resources.src"/>
368  <manifest>
369    <attribute name="Main-Class" value="Main"/>
370    <section name="org/armedbear/lisp">
371      <attribute name="Implementation-Title" value="ABCL"/>
372      <attribute name="Implementation-Version"  value="${abcl.version}"/>
373    </section>
374  </manifest>
375      </jar>
376    </target>
377
378    <target name="j.dist" depends="j.jar">
379      <mkdir dir="${dist.dir}"/>
380      <copy todir="dist">
381  <fileset dir="${basedir}">
382    <patternset refid="j.resources.top"/>
383  </fileset>
384      </copy>
385    </target>
386
387    <target name="abcl.clean">
388      <delete dir="${build.dir}"/>
389      <delete file="abcl"/>
390    </target>
391
392    <target name="abcl.dist" depends="abcl.jar">
393      <copy file="${abcl.jar.path}"
394      toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
395    </target>
396
397    <target name="abcl.distclean" depends="abcl.clean">
398      <delete dir="${dist.dir}"/>
399      <delete file="abcl"/>
400      <delete file="j"/>
401    </target>
402
403    <target name="TAGS">
404      <apply executable="etags" parallel="true" verbose="true">
405  <fileset dir="${src.dir}">
406    <patternset refid="abcl.source.java"/>
407    <patternset refid="abcl.source.lisp"/>
408  </fileset>
409      </apply>
410    </target>
411
412    <target name="j.jpty" depends="j.jpty.compile"/>
413
414    <target name="j.jpty.compile" if="unix">
415      <exec executable="gcc" dir="${src.dir}/jpty">
416  <arg line="-Wall -O2 jpty.c -o jpty"/>
417      </exec>
418    </target>
419
420    <target name="j.install" depends="j.jar,j.install.unix,j.install.windows">
421      <property name="j.install.data.dir" value="${j.install.root}/share"/>
422      <property name="j.install.bin.dir" value="${j.install.root}/bin"/>
423
424      <mkdir dir="${j.install.data.dir}/j"/>
425      <copy file="${dist.dir}/j.jar" todir="${j.install.data.dir}/j"/>
426      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
427      <property name="java.options" value=""/>
428      <copy file="${j.wrapper.file}.in" toFile="${j.install.bin.dir}/${j.wrapper.file}">
429  <filterset>
430    <filter token="JAVA" 
431      value="${java.path}"/>
432    <filter token="JAVA_OPTIONS" 
433      value="${java.options}"/>
434    <filter token="CLASSPATH"
435      value="${j.install.data.dir}/j/j.jar"/>
436  </filterset>
437      </copy>
438      <chmod file="${j.install.bin.dir}/j" perm="ugo+rx"/>
439
440      <property name="j.install.themes.path"
441    value="${j.install.data.dir}/j/themes"/>
442      <mkdir dir="${j.install.themes.dir}"/>
443      <copy todir="{j.install.themes.dir}">
444  <fileset dir="${basedir}/themes"/>
445      </copy>
446
447      <property name="j.install.doc.path"
448    value="${j.install.data.dir}/doc/j"/>
449      <mkdir dir="${j.install.doc.dir}" />
450
451      <copy file="${basedir}/src/jpty/jpty" 
452            todir="${j.install.bin.dir}"
453      failonerror="false"/>
454      <chmod file="${j.install.bin.dir}/jpty" perm="ugo+rx"/>
455      <copy todir="${j.install.data.dir}/doc/j">
456  <fileset dir="${basedir}/doc"/>
457      </copy>
458    </target>
459
460    <target name="j.install.unix" depends="j.jpty" if="unix">
461      <property name="j.install.root" value="/usr/local"/>
462      <property name="j.wrapper.file" value="j"/>
463    </target>
464
465    <target name="j.install.windows" depends="j.jpty" if="windows">
466      <property name="j.install.root" value="c:/j"/>
467      <property name="j.wrapper.file" value="j.bat"/>
468    </target>
469
470    <patternset id="abcl.dist.misc"
471    description="Additional includes in the source distributions relative to basedir">
472      <include name="build.xml"/>
473      <include name="build.properties.in"/>
474      <include name="COPYING"/>
475      <include name="README"/>
476      <include name="abcl.in"/>
477      <include name="abcl.bat.in"/>
478     
479      <!-- The remainder of these files are used by BUILD-ABCL to
480           build ABCL from Lisp but not used by Ant, include them in
481           the source distribution. -->
482      <include name="make-jar.in"/>
483      <include name="make-jar.bat.in"/>
484
485      <include name="build-abcl.lisp"/>
486      <include name="customizations.lisp.in"/>
487
488      <include name="test-abcl.asd"/>
489      <include name="build-abcl.asd"/>
490    </patternset>
491
492    <patternset id="abcl.source.misc"
493    description="Additional includes in the source distribution relative to source root">
494      <include name="org/armedbear/lisp/LICENSE"/>
495      <include name="manifest-abcl"/>
496    </patternset>
497   
498    <target name="abcl.source.prepare" depends="abcl.stamp.version">
499      <property name="abcl.source.eol" value="asis"/>
500      <echo>Using '${abcl.source.eol}' to drive line-ending transformations.</echo>
501      <property name="abcl.build.src.dir"
502    value="${build.dir}/abcl-src-${abcl.version}"/>
503      <mkdir dir="${abcl.build.src.dir}/src"/>
504      <fixcrlf srcdir="${src.dir}" 
505         eol="${abcl.source.eol}"
506         destdir="${abcl.build.src.dir}/src"
507         preservelastmodified="true">
508  <patternset refid="abcl.source.java"/>
509  <patternset refid="abcl.source.lisp"/>
510  <patternset refid="abcl.source.misc"/>
511      </fixcrlf>
512      <fixcrlf srcdir="${basedir}" 
513         eol="${abcl.source.eol}"
514         destdir="${abcl.build.src.dir}"
515         preservelastmodified="true">
516  <patternset refid="abcl.dist.misc"/>
517      </fixcrlf>
518    </target>
519
520    <target name="abcl.source.tar" depends="abcl.source.prepare">
521      <mkdir dir="${dist.dir}"/>
522      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
523     compression="gzip">
524  <tarfileset dir="${build.dir}">
525    <include name="abcl-src-${abcl.version}/**"/>
526  </tarfileset>
527      </tar>
528    </target>
529
530    <target name="abcl.source.zip" depends="abcl.source.prepare">
531      <mkdir dir="${dist.dir}"/>
532      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
533     compress="true">
534  <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
535      </zip>
536    </target>
537
538    <import file="netbeans-build.xml" optional="true"/> 
539<!--    <import file="j-build.xml" optional="true"/>  -->
540    <import file="not.org-build.xml" optional="true"/> 
541</project>
542
Note: See TracBrowser for help on using the repository browser.