source: branches/scripting/j/build.xml @ 11451

Last change on this file since 11451 was 11451, checked in by astalla, 13 years ago

Compatibility with Java 5: using the ANT-based build, the JSR-223 support is excluded from the build. Also removed a @Override annotation that prevented compiling ABCL with Java 5.

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