build.xml 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. <?xml version="1.0"?>
  2. <!-- A build file for use by Ant to build Kawa. -->
  3. <!-- Requires Ant 1.6.3 -->
  4. <project name="Kawa" default="default" basedir=".">
  5. <property environment="env"/>
  6. <!-- Give the user a chance to override the defaults. -->
  7. <property file="build.properties"/>
  8. <property name="version.release" value="3.0"/>
  9. <property name="version.local" value=""/>
  10. <property name="version" value="${version.release}${version.local}"/>
  11. <property name="debug" value="true" />
  12. <property name="deprecation" value="false" />
  13. <property name="optimize" value="true" />
  14. <!--
  15. There was some discussion of using user.dir as a default here.
  16. The most promising use being for dist.dir (and maybe build.dir).
  17. But I decided against that for several reasons:
  18. 1) Consistency (don't make a special case).
  19. 2) The user.dir property isn't reliable (some bad JVMs out there).
  20. 3) Ant is not able to handle both absolute and relative paths
  21. for commandline arguments based on user.dir. Ant automatically
  22. handles relative paths relative to basedir, not user.dir.
  23. As a result, if dist.dir defaulted to user.dir,
  24. "ant -buildfile ../kawa/build.xml" and
  25. "ant -buildfile ../kawa/build.xml -Ddist.dir=."
  26. would produce different results.
  27. 4) The value of user.dir is not useful when using a Java IDE
  28. (like NetBeans or JBuilder) since it is the directory that
  29. happened to be current when the IDE started.
  30. So, the only way to use Ant where the current directory (user.dir)
  31. is not the directory containing the buildfile, you *must* supply
  32. absolute paths as arguments. That is:
  33. "ant -buildfile ../kawa/build.xml -Ddist.dir=`pwd`/."
  34. The exception is Ant's arguments themselves, which are processed
  35. as plain Java files and so are relative to the current directory.
  36. -->
  37. <property name="src.dir" value="${basedir}"/>
  38. <property name="build.dir" value="${basedir}"/>
  39. <property name="dist.dir" value="${build.dir}"/>
  40. <property name="build.tools" value="${build.dir}/tools"/>
  41. <property name="build.tmp" value="${build.dir}/tmp"/>
  42. <property name="build.preprocessed" value="${build.dir}"/>
  43. <property name="build.classes" value="${build.dir}"/>
  44. <property name="dist.kawa.jar" value="${dist.dir}/lib/kawa.jar"/>
  45. <condition property="kawa.shell" value="/bin/bash" else="/bin/sh">
  46. <available file="/bin/bash"/>
  47. </condition>
  48. <!--
  49. Set preprocess.overwrite true to force preprocessing.
  50. Eventually this will be dependency checked.
  51. For now use "ant clean" if anything changes.
  52. -->
  53. <property name="preprocess.overwrite" value="false"/>
  54. <target name="all" depends="select-java-auto, classes, jar, kawa.sh, kawa.bat"/>
  55. <target name="default" depends="all"/>
  56. <target name="classes"
  57. depends="java-classes, lib-scm-classes
  58. , slib-scm-classes, commonlisp-scm-classes, brl-classes
  59. , xml-classes, servlet-classes, jemacs-classes, android-classes
  60. , javafx-classes" />
  61. <!--
  62. These are the files that are Kawa.
  63. They go in the classpath, jar, and are deleted by clean.
  64. If additional files (resources like properties and the
  65. like) are added, something will need to be done so that
  66. clean will still work when build.classes=src.dir.
  67. -->
  68. <fileset id="build.classes" dir="${build.classes}">
  69. <include name="gnu/**/*.class"/>
  70. <include name="kawa/**/*.class"/>
  71. </fileset>
  72. <!--
  73. These are the files that are preprocessed before compiling.
  74. In order to allow them to be mixed with the original source,
  75. we must list them each here.
  76. -->
  77. <fileset id="build.preprocessed" dir="${build.preprocessed}">
  78. <include name="kawa/Version.java"/>
  79. </fileset>
  80. <fileset id="build.selectjava" dir="${src.dir}">
  81. <include name="**/*.java"/>
  82. <or>
  83. <contains text="BEGIN JAVA" casesensitive="true"/>
  84. <contains text=" #endif " casesensitive="true"/>
  85. </or>
  86. </fileset>
  87. <target name="run" depends="classes">
  88. <java taskname="kawa" classname="kawa.repl" classpath="${build.classes}" fork="true"/>
  89. </target>
  90. <target name="runw" depends="classes">
  91. <java taskname="kawa" fork="true"
  92. classname="kawa.repl" classpath="${build.classes}">
  93. <arg value="-w"/>
  94. </java>
  95. </target>
  96. <!--
  97. This is part of an "if" trick. Do not change me.
  98. The "if" attribute for tasks is not true if the property is not
  99. set at all, not whether the value is "true" or "false".
  100. So here we use the value of the with- or enable- properties
  101. and rely on true being "true" with this property defined,
  102. and false being "false" with that property not defined.
  103. -->
  104. <property name="true" value="true"/>
  105. <target name="build-settings" depends="build-tools">
  106. <!-- If java.awt.Component is in the classpath, then we'll compile the
  107. AWT UI, unless you override the setting of with-awt. -->
  108. <condition property="with-awt" else="false">
  109. <available classname="java.awt.Component"/>
  110. </condition>
  111. <!-- If org.xml.sax.ContentHandler is in the classpath, then we'll compile
  112. in SAX2 support, unless you override the setting of with-sax2. -->
  113. <condition property="with-sax2" else="false">
  114. <available classname="org.xml.sax.ContentHandler"/>
  115. </condition>
  116. <!-- If java.awt.Component is in the classpath, then we'll compile the
  117. JEmacs Swing UI, unless you override the setting of with-swing. -->
  118. <condition property="with-swing" else="false">
  119. <available classname="javax.swing.JComponent"/>
  120. </condition>
  121. <!-- JEmacs stuff is compiled if Swing is used, unless enable-jemacs is false.
  122. -->
  123. <property name="enable-jemacs" value="false"/>
  124. <property name="enable-xml" value="true"/>
  125. <property name="enable-brl" value="false"/>
  126. <property name="enable-android" value="false"/>
  127. <property name="javafx.home" value=""/>
  128. <property name="enable-javafx" value="false"/>
  129. <condition property="do.enable.javafx">
  130. <or>
  131. <istrue value="${enable-javafx}"/>
  132. <not><equals arg1="${javafx.home}" arg2=""/></not>
  133. </or>
  134. </condition>
  135. <condition property="-use.javafx.home">
  136. <and>
  137. <not><equals arg1="${javafx.home}" arg2=""/></not>
  138. <istrue value="${do.enable.javafx}"/>
  139. </and>
  140. </condition>
  141. <path id="pextra.classpath">
  142. <fileset dir="${javafx.home}"><include name="rt/lib/jfxrt.jar" if="-use.javafx.home"/></fileset>
  143. </path>
  144. <property name="extra.classpath" refid="pextra.classpath"/>
  145. <path id="build.classpath">
  146. <pathelement path="${java.class.path}"/>
  147. <fileset dir="${javafx.home}"><include name="rt/lib/jfxrt.jar" if="-use.javafx.home"/></fileset>
  148. </path>
  149. <!-- If javax.servlet.http.HttpServlet is in the classpath, then we'll
  150. compile Kawa' servlet interface, unless you override enable-servlet.
  151. The servlet code uses methods from the 2.3 specification now.
  152. So test for a class that is new for the 2.3 API. -->
  153. <condition property="enable-servlet" else="false">
  154. <available classname="javax.servlet.Filter"/>
  155. </condition>
  156. <condition property="isWindows">
  157. <os family="windows" />
  158. </condition>
  159. <condition property="classpath.separator" value=";" else=":">
  160. <os family="windows" />
  161. </condition>
  162. <condition property="preprocess-xml" value="+enable:XML" else="-enable:XML">
  163. <istrue value="${enable-xml}"/>
  164. </condition>
  165. <condition property="preprocess-awt" value="+use:java.awt" else="-use:java.awt">
  166. <istrue value="${with-awt}"/>
  167. </condition>
  168. <condition property="preprocess-HttpServer" value="+use:com.sun.net.httpserver"
  169. else="-use:com.sun.net.httpserver">
  170. <available classname="com.sun.net.httpserver.HttpServer"/>
  171. </condition>
  172. <condition property="with-javax-script" else="false">
  173. <available classname="javax.script.ScriptEngine"/>
  174. </condition>
  175. <condition property="-needs-scripting-inf">
  176. <and>
  177. <istrue value="${with-javax-script}"/>
  178. <not>
  179. <available file="META-INF/services/javax.script.ScriptEngineFactory"/>
  180. </not>
  181. </and>
  182. </condition>
  183. <condition property="-needs-scripting-inf-xquery">
  184. <and>
  185. <istrue value="${-needs-scripting-inf}"/>
  186. <istrue value="${enable-xml}"/>
  187. </and>
  188. </condition>
  189. <echo>
  190. version=${version}
  191. dist.kawa.jar=${dist.kawa.jar}
  192. build.dir=${build.dir}
  193. with-awt=${with-awt}
  194. with-swing=${with-swing}
  195. with-sax2=${with-sax2}
  196. enable-jemacs=${enable-jemacs}
  197. enable-xml=${enable-xml}
  198. enable-servlet=${enable-servlet}
  199. enable-android=${enable-android}
  200. enable-javafx=${do.enable.javafx}
  201. </echo>
  202. <!--
  203. This dummy copy is just so we can reference the sets by id.
  204. This is needed because we are not able to put linestrippersets
  205. in a task or project the way we can with filtersets.
  206. Ant gives "Overriding previous definition of reference to..."
  207. warnings. Can't seem to avoid that.
  208. -->
  209. <xcopy dataOnly="true">
  210. <linestripperset id="strip-char-subs">
  211. <linestripper first="if CHAR is byte" last="endif CHAR is byte" />
  212. </linestripperset>
  213. </xcopy>
  214. </target>
  215. <target name="build-tools">
  216. <mkdir dir="${build.tools}"/>
  217. <mkdir dir="${build.tmp}"/>
  218. <!--
  219. This didn't work in NetBeans for some reason.
  220. (Even the includejavaruntime/includeantruntime attributes do no good.
  221. The really weird thing is that NetBeans has access to the classes
  222. for autocomplete and the scripting window. Oh well.)
  223. The workaround is to link to ant.jar.
  224. -->
  225. <javac srcdir="${src.dir}"
  226. destdir="${build.tools}"
  227. classpath="lib/ext/ant.jar"
  228. debug="${debug}"
  229. deprecation="${deprecation}"
  230. optimize="${optimize}"
  231. includeantruntime="true">
  232. <include name="gnu/kawa/util/PreProcess.java"/>
  233. <include name="gnu/kawa/ant/*.java"/>
  234. </javac>
  235. <taskdef name="xcopy"
  236. classname="gnu.kawa.ant.XCopy"
  237. classpath="${build.tools}"/>
  238. <taskdef name="kawac"
  239. classname="gnu.kawa.ant.Kawac"
  240. classpath="${build.tools}"/>
  241. <!--
  242. This doesn't really help us because user data
  243. definitions don't seem to be possible.
  244. <typedef name="linestripperset"
  245. classname="gnu.kawa.ant.LineStripperSet"
  246. classpath="${build.tools}"/>
  247. -->
  248. </target>
  249. <available property="has-java2" classname="java.lang.ThreadLocal"/>
  250. <available property="has-java4" classname="java.lang.CharSequence"/>
  251. <available property="has-java5" classname="java.lang.Appendable"/>
  252. <available property="has-java6" classname="javax.script.AbstractScriptEngine"/>
  253. <available property="has-java7" classname="java.lang.invoke.MethodHandle"/>
  254. <available property="has-java8" classname="java.util.stream.Stream"/>
  255. <target name="select-java1" depends="build-settings">
  256. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  257. <path><fileset refid="build.selectjava"/></path>
  258. </pathconvert>
  259. <java classname="gnu.kawa.util.PreProcess">
  260. <classpath location="${build.tools}"/>
  261. <arg line="%java1 ${preprocess-xml} ${preprocess-awt} -use:com.sun.net.httpserver"/>
  262. <arg line="${fileList}"/>
  263. </java>
  264. </target>
  265. <target name="select-java2" depends="build-settings">
  266. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  267. <path><fileset refid="build.selectjava"/></path>
  268. </pathconvert>
  269. <java classname="gnu.kawa.util.PreProcess">
  270. <classpath location="${build.tools}"/>
  271. <arg line="%java2 ${preprocess-xml} ${preprocess-awt} -use:com.sun.net.httpserver"/>
  272. <arg line="${fileList}"/>
  273. </java>
  274. </target>
  275. <target name="select-java4" depends="build-settings">
  276. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  277. <path><fileset refid="build.selectjava"/></path>
  278. </pathconvert>
  279. <java classname="gnu.kawa.util.PreProcess">
  280. <classpath location="${build.tools}"/>
  281. <arg line="%java4 ${preprocess-xml} ${preprocess-awt} -use:com.sun.net.httpserver"/>
  282. <arg line="${fileList}"/>
  283. </java>
  284. </target>
  285. <target name="select-java5" depends="build-settings">
  286. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  287. <path><fileset refid="build.selectjava"/></path>
  288. </pathconvert>
  289. <java classname="gnu.kawa.util.PreProcess">
  290. <classpath location="${build.tools}"/>
  291. <arg line="%java5 ${preprocess-xml} ${preprocess-awt} -use:com.sun.net.httpserver"/>
  292. <arg line="${fileList}"/>
  293. </java>
  294. </target>
  295. <target name="select-java6" depends="build-settings">
  296. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  297. <path><fileset refid="build.selectjava"/></path>
  298. </pathconvert>
  299. <java classname="gnu.kawa.util.PreProcess">
  300. <classpath location="${build.tools}"/>
  301. <arg line="%java6 ${preprocess-xml} ${preprocess-awt} ${preprocess-HttpServer}"/>
  302. <arg line="${fileList}"/>
  303. </java>
  304. </target>
  305. <target name="select-android" depends="build-settings">
  306. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  307. <path><fileset refid="build.selectjava"/></path>
  308. </pathconvert>
  309. <java classname="gnu.kawa.util.PreProcess">
  310. <classpath location="${build.tools}"/>
  311. <arg line="%android ${preprocess-xml} ${preprocess-awt} -use:com.sun.net.httpserver"/>
  312. <arg line="${fileList}"/>
  313. </java>
  314. </target>
  315. <target name="select-java7" depends="build-settings">
  316. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  317. <path><fileset refid="build.selectjava"/></path>
  318. </pathconvert>
  319. <java classname="gnu.kawa.util.PreProcess">
  320. <classpath location="${build.tools}"/>
  321. <arg line="%java7 ${preprocess-xml} ${preprocess-awt} ${preprocess-HttpServer}"/>
  322. <arg line="${fileList}"/>
  323. </java>
  324. </target>
  325. <target name="select-java8" depends="build-settings">
  326. <pathconvert property="fileList" pathSep=" " dirSep="${file.separator}">
  327. <path><fileset refid="build.selectjava"/></path>
  328. </pathconvert>
  329. <java classname="gnu.kawa.util.PreProcess">
  330. <classpath location="${build.tools}"/>
  331. <arg line="%java8 ${preprocess-xml} ${preprocess-awt} ${preprocess-HttpServer}"/>
  332. <arg line="${fileList}"/>
  333. </java>
  334. </target>
  335. <target name="-maybe-select-java1" unless="has-java2">
  336. <antcall target="select-java1"/>
  337. </target>
  338. <target name="-maybe-select-java2" if="has-java2" unless="has-java4">
  339. <antcall target="select-java2"/>
  340. </target>
  341. <target name="-maybe-select-java4" if="has-java4" unless="has-java5">
  342. <antcall target="select-java4"/>
  343. </target>
  344. <target name="-maybe-select-java5" if="has-java5" unless="has-java6">
  345. <antcall target="select-java5"/>
  346. </target>
  347. <target name="-maybe-select-java6" if="has-java6" unless="has-java7">
  348. <antcall target="select-java6"/>
  349. </target>
  350. <target name="-maybe-select-java7" if="has-java7" unless="has-java8">
  351. <antcall target="select-java7"/>
  352. </target>
  353. <target name="-maybe-select-java8" if="has-java8">
  354. <antcall target="select-java8"/>
  355. </target>
  356. <target name="-maybe-select-android" if="${enable-android}">
  357. <antcall target="select-android"/>
  358. </target>
  359. <target name="select-java-auto">
  360. <antcall target="-select-java-non-android"/>
  361. <antcall target="-maybe-select-android"/>
  362. </target>
  363. <target name="-select-java-non-android" unless="${enable-android}">
  364. <antcall target="-maybe-select-java1"/>
  365. <antcall target="-maybe-select-java2"/>
  366. <antcall target="-maybe-select-java4"/>
  367. <antcall target="-maybe-select-java5"/>
  368. <antcall target="-maybe-select-java6"/>
  369. <antcall target="-maybe-select-java7"/>
  370. <antcall target="-maybe-select-java8"/>
  371. </target>
  372. <!--
  373. This preprocessing jazz is rather involved and verbose,
  374. but it is entirely compatible with the makefile code
  375. and actually _isn't_ as complicated as I could have made
  376. it (as there are still unrolled patterns here that could
  377. have been wrapped up but I demurred in consideration of
  378. those who may try and grok it).
  379. -->
  380. <filterset id="filter-do-not-edit" begintoken="-*-" endtoken="-*-">
  381. <filter token="Java"
  382. value="Automatically generated file - DO NOT EDIT!. -*- buffer-read-only: t -*-" />
  383. </filterset>
  384. <target name="preprocess" depends="build-tools, build-settings">
  385. <mkdir dir="${build.preprocessed}"/>
  386. <xcopy todir="${build.preprocessed}/kawa"
  387. overwrite="${preprocess.overwrite}">
  388. <fileset dir="${src.dir}/kawa" includes="*.java.in"/>
  389. <mapper type="glob" from="*Version.java.in" to="*Version.java"/>
  390. <filterset refid="filter-do-not-edit"/>
  391. <filterset begintoken="&quot;" endtoken="&quot;">
  392. <filter token="VERSION" value="&quot;${version}&quot;" />
  393. </filterset>
  394. </xcopy>
  395. </target>
  396. <target name="-make-primvector-source">
  397. <java classname="gnu.kawa.util.PreProcess">
  398. <classpath location="${build.tools}"/>
  399. <arg value="%${TAG}"/>
  400. <arg value="%UniformVector"/>
  401. <arg value="-o"/>
  402. <arg value="gnu/lists/${OUT}Vector.java"/>
  403. <arg value="gnu/lists/PrimVector.template"/>
  404. </java>
  405. </target>
  406. <target name="-maybe-generate-simplevector-files" unless="simplevector-files-uptodate">
  407. <antcall target="-make-primvector-source">
  408. <param name="TAG" value="OBJECT"/>
  409. <param name="OUT" value="F"/>
  410. </antcall>
  411. <antcall target="-make-primvector-source">
  412. <param name="TAG" value="BIT"/>
  413. <param name="OUT" value="Bit"/>
  414. </antcall>
  415. <antcall target="-make-primvector-source">
  416. <param name="TAG" value="BYTE"/>
  417. <param name="OUT" value="Byte"/>
  418. </antcall>
  419. <antcall target="-make-primvector-source">
  420. <param name="TAG" value="SHORT"/>
  421. <param name="OUT" value="Short"/>
  422. </antcall>
  423. <antcall target="-make-primvector-source">
  424. <param name="TAG" value="INT"/>
  425. <param name="OUT" value="Int"/>
  426. </antcall>
  427. <antcall target="-make-primvector-source">
  428. <param name="TAG" value="LONG"/>
  429. <param name="OUT" value="Long"/>
  430. </antcall>
  431. <antcall target="-make-primvector-source">
  432. <param name="TAG" value="F32"/>
  433. <param name="OUT" value="F32"/>
  434. </antcall>
  435. <antcall target="-make-primvector-source">
  436. <param name="TAG" value="F64"/>
  437. <param name="OUT" value="F64"/>
  438. </antcall>
  439. <antcall target="-make-primvector-source">
  440. <param name="TAG" value="S8"/>
  441. <param name="OUT" value="S8"/>
  442. </antcall>
  443. <antcall target="-make-primvector-source">
  444. <param name="TAG" value="S16"/>
  445. <param name="OUT" value="S16"/>
  446. </antcall>
  447. <antcall target="-make-primvector-source">
  448. <param name="TAG" value="S32"/>
  449. <param name="OUT" value="S32"/>
  450. </antcall>
  451. <antcall target="-make-primvector-source">
  452. <param name="TAG" value="S64"/>
  453. <param name="OUT" value="S64"/>
  454. </antcall>
  455. <antcall target="-make-primvector-source">
  456. <param name="TAG" value="U8"/>
  457. <param name="OUT" value="U8"/>
  458. </antcall>
  459. <antcall target="-make-primvector-source">
  460. <param name="TAG" value="U16"/>
  461. <param name="OUT" value="U16"/>
  462. </antcall>
  463. <antcall target="-make-primvector-source">
  464. <param name="TAG" value="U32"/>
  465. <param name="OUT" value="U32"/>
  466. </antcall>
  467. <antcall target="-make-primvector-source">
  468. <param name="TAG" value="U64"/>
  469. <param name="OUT" value="U64"/>
  470. </antcall>
  471. </target>
  472. <target name="generate-simplevector-files" depends="build-tools">
  473. <uptodate property="simplevector-files-uptodate">
  474. <srcfiles file="${src.dir}/gnu/lists/PrimVector.template"/>
  475. <srcfiles file="${build.tools}/gnu/kawa/util/PreProcess.class"/>
  476. <compositemapper>
  477. <mergemapper to="${src.dir}/gnu/lists/FVector.java"/>
  478. <mergemapper to="${src.dir}/gnu/lists/BitVector.java"/>
  479. <mergemapper to="${src.dir}/gnu/lists/ByteVector.java"/>
  480. <mergemapper to="${src.dir}/gnu/lists/ShortVector.java"/>
  481. <mergemapper to="${src.dir}/gnu/lists/IntVector.java"/>
  482. <mergemapper to="${src.dir}/gnu/lists/LongVector.java"/>
  483. <mergemapper to="${src.dir}/gnu/lists/F32Vector.java"/>
  484. <mergemapper to="${src.dir}/gnu/lists/F64Vector.java"/>
  485. <mergemapper to="${src.dir}/gnu/lists/S8Vector.java"/>
  486. <mergemapper to="${src.dir}/gnu/lists/S16Vector.java"/>
  487. <mergemapper to="${src.dir}/gnu/lists/S32Vector.java"/>
  488. <mergemapper to="${src.dir}/gnu/lists/S64Vector.java"/>
  489. <mergemapper to="${src.dir}/gnu/lists/U8Vector.java"/>
  490. <mergemapper to="${src.dir}/gnu/lists/U16Vector.java"/>
  491. <mergemapper to="${src.dir}/gnu/lists/U32Vector.java"/>
  492. <mergemapper to="${src.dir}/gnu/lists/U64Vector.java"/>
  493. </compositemapper>
  494. </uptodate>
  495. <antcall target="-maybe-generate-simplevector-files"/>
  496. </target>
  497. <target name="kawa.sh" depends="build-settings">
  498. <copy file="${src.dir}/bin/kawa.sh.in" tofile="bin/kawa.sh">
  499. <filterset>
  500. <filter token="ENABLE_KAWA_FRONTEND_TRUE" value="#"/>
  501. <filter token="VERSION" value="${version}"/>
  502. <filter token="CLASSPATH_SEPARATOR" value="${classpath.separator}"/>
  503. <filter token="KAWAJAR" value="kawa.jar"/>
  504. <filter token="CYGPATH_W" value="echo"/>
  505. <filter token="KAWA_SHELL" value="${kawa.shell}"/>
  506. <filter token="conf_classpath" value=""/>
  507. </filterset>
  508. </copy>
  509. <chmod file="bin/kawa.sh" perm="+x"/>
  510. </target>
  511. <patternset id="with-sax2-false">
  512. </patternset>
  513. <patternset id="with-sax2-true">
  514. <include name="gnu/kawa/sax/"/>
  515. </patternset>
  516. <patternset id="with-awt-true"/>
  517. <patternset id="with-awt-false">
  518. <exclude name="kawa/GuiConsole.java"/>
  519. <exclude name="kawa/MessageArea.java"/>
  520. <exclude name="kawa/TextAreaWriter.java"/>
  521. <exclude name="kawa/GuiInPort.java"/>
  522. </patternset>
  523. <target name="java-classes" depends="preprocess,generate-simplevector-files">
  524. <mkdir dir="${build.classes}"/>
  525. <!--
  526. Javac doesn't "shadow" directories, so there may not be duplicates.
  527. That means that if you're building other than in the source directory,
  528. then the source directory must be clean.
  529. -->
  530. <javac srcdir="${build.preprocessed}:${src.dir}"
  531. destdir="${build.classes}"
  532. debug="${debug}"
  533. deprecation="${deprecation}"
  534. optimize="${optimize}"
  535. includeantruntime="false">
  536. <include name="gnu/bytecode/"/>
  537. <include name="gnu/commonlisp/lang/"/>
  538. <include name="gnu/ecmascript/"/>
  539. <include name="gnu/expr/"/>
  540. <exclude name="gnu/expr/AbstractScriptEngineFactory.java" unless="has-java6"/>
  541. <exclude name="gnu/expr/KawaScriptBindings.java" unless="has-java6"/>
  542. <exclude name="gnu/expr/KawaScriptEngine.java" unless="has-java6"/>
  543. <exclude name="kawa/standard/SchemeScriptEngineFactory.java" unless="has-java6"/>
  544. <include name="gnu/kawa/functions/"/>
  545. <include name="gnu/kawa/lispexpr/*.java"/>
  546. <exclude name="gnu/kawa/lispexpr/MakeXmlElement.java" unless="${enable-xml}"/>
  547. <exclude name="gnu/kawa/lispexpr/ReaderXmlElement.java" unless="${enable-xml}"/>
  548. <exclude name="gnu/kawa/lispexpr/ResolveNamespace.java" unless="${enable-xml}"/>
  549. <include name="gnu/kawa/reflect/"/>
  550. <include name="gnu/kawa/util/"/>
  551. <include name="gnu/lists/"/>
  552. <include name="gnu/mapping/"/>
  553. <include name="gnu/math/"/>
  554. <include name="gnu/q2/lang/"/>
  555. <include name="gnu/text/"/>
  556. <include name="kawa/lang/"/>
  557. <include name="kawa/standard/"/>
  558. <include name="kawa/repl.java"/>
  559. <include name="kawa/Shell.java"/>
  560. <include name="kawa/Version.java"/>
  561. <include name="kawa/Source*.java"/>
  562. <include name="kawa/Telnet*.java"/>
  563. <include name="kawa/Gui*.java" if="${with-swing}"/>
  564. <include name="kawa/Repl*.java" if="${with-swing}"/>
  565. <include name="gnu/kawa/xml/"/>
  566. <include name="gnu/xml/"/>
  567. <patternset refid="with-awt-${with-awt}"/>
  568. <include name="gnu/kawa/models/" if="${with-awt}"/>
  569. <include name="gnu/kawa/swingviews/" if="${with-swing}"/>
  570. </javac>
  571. </target>
  572. <!--
  573. Can't use apply's dependency checking because
  574. Kawa can't handle a "-C" with no files listed.
  575. Also that is probably the wrong thing because
  576. Kawa needs all the files listed for its scanning.
  577. -->
  578. <target name="lib-scm-classes"
  579. depends="java-classes">
  580. <kawac failonerror="true" destdir="${build.classes}"
  581. prefix="kawa.lib." modulestatic="run" language="scheme">
  582. <arg line="--warn-undefined-variable --warn-unknown-member --warn-as-error"/>
  583. <filelist dir="${src.dir}/kawa/lib">
  584. <file name="prim_imports.scm"/>
  585. <file name="prim_syntax.scm"/>
  586. <file name="std_syntax.scm"/>
  587. <file name="reflection.scm"/>
  588. <file name="syntax.scm"/>
  589. <file name="lists.scm"/>
  590. <file name="case_syntax.scm"/>
  591. <file name="DefineRecordType.scm"/>
  592. <file name="ExceptionClasses.scm"/>
  593. <file name="exceptions.scm"/>
  594. <file name="kawa/expressions.scm"/>
  595. <file name="compile_misc.scm"/>
  596. <file name="compile_map.scm"/>
  597. <file name="thread.scm"/>
  598. <file name="characters.scm"/>
  599. <file name="keywords.scm"/>
  600. <file name="numbers.scm"/>
  601. <file name="strings_syntax.scm"/>
  602. <file name="strings.scm"/>
  603. <file name="parameters.scm"/>
  604. <file name="parameterize.scm"/>
  605. <file name="ports.scm"/>
  606. <file name="files.scm"/>
  607. <file name="misc.scm"/>
  608. <file name="misc_syntax.scm"/>
  609. <file name="vectors.scm"/>
  610. <file name="uniform.scm"/>
  611. <file name="bytevectors.scm"/>
  612. <file name="arrays.scm"/>
  613. <file name="system.scm"/>
  614. <file name="kawa/istrings.scm"/>
  615. <file name="kawa/mstrings.scm"/>
  616. <file name="kawa/arglist.scm"/>
  617. <file name="kawa/process-keywords.scm"/>
  618. <file name="kawa/string-cursors.scm"/>
  619. <file name="kawa/hashtable.scm"/>
  620. <file name="kawa/regex.scm"/>
  621. <file name="rnrs/unicode.scm"/>
  622. <file name="scheme/base.scm"/>
  623. <file name="scheme/case-lambda.scm"/>
  624. <file name="scheme/char.scm"/>
  625. <file name="scheme/complex.scm"/>
  626. <file name="scheme/cxr.scm"/>
  627. <file name="scheme/eval.scm"/>
  628. <file name="scheme/file.scm"/>
  629. <file name="scheme/inexact.scm"/>
  630. <file name="scheme/lazy.scm"/>
  631. <file name="scheme/load.scm"/>
  632. <file name="scheme/process-context.scm"/>
  633. <file name="scheme/read.scm"/>
  634. <file name="scheme/repl.scm"/>
  635. <file name="scheme/time.scm"/>
  636. <file name="scheme/write.scm"/>
  637. <file name="scheme/r5rs.scm"/>
  638. <file name="trace.scm"/>
  639. </filelist>
  640. </kawac>
  641. <kawac failonerror="true" destdir="${build.classes}"
  642. prefix="kawa.lib." modulestatic="run" language="scheme">
  643. <arg line="--warn-undefined-variable --warn-unknown-member --warn-as-error"/>
  644. <filelist dir="${src.dir}/kawa/lib">
  645. <file name="enums.scm"/>
  646. <file name="srfi/8.scm"/>
  647. <file name="srfi/26.scm"/>
  648. <file name="srfi/95.scm"/>
  649. <file name="strings_ext.scm"/>
  650. <file name="rnrs/hashtables.scm"/>
  651. <file name="rnrs/lists.scm"/>
  652. <file name="rnrs/arithmetic/bitwise.scm"/>
  653. <file name="rnrs/sorting.scm"/>
  654. <file name="rnrs/programs.scm"/>
  655. <file name="kawa/base.scm"/>
  656. </filelist>
  657. <fileset dir="${src.dir}/kawa/lib">
  658. <include name="kawa/pictures.scm" if="${with-awt}"/>
  659. <include name="windows.scm" if="${with-swing}"/>
  660. <include name="kawa/swing.scm" if="${with-swing}"/>
  661. </fileset>
  662. </kawac>
  663. <kawac failonerror="true" destdir="${build.classes}"
  664. prefix="kawa.lib." modulestatic="run" language="scheme">
  665. <arg line="--warn-undefined-variable --warn-unknown-member --warn-as-error"/>
  666. <filelist dir="${src.dir}/kawa/lib">
  667. <file name="kawa/quaternions.scm"/>
  668. <file name="kawa/pprint.scm"/>
  669. <file name="kawa/rotations.scm"/>
  670. <file name="kawa/null-5.scm"/>
  671. <file name="kawa/reflect.scm"/>
  672. </filelist>
  673. </kawac>
  674. </target>
  675. <target name="commonlisp-scm-classes"
  676. depends="java-classes">
  677. <kawac failonerror="true" destdir="${build.classes}"
  678. prefix="gnu.commonlisp.lisp." modulestatic="run" language="scheme">
  679. <filelist dir="${src.dir}/gnu/commonlisp/lisp">
  680. <file name="PrimOps.scm"/>
  681. </filelist>
  682. </kawac>
  683. <kawac failonerror="true" destdir="${build.classes}"
  684. prefix="gnu.commonlisp.lisp." modulestatic="run" language="clisp">
  685. <filelist dir="${src.dir}/gnu/commonlisp/lisp">
  686. <file name="primitives.lisp"/>
  687. </filelist>
  688. </kawac>
  689. </target>
  690. <target name="slib-scm-classes" depends="java-classes">
  691. <kawac failonerror="true" destdir="${build.classes}"
  692. prefix="gnu.kawa.slib." modulestatic="run"
  693. language="scheme">
  694. <filelist dir="${src.dir}/gnu/kawa/slib">
  695. <file name="readtable.scm"/>
  696. <file name="srfi1.scm"/>
  697. <file name="srfi2.scm"/>
  698. <file name="conditions.scm"/>
  699. <file name="srfi13.scm"/>
  700. <file name="srfi14.scm"/>
  701. <file name="srfi34.scm"/>
  702. <file name="srfi37.scm"/>
  703. <file name="srfi60.scm"/>
  704. <file name="srfi69.scm"/>
  705. <file name="pregexp.scm"/>
  706. <file name="Streams.scm"/>
  707. <file name="StreamsDerived.scm"/>
  708. <file name="StreamsPrimitive.scm"/>
  709. <file name="StreamsType.scm"/>
  710. <file name="genwrite.scm"/>
  711. <file name="pp.scm"/>
  712. <file name="ppfile.scm"/>
  713. <file name="printf.scm"/>
  714. <file name="syntaxutils.scm"/>
  715. <file name="testing.scm"/>
  716. </filelist>
  717. <fileset dir="${src.dir}/gnu/kawa/slib">
  718. <include name="gui.scm" if="${with-awt}"/>
  719. <include name="swing.scm" if="${with-swing}"/>
  720. </fileset>
  721. </kawac>
  722. </target>
  723. <target name="xml-classes"
  724. depends="build-settings, java-classes"
  725. if="${enable-xml}">
  726. <javac srcdir="${src.dir}"
  727. destdir="${build.classes}"
  728. debug="${debug}"
  729. deprecation="${deprecation}"
  730. optimize="${optimize}"
  731. includeantruntime="false">
  732. <include name="gnu/xml/"/>
  733. <include name="gnu/kawa/xml/"/>
  734. <include name="gnu/kawa/xslt/"/>
  735. <include name="gnu/xquery/lang/"/>
  736. <exclude name="gnu/xquery/lang/XQueryScriptEngineFactory.java" unless="has-java6"/>
  737. <include name="gnu/xquery/util/"/>
  738. <patternset refid="with-sax2-${with-sax2}"/>
  739. </javac>
  740. <kawac failonerror="true" destdir="${build.classes}"
  741. prefix="gnu.kawa.slib." modulestatic="run" language="scheme">
  742. <fileset dir="${src.dir}/gnu/kawa/slib">
  743. <include name="XML.scm"/>
  744. <include name="XStrings.scm"/>
  745. </fileset>
  746. </kawac>
  747. <kawac failonerror="true" destdir="${build.classes}"
  748. prefix="gnu.xquery.util." modulestatic="run" language="scheme">
  749. <fileset dir="${src.dir}/gnu/xquery/util">
  750. <include name="Xutils.scm"/>
  751. </fileset>
  752. </kawac>
  753. </target>
  754. <target name="brl-classes"
  755. depends="build-settings, java-classes"
  756. if="${enable-brl}">
  757. <javac srcdir="${src.dir}"
  758. destdir="${build.classes}"
  759. debug="${debug}"
  760. deprecation="${deprecation}"
  761. optimize="${optimize}"
  762. includeantruntime="false">
  763. <include name="gnu/brl/"/>
  764. <include name="gnu/kawa/brl/"/>
  765. <patternset refid="with-sax2-${with-sax2}"/>
  766. </javac>
  767. <kawac failonerror="true" destdir="${build.classes}"
  768. prefix="gnu.brl." modulestatic="run" language="scheme">
  769. <fileset dir="${src.dir}/gnu/brl">
  770. <include name="stringfun.scm"/>
  771. </fileset>
  772. </kawac>
  773. <kawac failonerror="true" destdir="${build.classes}"
  774. prefix="gnu.kawa.brl." modulestatic="run" language="scheme">
  775. <fileset dir="${src.dir}/gnu/kawa/brl">
  776. <include name="progfun.scm"/>
  777. </fileset>
  778. </kawac>
  779. </target>
  780. <target name="javafx-classes"
  781. depends="build-settings, java-classes"
  782. if="${do.enable.javafx}">
  783. <javac srcdir="${src.dir}"
  784. destdir="${build.classes}"
  785. debug="${debug}"
  786. deprecation="${deprecation}"
  787. optimize="${optimize}"
  788. classpathref="build.classpath"
  789. includeantruntime="false">
  790. <include name="gnu/kawa/javafx/"/>
  791. </javac>
  792. <kawac failonerror="true" destdir="${build.classes}"
  793. classpathref="build.classpath"
  794. prefix="gnu.kawa.javafx." modulestatic="run" language="scheme">
  795. <fileset dir="${src.dir}/gnu/kawa/javafx">
  796. <include name="defs.scm"/>
  797. <include name="GroupObjectBuilder.scm"/>
  798. <include name="MakeScene.scm"/>
  799. </fileset>
  800. </kawac>
  801. </target>
  802. <target name="servlet-classes"
  803. depends="build-settings, java-classes"
  804. if="${enable-servlet}">
  805. <javac srcdir="${src.dir}"
  806. destdir="${build.classes}"
  807. debug="${debug}"
  808. deprecation="${deprecation}"
  809. optimize="${optimize}"
  810. includeantruntime="false">
  811. <include name="gnu/kawa/servlet/"/>
  812. </javac>
  813. <apply taskname="kawa" executable="java"
  814. failonerror="true" parallel="true">
  815. <!-- I don't quite get why the Java classpath has to be tacked on here, but it does. -->
  816. <arg value="-classpath"/> <arg path="${build.classes}:${java.class.path}"/>
  817. <arg value="kawa.repl"/>
  818. <arg value="-d"/> <arg path="${build.classes}"/>
  819. <arg line="-P gnu.kawa.slib. --module-static-run -C"/>
  820. <fileset dir="${src.dir}/gnu/kawa/servlet">
  821. <include name="HTTP.scm"/>
  822. </fileset>
  823. </apply>
  824. </target>
  825. <target name="android-classes"
  826. depends="build-settings, java-classes"
  827. if="${enable-android}">
  828. <fail message="android.path (value: ${android.path}) is not a file">
  829. <condition>
  830. <not><available file="${android.path}"/></not>
  831. </condition>
  832. </fail>
  833. <apply taskname="kawa" executable="java"
  834. failonerror="true" parallel="true">
  835. <!-- I don't quite get why the Java classpath has to be tacked on here, but it does. -->
  836. <arg value="-classpath"/> <arg path="${android.path}:${build.classes}:${java.class.path}"/>
  837. <arg value="kawa.repl"/>
  838. <arg value="-d"/> <arg path="${build.classes}"/>
  839. <arg line="-P gnu.kawa.android. --module-static-run -C"/>
  840. <fileset dir="${src.dir}/gnu/kawa/android">
  841. <include name="utils.scm"/>
  842. <include name="defs.scm"/>
  843. <include name="ViewBuilder.scm"/>
  844. </fileset>
  845. </apply>
  846. </target>
  847. <target name="jemacs-java-classes"
  848. depends="build-settings, java-classes"
  849. if="${enable-jemacs}">
  850. <javac srcdir="${src.dir}"
  851. destdir="${build.classes}"
  852. debug="${debug}"
  853. deprecation="${deprecation}"
  854. optimize="${optimize}"
  855. includeantruntime="false">
  856. <include name="gnu/jemacs/buffer/"/>
  857. <include name="gnu/jemacs/lang/"/>
  858. <include name="gnu/jemacs/swing/" if="${with-swing}"/>
  859. </javac>
  860. </target>
  861. <target name="jemacs-swt-classes" depends="jemacs-classes">
  862. <javac srcdir="${src.dir}" destdir="${build.classes}"
  863. includeantruntime="false">
  864. <include name="gnu/jemacs/swt/"/>
  865. </javac>
  866. </target>
  867. <target name="jemacs-classes"
  868. depends="build-settings, java-classes, jemacs-java-classes"
  869. if="${enable-jemacs}">
  870. <kawac failonerror="true" destdir="${build.classes}"
  871. prefix="gnu.kawa.slib" modulestatic="run" language="scheme">
  872. <fileset dir="${src.dir}/gnu/kawa/slib">
  873. <include name="gui.scm"/>
  874. </fileset>
  875. </kawac>
  876. <kawac failonerror="true" destdir="${build.classes}"
  877. prefix="gnu.jemacs.lisp." language="scheme">
  878. <filelist dir="${src.dir}/gnu/jemacs/lisp">
  879. <file name="MiscOps.scm"/>
  880. <file name="NumberOps.scm"/>
  881. <file name="emacs.scm"/>
  882. </filelist>
  883. </kawac>
  884. <kawac failonerror="true" destdir="${build.classes}"
  885. prefix="gnu.jemacs.lisp." language="elisp">
  886. <filelist dir="${src.dir}/gnu/jemacs/lisp">
  887. <file name="primitives.el"/>
  888. <file name="alist.el"/>
  889. <file name="simple.el"/>
  890. <file name="keymap.el"/>
  891. <file name="keydefs.el"/>
  892. <file name="hanoi.el"/>
  893. <file name="rect.el"/>
  894. <file name="editfns.el"/>
  895. <file name="subr.el"/>
  896. <file name="autoloads.el"/>
  897. </filelist>
  898. </kawac>
  899. </target>
  900. <target name="script-factory-scheme" if="${-needs-scripting-inf}">
  901. <mkdir dir="META-INF/services"/>
  902. <echo message="kawa.standard.SchemeScriptEngineFactory #Scheme&#xA;"
  903. append="true"
  904. file="META-INF/services/javax.script.ScriptEngineFactory"/>
  905. </target>
  906. <target name="script-factory-xquery" if="${-needs-scripting-inf-xquery}">
  907. <mkdir dir="META-INF/services"/>
  908. <echo message="gnu.xquery.lang.XQueryScriptEngineFactory #XQuery&#xA;"
  909. append="true"
  910. file="META-INF/services/javax.script.ScriptEngineFactory"/>
  911. </target>
  912. <target name="jar" depends="script-factory-scheme,script-factory-xquery">
  913. <jar jarfile="${dist.kawa.jar}"
  914. manifest="${src.dir}/jar-manifest">
  915. <fileset refid="build.classes"/>
  916. <fileset dir="${build.classes}">
  917. <include name="META-INF/services/*"/>
  918. </fileset>
  919. </jar>
  920. </target>
  921. <target name="kawa.bat" depends="build-settings" if="isWindows">
  922. <copy file="bin/kawa.bat.in" toFile="bin/kawa.bat">
  923. <filterset begintoken="%" endtoken="%">
  924. <filter token="DEFAULT_KAWA_VERSION" value="${version}"/>
  925. <filter token="DEFAULT_EXTRA_PATH" value="${extra.classpath};"/>
  926. </filterset>
  927. </copy>
  928. </target>
  929. <!--
  930. These clean targets are split up for when
  931. get build-tools doesn't work in NetBeans.
  932. (There is a workaround now, see build-tools.)
  933. For this to work, build.tools must be a different
  934. directory than build.classes uses.
  935. -->
  936. <target name="clean-build">
  937. <delete>
  938. <fileset refid="build.classes"/>
  939. <fileset refid="build.preprocessed"/>
  940. <fileset file="bin/kawa.bat"/>
  941. <fileset file="bin/kawa.sh"/>
  942. </delete>
  943. <delete dir="META-INF"/>
  944. </target>
  945. <target name="clean-generated-simplevector-files">
  946. <delete>
  947. <fileset dir="${src.dir}/gnu/lists"
  948. includes="FVector.java
  949. BitVector.java
  950. ByteVector.java
  951. ShortVector.java
  952. IntVector.java
  953. LongVector.java
  954. F32Vector.java
  955. F64Vector.java
  956. S8Vector.java
  957. S16Vector.java
  958. S32Vector.java
  959. S64Vector.java
  960. U8Vector.java
  961. U16Vector.java
  962. U32Vector.java
  963. U64Vector.java">
  964. </fileset>
  965. </delete>
  966. </target>
  967. <target name="clean-tools">
  968. <delete dir="${build.tools}"/>
  969. </target>
  970. <target name="clean-dist">
  971. <delete file="${dist.kawa.jar}"/>
  972. </target>
  973. <target name="clean" depends="clean-build, clean-tools, clean-dist"/>
  974. </project>