root/greenstone3/trunk/build.xml @ 16962

Revision 16962, 71.4 KB (checked in by oranfry, 11 years ago)

this line is causing a problem on mac so wrapping in an if statement

Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3     March 2005                                                   
4
5     Greenstone3 build and install script
6                 
7     kjdon                                                               
8     ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10
11  <!-- ============ classpath =================== -->
12  <path id="project.classpath">
13    <fileset dir="lib/java">
14      <include name="**/*.jar"/>
15    </fileset>
16  </path>
17 
18  <!-- ============ self defined tasks =================== -->
19  <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
20  <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
21  <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
22  <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
23  <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
24 
25  <!-- ===================== Property Definitions =========================== -->
26 
27  <!--
28
29  Each of the following properties are used in the build script.
30  Values for these properties are set by the first place they are
31  defined, from the following list:
32
33  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
34
35  * Definitions from a "build.properties" file in the top level
36  source directory of this application.
37
38  * Definitions from a "build.properties" file in the user's
39  home directory.
40
41  * Default definitions in this build.xml file.
42
43  You will note below that property values can be composed based on the
44  contents of previously defined properties.  This is a powerful technique
45  that helps you minimize the number of changes required when your development
46  environment is modified.  Note that property composition is allowed within
47  "build.properties" files as well as in the "build.xml" script.
48
49  -->
50 
51  <!--the first three properties have to be put on the top to be used by build.properties-->
52  <property name="src.packages.home" value="${basedir}/src/packages"/>
53  <property name="gdbm.home" value="${src.packages.home}/gdbm-1.8.3"/>
54  <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
55  <property file="build.properties"/>
56  <if><bool><available file="${user.home}/build.properties"/></bool>
57    <property file="${user.home}/build.properties"/>
58  </if>
59
60  <!-- get properties from the environment -->
61  <property environment="env"/>
62
63   
64  <!-- version properties for external packages -->
65  <property name="tomcat.version" value="apache-tomcat-5.5.25"/>
66  <property name="axis.zip.version" value="axis-bin-1_2_1.zip"/>
67  <property name="axis.dir.version" value="axis-1_2_1"/>
68  <property name="gdbm.version" value="gdbm-1.8.3"/>
69
70  <property name="build.home" value="${basedir}/build"/>
71  <property name="src.home" value="${basedir}/src/java"/>
72  <property name="packages.home" value="${basedir}/packages"/>
73  <!-- this may be set in build.properties, eg if you move the web dir to
74  tomcats webapps directory -->
75  <property name="web.home" value="${basedir}/web"/>
76  <!-- jar files needed by applets go here -->
77  <property name="web.applet" value="${web.home}/applet"/>
78  <!-- jar files needed by the servlet (and extra ones) go here -->
79  <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
80  <!-- other files needed by the servlet go here -->
81  <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
82  <!--- flax: the WordNet home -->
83  <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
84
85  <!-- jni libraries and java wrappers go here -->
86  <property name="lib.jni" value="${basedir}/lib/jni"/>
87 
88  <property name="javadocs" value="${basedir}/docs/javadoc"/>
89
90  <property name="app.name"      value="greenstone3"/>
91  <property name="app.path"      value="/${app.name}"/>
92
93
94  <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
95  <property name="app.version" value="trunk"/>
96  <property name="branch.path" value="trunk"/>
97  <property name="branch.revision" value="HEAD"/>
98
99  <!--constants -->
100  <property name="svn.root" value="http://svn.greenstone.org"/>
101
102  <!--  <property name="cvs.root" value=":pserver:cvs_anon@cvs.scms.waikato.ac.nz:2402/usr/local/global-cvs/gsdl-src"/> -->
103  <!-- catalina home is set to tomcat basedir is already installed, otherwise
104  use greenstone's tomcat -->
105  <condition property="catalina.home" value="${tomcat.installed.path}">
106    <and>
107      <isset property="tomcat.installed.path"/>
108      <not>
109      <equals arg1="" arg2="${tomcat.installed.path}"/>
110      </not>
111    </and>
112  </condition>
113  <property name="catalina.home" value="${packages.home}/tomcat"/>
114
115  <property name="os.linux" value="Linux"/>
116  <property name="os.mac" value="Mac OS X"/>
117  <property name="os.solaris" value="SunOS"/>
118  <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
119  <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME"/> <!-- check this!!!-->
120
121  <!-- this is true for linux and macs -->
122  <condition property="current.os.isunix">
123    <os family="unix"/>
124  </condition>
125 
126  <condition property="current.os.isunixnotmac">
127    <and>
128      <os family="unix"/>
129      <not>
130  <os family="mac"/>
131      </not>
132    </and>
133  </condition>
134  <condition property="current.os.ismac">
135    <os family="mac"/>
136  </condition>
137 
138  <condition property="current.os.iswindows">
139    <os family="windows"/>
140  </condition>
141
142  <condition property="collection.building.enabled">
143    <not>
144      <isset property="disable.collection.building"/>
145    </not>
146  </condition>
147
148  <condition property="collection.building.enabled.windows">
149    <and>
150      <isset property="collection.building.enabled"/>
151      <isset property="current.os.iswindows"/>
152    </and>
153  </condition>
154 
155  <condition property="collection.building.enabled.unix">
156    <and>
157      <isset property="collection.building.enabled"/>
158      <isset property="current.os.isunix"/>
159    </and>
160  </condition>
161 
162  <condition property="independent-indexers">
163    <isset property="disable.collection.building"/>
164  </condition>
165
166  <!-- where is search4j tool -->
167  <condition property="search4j.exec" value="bin/search4j.exe">
168    <isset property="current.os.iswindows"/>
169  </condition>
170  <property name="search4j.exec" value="bin/search4j"/>
171
172 
173  <!-- ============= Base dirs for each package and component ============ -->
174  <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
175  <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
176  <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
177  <property name="gs2build.home" value="${basedir}/gs2build"/>
178  <property name="gli.home" value="${basedir}/gli"/>
179  <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
180 
181  <!--<property name="indexers.home" value="${basedir}/src/packages/indexers">-->
182  <condition property="indexers.home" value="${basedir}/src/packages/indexers">
183    <isset property="disable.collection.building"/>
184  </condition>
185  <condition property="indexers.home" value="${gs2build.home}/common-src/indexers">
186    <not>
187      <isset property="disable.collection.building"/>
188    </not>
189  </condition>
190
191  <property name="mg.home" value="${indexers.home}/mg"/>
192  <property name="mgpp.home" value="${indexers.home}/mgpp"/>
193  <property name="lucene.home" value="${indexers.home}/lucene-gs"/>
194
195  <!--  ==================== Compilation Control Options ==================== -->
196
197  <!--
198
199  These properties control option settings on the Javac compiler when it
200  is invoked using the <javac> task.
201
202  compile.debug        Should compilation include the debug option?
203
204  compile.deprecation  Should compilation include the deprecation option?
205
206  compile.optimize     Should compilation include the optimize option?
207
208  -->
209
210  <property name="compile.debug"       value="true"/>
211  <property name="compile.deprecation" value="true"/>
212  <property name="compile.optimize"    value="true"/>
213
214  <!--
215
216  Rather than relying on the CLASSPATH environment variable, Ant includes
217  features that makes it easy to dynamically construct the classpath you
218  need for each compilation.  The example below constructs the compile
219  classpath to include the servlet.jar file, as well as the other components
220  that Tomcat makes available to web applications automatically, plus anything
221  that you explicitly added.
222
223  -->
224
225  <path id="compile.classpath">
226    <!-- Include all jar files and libraries in our jni lib directory -->
227    <pathelement location="${lib.jni}"/>
228    <fileset dir="${lib.jni}">
229      <include name="*.jar"/>
230    </fileset>
231    <!-- Include all jar files in our web lib directory -->
232    <pathelement location="${web.lib}"/>
233    <fileset dir="${web.lib}">
234      <include name="*.jar"/>
235    </fileset>
236   
237    <!-- Include the axis jar files -->
238    <!--<fileset dir="${basedir}/comms/soap/axis/lib">
239      <include name="*.jar"/>
240    </fileset>-->
241   
242    <!-- include the jar files from the source packages -->
243    <!-- mg and mgpp get installed into lib/jni but they may not be there yet
244    so we add them in by name -->
245    <pathelement location="${lib.jni}/mg.jar"/>
246    <pathelement location="${lib.jni}/mgpp.jar"/>
247   
248    <!-- Include all elements that Tomcat exposes to applications -->
249    <pathelement location="${catalina.home}/common/classes"/>
250    <fileset dir="${catalina.home}/common/endorsed">
251      <include name="*.jar"/>
252    </fileset>
253    <fileset dir="${catalina.home}/common/lib">
254      <include name="*.jar"/>
255    </fileset>
256    <pathelement location="${catalina.home}/shared/classes"/>
257    <fileset dir="${catalina.home}/shared/lib">
258      <include name="*.jar"/>
259    </fileset>
260  </path>
261
262  <path id="local.tomcat.classpath">
263    <!-- explicitly include the jni java wrappers in the classpath -->
264    <pathelement location="${lib.jni}"/>
265    <fileset dir="${lib.jni}">
266      <include name="*.jar"/>
267    </fileset>
268  </path>
269 
270  <path id="local.tomcat.path">
271    <pathelement location="${basedir}/bin/script"/>
272    <pathelement location="${basedir}/bin"/>
273    <pathelement location="${lib.jni}"/>
274    <pathelement path="${env.PATH}"/>
275    <pathelement path="${env.Path}"/>
276    <pathelement path="${wn.home}/bin"/>
277  </path>
278
279  <target name="test-setup">
280    <echo>ant java version=${ant.java.version}</echo>
281    <echo>is unix : ${current.os.isunix}</echo>
282    <echo>is mac : ${current.os.ismac}</echo>
283    <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
284    <echo>is windows : ${current.os.iswindows}</echo>
285    <echo>os.unix: ${os.unix}</echo>
286  </target>
287  <!-- ==================== Primary and Global Targets ============================= -->
288
289  <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
290
291  <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections,prepare-gdbm, prepare-flax"
292    description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
293    <!--  <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
294    description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional cvs checkouts and downloads, so you need to be online to run this.">-->
295
296    <!-- make sure .sh files are executable -->
297    <chmod dir="${basedir}" perm="ugo+rx"
298      includes="*.sh"/>
299    <chmod dir="${basedir}/bin/script" perm="ugo+rx"
300      includes="*.sh,*.pl"/>
301  </target>
302
303  <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile"
304    description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
305 
306  <!--  <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
307  description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>-->
308  <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-gs2building,svnupdate-web"
309    description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
310
311  <target name="configure-c++" depends="init,configure-packages,configure-core,configure-gs2building"
312    description="Configure any C/C+/+ package code and gs2building code if necessary"/>
313 
314  <target name="configure" depends="init,configure-tomcat,configure-web"
315    description="Configure the installation. Includes setting up config files. Should be re-run if you change the build.properties file."/>
316
317  <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building,clean-gdbm"
318    description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
319 
320  <target name="distclean" depends="init,distclean-packages,clean-core,distclean-gs2building,distclean-gdbm"
321    description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes core, packages, gs2building as necessary"/>
322 
323  <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
324    description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
325 
326  <target name="update" depends="init,svnupdate,clean,configure,configure-c++,compile"
327    description="Update (thru Subversion) all the source (including core, packages and gs2building), then clean, configure and recompile. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
328
329  <target name="start" depends="init,start-tomcat"
330    description="Startup the Tomcat server." >
331    <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
332    <echo>Tomcat: ${catalina.home}</echo>
333    <echo>Java  : ${java.home}</echo>
334    <echo>URL   : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
335    <!-- assuming that index.html is not needed here -->   
336  </target>
337
338  <target name="stop" depends="init,stop-tomcat"
339    description="Shutdown the Tomcat server."/>
340 
341  <target name="restart" description="Shutdown and restart Tomcat"  depends="init,stop,start"/>
342
343
344  <!-- =========== Help targets ===================================  -->
345 
346  <property name="install-command" value="ant [options] prepare install"/>
347 
348  <target name="usage" description="Print a help message">
349    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
350    <echo message="  Execute 'ant -help' for Ant help."/>
351    <echo>To install Greenstone3, run '${install-command}'.
352      There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
353      To log the output, use the '-logfile build.log' option.
354      The README.txt file has more information about the ant targets and install process.
355    </echo>
356  </target>
357 
358  <target name="help" depends="usage" description="Print a help message"/>
359 
360  <target name="debug" depends="init" description="Display all the currently used properties">
361    <echoproperties/>
362  </target>
363
364  <!-- ====== initialization and setup targets ================== -->
365
366  <target name="accept-properties" unless="properties.accepted">
367    <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
368      tomcat.server=${tomcat.server}
369      tomcat.port=${tomcat.port}
370      tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
371      proxy.host=${proxy.host}
372      proxy.port=${proxy.port}
373      If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
374    </input>
375    <condition property="do.abort">
376      <equals arg1="n" arg2="${properties.ok}"/>
377    </condition>
378    <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
379  </target>
380
381
382  <!-- this sets up some initial properties -->
383  <target name="init">
384
385    <condition property="java.too.old">
386      <or>
387        <equals arg1="1.1" arg2="${ant.java.version}"/>
388        <equals arg1="1.2" arg2="${ant.java.version}"/>
389        <equals arg1="1.3" arg2="${ant.java.version}"/>
390      </or>
391    </condition>
392    <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
393   
394    <available file="${indexers.home}" property="indexers.present"/>
395    <available file="${basedir}/gli" property="gli.present"/>
396    <available file="${basedir}/gs2build" property="gs2build.present"/>
397
398    <condition property="tomcat.islocal">
399      <or>
400        <not><isset property="tomcat.installed.path"/></not>
401        <equals arg1="" arg2="${tomcat.installed.path}"/>
402      </or>
403    </condition>
404   
405    <echo>tomcat.port = ${tomcat.port}</echo>
406    <echo>gli.present = ${gli.present}</echo>
407    <echo>gs2build.present = ${gs2build.present}</echo>
408    <!-- gsdl2.installed.path appears not to be set, so wrap in if block -->
409    <if>
410        <bool><isset property="gsdl2.installed.path"/></bool>
411        <echo>gsdl2.installed.path = ${gsdl2.installed.path}</echo>
412    </if>
413
414    <condition property="proxy.present">
415      <and>
416        <isset property="proxy.host"/>
417        <not><equals arg1="" arg2="${proxy.host}"/></not>
418      </and>
419    </condition>
420
421    <condition property="need.macos.extra">
422      <and>
423        <isset property="current.os.ismac"/>
424        <not><isset property="disable.collection.building"/></not>
425      </and>
426    </condition>
427  </target>
428
429  <target name="setup-proxy" depends="init" if="proxy.present">
430    <condition property="ask.user">
431      <or>
432        <equals arg1="" arg2="${proxy.user}"/>
433        <equals arg1="" arg2="${proxy.password}"/>
434      </or>
435    </condition>
436    <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
437    <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
438  </target>
439 
440  <!-- ========== Web app Targets ================================ -->
441 
442  <target name="prepare-web" depends="init,configure-java-version">
443    <mkdir dir="${web.home}/applet"/>
444    <mkdir dir="${web.home}/logs"/>
445  </target>
446 
447  <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib,  but if we are using java 1.4, we can't have it there -->
448  <target name="configure-java-version" depends="init"
449    description="Activates or deactivates some jar libraries as needed depending on your java version">
450
451    <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
452    <condition property="need.xalan.jar">
453      <or>
454        <equals arg1="1.5" arg2="${ant.java.version}"/>
455        <equals arg1="1.6" arg2="${ant.java.version}"/>
456      </or>
457    </condition>
458
459    <!-- if they have xalan.jar but dont need it -->
460    <if>
461      <bool>
462        <and>
463          <isset property="have.xalan.jar"/>
464          <not><isset property="need.xalan.jar"/></not>
465        </and>
466      </bool>
467      <antcall target="deactivate-xalan-jar"/>
468    </if>
469
470    <!-- if they need xalan.jar but dont have it -->
471    <if>
472      <bool>
473        <and>
474          <not><isset property="have.xalan.jar"/></not>
475          <isset property="need.xalan.jar"/>
476        </and>
477      </bool>
478      <antcall target="activate-xalan-jar"/>
479    </if>
480
481  </target>
482 
483  <target name="activate-xalan-jar">
484    <echo>activating xalan.jar</echo>
485    <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
486    <if><bool><isset property="current.os.ismac"/></bool>
487      <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
488    </if>
489  </target>
490
491  <!-- to delete -->
492  <target name="copy-xalan-for-mac"></target>
493
494  <target name="deactivate-xalan-jar">
495    <echo>deactivating xalan.jar</echo>
496    <delete file="${web.lib}/xalan.jar"/>
497  </target>
498
499
500  <target name="prepare-collections" depends="init">
501    <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
502    <property name="import.zip" value="import.zip"/>
503    <property name="metadata.zip" value="metadata.zip"/>
504    <property name="index.zip" value="index/index.zip"/>
505
506    <echo message="installing collections..."/>
507    <antcall target="gs2mgdemo-install"/>
508    <antcall target="gs2mgppdemo-install"/>
509    <antcall target="gberg-install"/>
510  </target>
511
512  <target name="gs2mgdemo-prepare" if="collect.dir">
513    <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
514    <fileset id="gs2mgdemofiles" dir="${gs2mgdemo.dir}">
515      <include name="${import.zip}"/>
516      <include name="${metadata.zip}"/>
517      <include name="${index.zip}"/>
518    </fileset>
519
520    <condition property="gs2mgdemo.present">
521      <and>
522        <available file="${gs2mgdemo.dir}/${import.zip}"/>
523        <available file="${gs2mgdemo.dir}/${metadata.zip}"/>
524        <available file="${gs2mgdemo.dir}/${index.zip}"/>
525      </and>
526    </condition>
527  </target>
528
529  <target name="gs2mgdemo-install" if="gs2mgdemo.present"  depends="gs2mgdemo-prepare">
530    <echo> installing gs2mgdemo</echo>
531    <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${import.zip}" />
532    <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${metadata.zip}" />
533    <unzip dest="${gs2mgdemo.dir}/index" src="${gs2mgdemo.dir}/${index.zip}" />
534    <!--Don't delete the zips, else doing an svn update will get them all over again.-->
535    <!--<delete><fileset refid="gs2mgdemofiles"/></delete>-->
536    <echo>collection gs2mgdemo installed</echo>
537  </target>
538
539  <target name="gs2mgppdemo-prepare" if="collect.dir">
540    <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
541 
542    <fileset id="gs2mgppdemofiles" dir="${gs2mgppdemo.dir}">
543      <include name="${import.zip}"/>
544      <include name="${metadata.zip}"/>
545      <include name="${index.zip}"/>
546    </fileset>
547
548    <condition property="gs2mgppdemo.present">
549      <and>
550        <available file="${gs2mgppdemo.dir}/${import.zip}"/>
551        <available file="${gs2mgppdemo.dir}/${metadata.zip}"/>
552        <available file="${gs2mgppdemo.dir}/${index.zip}"/>
553      </and>
554    </condition>
555  </target>
556
557  <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
558    <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${import.zip}" />
559    <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${metadata.zip}" />
560    <unzip dest="${gs2mgppdemo.dir}/index" src="${gs2mgppdemo.dir}/${index.zip}" />
561    <!--<delete><fileset refid="gs2mgppdemofiles"/></delete>-->
562    <echo>collection gs2mgppdemo installed</echo>
563  </target>   
564
565  <target name="gberg-prepare" if="collect.dir">
566    <property name="gberg.dir" value="${collect.dir}/gberg"/>
567    <fileset id="gbergfiles" dir="${gberg.dir}">
568      <include name="${index.zip}"/>
569    </fileset>
570    <available file="${gberg.dir}/${index.zip}" property="gberg.present"/>
571  </target>
572
573  <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
574    <unzip dest="${gberg.dir}/index">
575      <fileset refid="gbergfiles"/>
576    </unzip>
577    <!--<delete><fileset refid="gbergfiles"/></delete>-->
578    <echo>collection gberg installed</echo>
579  </target>
580
581  <!--
582  <target name="prepare-collections" depends="init">
583    <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
584    <unzip src="${collect.dir}/gs2mgdemo/import.zip"
585      dest="${collect.dir}/gs2mgdemo"/>
586    <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
587      dest="${collect.dir}/gs2mgdemo"/>
588    <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
589      dest="${collect.dir}/gs2mgdemo/index"/>
590    <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
591    <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
592    <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
593   
594    <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
595      dest="${collect.dir}/gs2mgppdemo"/>
596    <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
597      dest="${collect.dir}/gs2mgppdemo"/>
598    <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
599      dest="${collect.dir}/gs2mgppdemo/index"/>
600    <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
601    <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
602    <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
603 
604    <unzip src="${collect.dir}/gberg/index/index.zip"
605      dest="${collect.dir}/gberg/index"/>
606    <delete file="${collect.dir}/gberg/index/index.zip"/>
607  </target>
608  -->
609
610  <target name="configure-web" depends="init"
611    description="Configure only the web app config files">
612    <!-- we want a unix path in the global.properties file -->
613    <pathconvert targetos="unix" property="src.gsdl3.home.unix">
614      <path path="${web.home}"/>
615    </pathconvert>
616    <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
617    <filter token="gsdl3version" value="${app.version}"/>
618    <filter token="tomcat.server" value="${tomcat.server}"/>
619    <filter token="tomcat.port" value="${tomcat.port}"/>
620    <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
621    <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
622    <chmod file="${web.classes}/global.properties" perm="600"/>
623    <chmod file="${web.classes}/log4j.properties" perm="600"/>
624  </target>
625
626  <target name="compile-web" depends="init">
627    <javac srcdir="${web.classes}"
628      destdir="${web.classes}"
629      debug="${compile.debug}"
630      deprecation="${compile.deprecation}"
631      optimize="${compile.optimize}">
632      <classpath><path refid="compile.classpath"/></classpath>
633    </javac>
634  </target>
635
636  <target name="svnupdate-web" unless="nosvn.mode">
637    <svn>
638      <update dir="${web.home}" revision="${branch.revision}"/>
639    </svn>
640  </target>
641
642  <target name="update-web" depends="init,svnupdate-web,configure-web"
643    description="update only the web stuff (config files)"/>
644
645  <!-- ======================= Tomcat Targets ========================== -->
646 
647  <!-- this target downloads and installs Tomcat -->
648  <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
649  <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
650
651    <if>
652      <bool>
653        <not><available file="${packages.home}/tomcat/.flagfile"/></not>
654      </bool>
655
656      <!-- check that packages dir is there -->
657      <mkdir dir="${packages.home}"/>
658      <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
659        dest="${packages.home}/${tomcat.version}.zip"
660        usetimestamp="true"/>
661      <unzip src="${packages.home}/${tomcat.version}.zip"
662        dest="${packages.home}"/>
663      <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
664        dest="${packages.home}/${tomcat.version}-compat.zip"
665        usetimestamp="true"/>
666      <unzip src="${packages.home}/${tomcat.version}-compat.zip"
667        dest="${packages.home}"/>
668      <!-- delete any existing tomcat -->
669      <delete dir="${packages.home}/tomcat"/>
670      <move todir="${packages.home}/tomcat">
671        <fileset dir="${packages.home}/${tomcat.version}"/>
672      </move>
673      <copy file="${basedir}/resources/tomcat/setclasspath.bat"
674        tofile="${packages.home}/tomcat/bin/setclasspath.bat"
675        overwrite="true"/>
676      <copy file="${basedir}/resources/tomcat/setclasspath.sh"
677        tofile="${packages.home}/tomcat/bin/setclasspath.sh"
678        overwrite="true"/>
679      <!-- make sure we have execute permission for the .sh files -->
680      <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
681        includes="*.sh"/>   
682
683      <echo file="${packages.home}/tomcat/.flagfile">
684        the timestamp of this file is the time that tomcat was extracted from the zip files.
685        it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
686      </echo>
687
688      <else>
689        <echo>Tomcat has been prepared, will not prepare</echo>
690        <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
691      </else>
692
693    </if>
694
695  </target>
696 
697  <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
698 
699  <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
700    <!-- re-setup the server.xml file -->
701    <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
702      <filterset>
703        <filter token="port" value="${tomcat.port}"/>
704        <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
705      </filterset>
706    </copy>
707    <!-- set up the greenstone3 context -->
708    <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
709      <filterset>
710        <filter token="gsdl3webhome" value="${web.home}"/>
711      </filterset>
712    </copy>
713  </target>
714
715  <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
716    <!-- re-setup the server.xml file -->
717    <!-- need to edit the config file, or do we get the user to do this???-->
718  </target>
719 
720  <target name="start-tomcat" description="Startup only Tomcat" depends="init,configure-java-version" if="tomcat.islocal">
721    <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
722    <property name="tomcat.path" refid="local.tomcat.path"/>
723    <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
724    <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
725      <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
726      <env key="GSDL3HOME" value="${basedir}"/>
727      <env key="PATH" path="${tomcat.path}"/>
728      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
729      <env key="CATALINA_HOME" value="${catalina.home}"/>
730      <env key="CLASSPATH" path="${tomcat.classpath}"/>
731      <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
732      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
733      <env key="WNHOME" path="${wn.home}"/>
734    </exec>
735    <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
736      <env key="GSDLOS" value="windows"/>
737      <env key="GSDL3HOME" value="${basedir}"/>
738      <env key="Path" path="${tomcat.path}"/>
739      <env key="PATH" path="${tomcat.path}"/>
740      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
741      <env key="CATALINA_HOME" value="${catalina.home}"/>
742      <env key="CLASSPATH" path="${tomcat.classpath}"/>
743    </exec>
744    <!-- wait for the server to startup in case other targets need it running -->
745    <waitfor maxwait="5" maxwaitunit="second">
746      <and>
747        <socket server="${tomcat.server}" port="${tomcat.port}"/>
748        <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
749      </and>
750    </waitfor>
751  </target>
752
753  <!-- windows: do we want to launch a webrowser?? -->
754  <!-- shouldn't this test whether anything is running first? -->
755  <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
756    <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
757      <env key="CATALINA_HOME" value="${catalina.home}"/>
758    </exec>
759    <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
760      <env key="CATALINA_HOME" value="${catalina.home}"/>
761    </exec>
762  </target>
763
764  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
765
766  <target name="setup-catalina-ant-tasks">
767    <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
768    <taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"
769      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
770    <taskdef name="list"      classname="org.apache.catalina.ant.ListTask"
771      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
772    <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"
773      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
774    <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
775      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
776    <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"
777      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
778    <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"
779      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
780    <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"
781      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
782    <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
783      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
784  </target>
785
786
787  <!-- ======================= ant Targets ============================ -->
788  <target name="prepare-ant" depends="init">
789    <if>
790      <bool>
791        <not><available file="${packages.home}/ant/.flagfile"/></not>
792      </bool>
793
794      <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
795        dest="${packages.home}/apache-ant-1.7.0-bin.zip"
796        usetimestamp="true"/>
797      <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
798        dest="${packages.home}"/>
799      <move todir="${packages.home}/ant">
800        <fileset dir="${packages.home}/apache-ant-1.7.0"/>
801      </move>
802      <echo file="${packages.home}/ant/.flagfile">
803        the timestamp of this file is the time that ant was extracted from the zip files.
804        it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
805      </echo>
806
807      <else>
808        <echo>Ant has been prepared, will not prepare</echo>
809        <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
810      </else>
811
812    </if>
813  </target>
814
815  <!-- ======================= Axis Targets ============================ -->
816
817  <target name="prepare-axis" depends="init">
818
819    <if>
820      <bool>
821        <not><available file="${packages.home}/axis/.flagfile"/></not>
822      </bool>
823
824      <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
825        dest="${packages.home}/${axis.zip.version}"
826        usetimestamp="true"/>
827      <unzip src="${packages.home}/${axis.zip.version}"
828        dest="${packages.home}"/>
829      <move todir="${packages.home}/axis">
830        <fileset dir="${packages.home}/${axis.dir.version}"/>
831      </move>
832      <!-- install axis into greenstone web app -->
833      <copy todir="${web.lib}">
834        <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
835          <include name="*.jar"/>
836        </fileset>
837      </copy>
838      <copy todir="${web.home}">
839        <fileset dir="${packages.home}/axis/webapps/axis/">
840          <include name="*.jsp"/>
841          <include name="*.jws"/>
842        </fileset>
843      </copy>
844      <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
845      <copy todir="${web.classes}">
846        <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
847          <include name="*.properties"/>
848        </fileset>
849      </copy>
850      <echo file="${packages.home}/axis/.flagfile">
851        the timestamp of this file is the time that axis was extracted from the zip files.
852        it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
853      </echo>
854
855      <else>
856        <echo>Axis has been prepared, will not prepare</echo>
857        <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
858      </else>
859
860    </if>
861  </target>
862
863  <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
864    description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
865   
866    <target name="deploy-site">
867    <java classname="org.apache.axis.client.AdminClient">
868      <classpath refid="compile.classpath"/>
869      <arg value="-l"/>
870      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
871      <arg file="${basedir}/resources/soap/deploy.wsdd"/>
872    </java>
873    <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
874  </target>
875 
876  <target name="soap-undeploy-site" depends="get-undeploy-service-name"
877    description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
878    <filter token="servicesname" value="${axis.undeploy.servicename}"/>
879    <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
880      tofile="${basedir}/resources/soap/undeploy.wsdd"
881      filtering="true"
882      overwrite="true"/>
883    <java classname="org.apache.axis.client.AdminClient">
884      <classpath refid="compile.classpath"/>
885      <arg value="-l"/>
886      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
887      <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
888    </java>
889    <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
890  </target> 
891
892  <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
893  with the default servicename of localsite-->
894  <target name="deploy-localsite" depends="init"
895    description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
896    <antcall target="start-tomcat"/>
897    <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
898    <antcall target="create-deployment-files">
899      <param name="axis.sitename" value="localsite"/>
900      <param name="axis.servicesname" value="${base.webservice.name}"/>
901      <param name="axis.siteuri" value="localsite"/>
902    </antcall>
903    <antcall target="deploy-site">
904      <param name="axis.sitename" value="localsite"/>
905      <param name="axis.servicesname" value="${base.webservice.name}"/>
906      <param name="axis.siteuri" value="localsite"/>
907    </antcall>
908    <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
909  </target>
910   
911  <target name="get-sitename" unless="axis.sitename">
912    <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
913Press Enter for default:localsite</input>
914  </target>
915
916  <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
917    <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
918To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
919Or press Enter for undeploying the default:localsite /></input>
920     <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
921  </target>
922
923  <target name="get-webservices" unless="axis.servicesname">
924    <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
925Choose from: ${web.services.list}
926Or press Enter for default:${base.webservice.name} /></input>
927    <echo>${axis.servicesname}</echo>
928  </target>
929
930  <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
931    <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
932    <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
933  </target>
934
935  <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC"  if="axis.servicesname">
936   <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
937      <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
938    </condition>
939   
940   <!--everything else defaults to java:RPC at present-->
941   <condition property="soap.method" value="provider='java:RPC'">
942     <not>
943      <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
944    </not>
945    </condition>
946  </target>
947   
948  <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
949    <filter token="sitename" value="${axis.sitename}"/>
950    <filter token="siteuri" value="${axis.siteuri}"/>
951    <filter token="servicesname" value="${axis.servicesname}"/>
952    <filter token="soapmethod" value="${soap.method}"/>
953    <copy file="${basedir}/resources/soap/site.wsdd.template"
954      tofile="${basedir}/resources/soap/deploy.wsdd"
955      filtering="true"
956      overwrite="true"/>
957    <!-- create the java files and compile them -->
958    <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
959      tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
960      filtering="true"
961      overwrite="true"/>
962    <mkdir dir="${build.home}"/>
963    <javac srcdir="${src.home}"
964      destdir="${build.home}"
965      debug="${compile.debug}"
966      deprecation="${compile.deprecation}"
967      optimize="${compile.optimize}">
968      <classpath refid="compile.classpath"/>
969      <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
970    </javac>
971    <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
972    <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
973      tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
974      overwrite="true" />
975  </target>
976 
977
978  <!-- ====================== Core targets ============================== -->
979  <!-- core targets refer to the core gsdl3 java src -->
980 
981  <target name="prepare-core" unless="nosvn.mode">
982    <!-- just get rid of empty directories-->
983    <svn>
984      <update dir="."  revision="${branch.revision}"/>
985    </svn>
986  </target>
987 
988  <target name="configure-core"/>
989
990  <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
991    description="Update only the Greenstone core" />
992 
993  <target name="svnupdate-core" unless="nosvn.mode">
994
995    <svn>
996      <update dir="." recurse="false" revision="${branch.revision}"/>
997    </svn>
998
999    <svn>
1000      <update dir="bin" revision="${branch.revision}"/>
1001      <update dir="comms" revision="${branch.revision}"/>
1002      <update dir="dist-resources" revision="${branch.revision}"/>
1003      <update dir="docs" revision="${branch.revision}"/>
1004      <update dir="lib" revision="${branch.revision}"/>
1005      <update dir="resources" revision="${branch.revision}"/>
1006      <update dir="src" revision="${branch.revision}"/>
1007      <update dir="winutil" revision="${branch.revision}"/>
1008    </svn>
1009
1010  </target>
1011
1012  <target name="clean-core"
1013    description="Clean only the Greenstone core">
1014    <delete dir="${build.home}"/>
1015  </target>
1016
1017  <target name="compile-core" depends="init"
1018    description="Compile only the Greenstone core">
1019    <mkdir dir="${build.home}"/>
1020    <javac srcdir="${src.home}"
1021      destdir="${build.home}"
1022      debug="${compile.debug}"
1023      deprecation="${compile.deprecation}"
1024      optimize="${compile.optimize}">
1025      <classpath>
1026        <path refid="compile.classpath"/>
1027      </classpath>
1028    </javac>
1029    <jar destfile="${build.home}/gsdl3.jar">
1030      <fileset dir="${build.home}">
1031        <include name="org/greenstone/gsdl3/**"/>
1032        <include name="org/flax/**"/>
1033        <exclude name="**/Test.class"/>
1034      </fileset>
1035      <manifest>
1036        <attribute name="Built-By" value="${user.name}" />
1037      </manifest>
1038    </jar>
1039    <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1040    <!-- copy the localsite server in case we need it -->
1041    <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1042
1043    <jar destfile="${build.home}/GAI.jar">
1044      <fileset dir="${build.home}">
1045        <include name="org/greenstone/admin/**"/>
1046      </fileset>
1047      <manifest>
1048        <attribute name="Built-By" value="${user.name}" />
1049      </manifest>
1050    </jar>
1051   
1052    <jar destfile="${build.home}/phind.jar">
1053      <fileset dir="${build.home}">
1054        <include name="org/greenstone/applet/phind/**"/>
1055      </fileset>
1056      <manifest>
1057        <attribute name="Built-By" value="${user.name}" />
1058      </manifest>
1059    </jar>
1060    <mkdir dir="${web.applet}"/>
1061    <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1062    <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1063    <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
1064    <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
1065    <jar destfile="${build.home}/anttasks.jar">
1066      <fileset dir="${build.home}">
1067        <include name="org/greenstone/anttasks/**"/>
1068      </fileset>
1069      <manifest>
1070        <attribute name="Built-By" value="${user.name}" />
1071      </manifest>
1072    </jar>
1073    <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
1074    <jar destfile="${build.home}/gsdl3test.jar">
1075      <fileset dir="${build.home}">
1076        <include name="org/greenstone/gsdl3/**/*Test.class"/>
1077        <include name="org/greenstone/testing/**"/>
1078      </fileset>
1079      <manifest>
1080        <attribute name="Built-By" value="${user.name}" />
1081      </manifest>
1082    </jar>
1083    <jar destfile="${build.home}/server.jar">
1084      <fileset dir="${build.home}">
1085        <include name="org/greenstone/server/**"/>
1086      </fileset>
1087      <fileset file="${basedir}/resources/java/server.properties"/>
1088      <manifest>
1089        <attribute name="Built-By" value="${user.name}"/>
1090      </manifest>
1091    </jar>
1092    <copy file="${build.home}/server.jar" todir="${basedir}"/>
1093  </target>
1094 
1095  <!-- ================== Packages targets ================================ -->
1096  <!-- these targets refer to the greenstone source packages - these need
1097  updating less often, so are in  separate targets to the core -->
1098  <target name="prepare-packages" depends="init,prepare-indexers"/>
1099 
1100  <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nosvn.mode">
1101    <svn>
1102      <checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers" revision="${branch.revision}"/>
1103    </svn>
1104  </target>
1105 
1106  <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
1107    <antcall target="checkout-indexers"/>
1108  </target>
1109
1110  <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1111    description="Update only the source packages"/>
1112
1113  <target name="svnupdate-packages" unless="nosvn.mode">
1114    <svn>
1115      <update dir="${src.packages.home}" revision="${branch.revision}"/>
1116    </svn>
1117  </target>
1118 
1119  <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
1120    description="Configure only the packages."/>
1121 
1122  <target name="configure-javagdbm">
1123    <echo>
1124      Configuring JavaGDBM
1125    </echo>
1126    <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
1127      dir="${javagdbm.home}">
1128      <arg value="--prefix=${basedir}"/>
1129      <arg value="--libdir=${lib.jni}"/>
1130    </exec>   
1131    <exec executable="${javagdbm.home}/configure" os="${os.mac}"
1132      dir="${javagdbm.home}">
1133      <arg value="--prefix=${basedir}"/>
1134      <arg value="--libdir=${lib.jni}"/>
1135      <arg value="--with-gdbm=${gdbm.installed.path}"/>
1136    </exec>   
1137  </target>
1138
1139  <!-- Message from oran. I removed the condition from this line becuase it meant
1140  the indexers would only be configured if collection building was DISabled.
1141  Shouldn't they be configured when collection building is ENabled? -->
1142
1143  <!-- <target name="configure-indexers" depends="init" if="independent-indexers"> -->
1144  <target name="configure-indexers" depends="init">
1145    <echo>Configuring Indexers</echo>
1146    <exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
1147      <arg value="--prefix=${basedir}"/>
1148      <arg value="--libdir=${lib.jni}"/>
1149    </exec>         
1150  </target>
1151
1152  <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
1153
1154  <target name="clean-javagdbm" depends="init">
1155    <exec executable="make" os="${os.unix}"
1156      dir="${javagdbm.home}">
1157      <arg value="clean"/>
1158    </exec>
1159  </target>
1160 
1161  <target name="clean-indexers" depends="init" if="independent-indexers">
1162    <exec executable="make" os="${os.unix}"
1163      dir="${indexers.home}">
1164      <arg value="clean"/>
1165    </exec>
1166    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1167      dir="${indexers.home}">
1168      <arg value="clean"/>
1169    </exec>
1170  </target>
1171
1172  <target name="distclean-packages" depends="init,distclean-javagdbm,distclean-indexers" description="Distclean only the packages"/>
1173
1174  <target name="distclean-javagdbm" depends="init">
1175    <exec executable="make" os="${os.unix}"
1176      dir="${javagdbm.home}">
1177      <arg value="distclean"/>
1178    </exec>
1179  </target>
1180 
1181  <target name="distclean-indexers" depends="init" if="independent-indexers">
1182    <exec executable="make" os="${os.unix}"
1183      dir="${indexers.home}">
1184      <arg value="distclean"/>
1185    </exec>
1186    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1187      dir="${indexers.home}">
1188      <arg value="clean"/>
1189    </exec>
1190  </target>
1191 
1192  <target name="compile-packages" description="Compile only the source packages">
1193   
1194    <!-- javagdbm -->
1195    <echo>compile javagdbm</echo>
1196    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
1197    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
1198      <arg value="install"/>
1199    </exec>
1200
1201    <!-- windows: just the java stuff. -->
1202    <echo>Windows: compile javagdbm (java only)</echo>
1203    <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
1204      <arg value="compile"/>
1205      <arg value="javaonly"/>
1206    </exec>
1207
1208    <!-- install the jar file -->
1209    <echo>Install the javagdbm jar file</echo>
1210    <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1211
1212    <!-- Indexers -->
1213
1214    <!-- this may be in gs2build - we will be recompiling, but never mind -->
1215    <echo>Indexers: make (from ${indexers.home})</echo>
1216    <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
1217    <echo>Indexers: make install</echo>
1218    <exec executable="make" os="${os.unix}" dir="${indexers.home}">
1219      <arg value="install"/>
1220    </exec>
1221
1222    <echo>Indexers: make</echo>
1223    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1224      <arg value="all"/>
1225    </exec>
1226    <echo>Indexers: make install</echo>
1227    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1228      <arg value="install"/>
1229    </exec>
1230
1231    <!-- install the jar and jni files -->
1232    <echo>Install the indexers' jar and jni files</echo>
1233    <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1234    <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1235    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1236    <antcall target="install-jni-files"/>
1237  </target>
1238
1239  <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1240
1241  <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1242    <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1243    <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1244    <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1245    <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1246    <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1247    <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1248  </target>
1249  <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1250    <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1251    <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1252    <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1253    <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1254    <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1255    <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1256  </target>
1257  <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1258    <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1259    <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1260    <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1261    <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1262    <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1263    <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1264  </target>
1265 
1266  <!-- ================== gs2building targets ===============-->
1267
1268
1269  <target name="update-gs2building" if="collection.building.enabled"
1270    depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1271    description="Update only the Greenstone 2 building components"/>
1272
1273  <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode">
1274  </target>
1275
1276  <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1277    <!-- please keep this function in sync with checkout-gs2build -->
1278
1279    <echo>updating gs2build</echo>
1280    <!-- svn updates -->
1281    <svn>
1282      <!-- perllib -->
1283      <update dir="gs2build" revision="${branch.revision}"/>
1284    </svn>
1285  </target>
1286 
1287  <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1288    <svn>
1289      <update dir="${gli.home}" revision="${branch.revision}"/>
1290    </svn>
1291  </target>
1292
1293  <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1294  </target>
1295  <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1296    <!-- please keep this function in sync with update-gs2build -->
1297    <echo>checking out gs2build</echo>
1298
1299    <!-- this has to be created first to avoid errors when trying to export to it later -->
1300    <mkdir dir="${basedir}/gs2build/src/lib"/>
1301
1302    <!-- svn checkouts -->
1303    <svn>
1304      <!-- perllib -->
1305      <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1306
1307    </svn>
1308  </target>
1309
1310  <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1311    <antcall target="checkout-gs2build"/>
1312    <antcall target="unzip-windows-packages"/>
1313    <antcall target="checkout-winbin"/>
1314    <antcall target="get-windows-binaries"/>
1315    <antcall target="delete-winbin"/>
1316    <antcall target="get-macos-extra"/>
1317  </target>
1318
1319  <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1320    unless="nosvn.mode">
1321    <svn>
1322      <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1323    </svn>
1324  </target>
1325
1326  <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1327    <svn>
1328      <update dir="winbin" revision="${branch.revision}"/>
1329    </svn>
1330  </target>
1331 
1332  <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1333    <move todir="${gs2build.home}/bin/windows" failonerror="false">
1334      <fileset dir="${basedir}/winbin/bin"/>
1335    </move>
1336  </target>
1337  <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1338    <delete dir="${basedir}/winbin"/>
1339  </target>
1340 
1341  <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows"> 
1342    <unzip src="${gs2build.home}/common-src/packages/windows/gdbm/gdbm.zip"
1343      dest="${gs2build.home}/common-src/packages/windows/gdbm"/>
1344    <unzip src="${gs2build.home}/common-src/packages/windows/crypt/crypt.zip"
1345      dest="${gs2build.home}/common-src/packages/windows/crypt"/>
1346    <unzip src="${gs2build.home}/common-src/packages/windows/expat/expat.zip"
1347      dest="${gs2build.home}/common-src/packages/windows/expat"/>
1348  </target>
1349 
1350  <!-- downloads a good XML-Parser -->
1351  <target name="get-macos-extra" depends="init" if="need.macos.extra">
1352    <!--
1353    <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1354      dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1355      usetimestamp="true"/>
1356      -->
1357    <echo>Nothing extra currently needed for MacOs prepare</echo>
1358  </target>
1359
1360  <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1361  <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
1362    <!-- make sure these directories are present, otherwise chmod craps out
1363    this chmod is needed in case we are unpacking for a second time -->
1364    <!--
1365    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1366    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1367    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1368    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1369    <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1370      dest="${gs2build.home}/perllib/cpan/"
1371      compression="gzip"/>
1372    -->
1373    <echo>Nothing extra currently needed for MacOs install</echo>
1374  </target>
1375
1376  <target name="install-indexer-files" depends="init" unless="indexers.present">
1377    <copy todir="${indexers.home}">
1378      <fileset dir="${gs2build.home}/common-src/indexers" />
1379    </copy>
1380    <chmod file="${indexers.home}/configure" perm="a+x"/>
1381  </target>
1382
1383  <target name="rename-gs2build-files" depends="gs2build-edit-setup-bat" if="collection.building.enabled"/>
1384 
1385  <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1386    <!-- we want a windows path in the setup.bat file -->
1387    <pathconvert targetos="windows" property="gs2build.home.windows">
1388      <path path="${gs2build.home}"/>
1389    </pathconvert>
1390    <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1391      <filterset>
1392        <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1393      </filterset>
1394    </move> 
1395    <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1396  </target>
1397 
1398  <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1399    <antcall target="checkout-gli"/>
1400  </target>
1401 
1402  <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1403    <echo>checking out gli</echo>
1404    <svn>
1405      <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1406    </svn>
1407  </target>
1408 
1409  <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1410    description="Configure only the Greenstone 2 building components">
1411    <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1412      dir="${gs2build.home}">
1413      <arg value="--prefix=${gs2build.home}"/>
1414    </exec>
1415    <exec executable="${gs2build.home}/configure" os="${os.mac}"
1416      dir="${gs2build.home}">
1417      <arg value="--prefix=${gs2build.home}"/>
1418      <arg value="--with-gdbm=${gdbm.installed.path}"/>
1419    </exec>
1420  </target>
1421
1422  <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1423    description="Clean only the Greenstone 2 building components"
1424    if="collection.building.enabled"/>
1425 
1426  <target name="clean-gli" depends="init" if="collection.building.enabled">
1427    <!-- gli -->
1428    <property name="gli.home" value="${basedir}/gli"/>
1429    <!-- linux -->
1430    <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1431      resolveExecutable="true"/>
1432    <!-- windows -->
1433    <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1434      resolveExecutable="true"/>
1435  </target>
1436 
1437  <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1438    <!-- gs2build -->
1439    <!--linux:  -->
1440    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1441      <arg value="clean"/>
1442    </exec>
1443    <!-- windows: -->   
1444    <!-- run the setup script -->
1445    <!--<exec executable="${compile.windows.c++.setup}" os="${os.windows}" />-->
1446    <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
1447    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}" >
1448      <arg value="/f"/>
1449      <arg value="win32.mak"/>
1450      <arg value="clean"/>
1451    </exec>
1452  </target>
1453 
1454  <target name="distclean-gs2building" depends="init,clean-gli,clean-gs2build,distclean-gs2build"
1455    description="Distclean only the Greenstone 2 building components"
1456    if="collection.building.enabled"/>
1457
1458  <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1459    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1460      <arg value="distclean"/>
1461    </exec>
1462  </target>
1463 
1464  <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1465    description="Compile only the Greenstone 2 building components">
1466  </target>
1467 
1468  <target name="compile-gli" depends="init" if="collection.building.enabled">
1469    <!-- gli -->
1470    <property name="gli.home" value="${basedir}/gli"/>
1471
1472    <!-- linux -->
1473    <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1474    <!--remote gli-->
1475    <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1476      resolveExecutable="true"/>
1477    <!-- windows -->
1478    <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1479    <!--remote gli-->
1480    <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1481      resolveExecutable="true"/>
1482    <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1483  </target>
1484 
1485  <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1486    <!-- gs2build -->
1487    <!--linux: make, make install -->
1488    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1489    </exec>
1490    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1491      <arg value="install"/>
1492    </exec>
1493    <!-- run the setup script -->
1494    <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1495     <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
1496    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1497      <arg value="/f"/>
1498      <arg value="win32.mak"/>
1499    </exec>
1500    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1501      <arg value="/f"/>
1502      <arg value="win32.mak"/>
1503      <arg value="install"/>
1504    </exec>
1505    <!-- LuceneWrapper jar file not installed by default -->
1506    <mkdir dir="${gs2build.home}/bin/java"/>
1507    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1508    <antcall target="install-gs2build-indexers-windows"/>
1509    <antcall target="install-macos-extra"/>
1510  </target>
1511 
1512  <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1513    <copy todir="${gs2build.home}/bin/windows">
1514      <fileset dir="${gs2build.home}/common-src/indexers/bin">
1515        <include name="*.*"/>
1516      </fileset>
1517    </copy>
1518  </target>
1519
1520  <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1521    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1522      <env key="gsdl3path" path="${basedir}"/>
1523      <env key="gsdlpath" path="${basedir}/gs2build"/>
1524    </exec>
1525    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1526      <env key="gsdl3path" path="${basedir}"/>
1527      <env key="gsdlpath" path="${basedir}/gs2build"/>
1528      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1529    </exec>
1530    <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1531      <env key="GSDL3PATH" path="${basedir}"/>
1532      <env key="GSDLPATH" path="${basedir}/gs2build"/>
1533    </exec>
1534    <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli4gs3.sh/bat from the greenstone3/gli directory.
1535    </echo>
1536  </target>
1537 
1538
1539  <!-- ======================== TESTING Targets ========================= -->
1540 
1541  <target name="test" description="Run the (incomplete) JUnit test suite "
1542    depends="init">
1543    <mkdir dir="${basedir}/test"/>
1544    <junit printsummary="withOutAndErr"
1545      errorproperty="test.failed"
1546      failureproperty="test.failed"
1547      fork="${junit.fork}">
1548      <formatter type="plain"/>
1549      <classpath>
1550        <pathelement location="${build.home}/gsdl3test.jar"/>
1551        <path refid="compile.classpath"/>
1552      </classpath>
1553      <test name="${testcase}" if="testcase"/>
1554      <batchtest todir="${basedir}/test" unless="testcase">
1555        <fileset dir="${build.home}" ncludes="**/*Test.class" />
1556      </batchtest>
1557    </junit>
1558    <echo>
1559      *********************************************
1560      Test output can be found in directory 'test'
1561      *********************************************
1562    </echo>
1563  </target>
1564
1565  <!-- ======================== FLAX Targets ========================= -->
1566  <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1567    <echo>checking out flax ...</echo>
1568    <mkdir dir="${basedir}/src/java/org/flax"/>
1569    <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1570    <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1571    <mkdir dir="${web.home}/interfaces/flax"/>
1572    <mkdir dir="${web.home}/sites/flax"/>
1573    <mkdir dir="${basedir}/flax-resources"/>
1574    <mkdir dir="${basedir}/flax-lib"/>
1575    <svn>
1576      <checkout url="${flax.checkout.path}/src/java/org/flax/" 
1577        destPath="${basedir}/src/java/org/flax"/>
1578      <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1579        destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1580      <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1581        destPath="${web.home}/WEB-INF/classes/flax"/>
1582      <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1583        destPath="${web.home}/interfaces/flax"/>
1584      <checkout url="${flax.checkout.path}/web/sites/flax/"
1585        destPath="${web.home}/sites/flax"/>
1586      <checkout url="${flax.checkout.path}/flax-resources"
1587        destPath="${basedir}/flax-resources"/>
1588      <checkout url="${flax.checkout.path}/lib"
1589        destPath="${basedir}/flax-lib"/>
1590    </svn>
1591    <echo>prepare flax files...</echo>
1592    <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1593    <antcall target="flax-copy-files" />
1594    <antcall target="unzip-flax-collections" />
1595    <antcall target="unzip-flax-resources" />
1596  </target>
1597
1598  <target name="update-flax" description="update flax from repository">
1599    <echo>updating flax ...</echo>
1600    <svn>
1601      <update dir="${basedir}/src/java/org/flax"/>
1602      <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1603      <update dir="${web.home}/WEB-INF/classes/flax"/>
1604      <update dir="${web.home}/interfaces/flax"/>
1605      <update dir="${web.home}/sites/flax"/>
1606    </svn>
1607    <antcall target="flax-copy-files" />
1608    <antcall target="unzip-flax-collections" />       
1609  </target>
1610
1611  <target name="unzip-flax-collections" >
1612    <property name="coll.dir" value="${web.home}/sites/flax/collect"/>
1613    <unzip dest="${coll.dir}"> 
1614      <fileset dir="${coll.dir}">
1615        <include name="*.zip"/>
1616      </fileset>   
1617    </unzip>   
1618    <delete>
1619      <fileset dir="${coll.dir}" includes="*.zip"/>
1620    </delete>
1621  </target>
1622
1623  <target name="unzip-flax-resources" >
1624    <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1625    <unzip dest="${classes.dir}"> 
1626      <fileset dir="${classes.dir}">
1627        <include name="*.zip"/>
1628      </fileset>   
1629    </unzip>   
1630    <delete>
1631      <fileset dir="${classes.dir}" includes="*.zip"/>
1632    </delete>
1633  </target>
1634 
1635  <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1636    <echo>copying flax files ...</echo>
1637    <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1638    <!-- A configuration file containing web service binding information for the axis engine -->
1639    <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1640    <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1641    <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />   
1642  </target>
1643
1644
1645  <!-- ======================== GDBM Targets ========================= -->
1646
1647  <target name="prepare-gdbm" depends="init" if="install.gdbm">
1648
1649    <if>
1650      <bool>
1651        <not><available file="${src.packages.home}/${gdbm.version}/.flagfile"/></not>
1652      </bool>
1653
1654      <get src="http://www.greenstone.org/gs3files/${gdbm.version}.tar.gz"
1655        dest="${src.packages.home}/${gdbm.version}.tar.gz" usetimestamp="true"/>
1656      <untar compression= "gzip" src="${src.packages.home}/${gdbm.version}.tar.gz" dest="${src.packages.home}" />
1657      <echo file="${src.packages.home}/${gdbm.version}/.flagfile">
1658        the timestamp of this file is the time that gdbm was extracted from the tar files.
1659        it is used to figure out whether the files need to be refreshed or not in `ant prepare-gdbm`
1660      </echo>
1661      <chmod dir="${src.packages.home}/${gdbm.version}" perm="ugo+wrx" includes="**" />
1662      <antcall target="configure-gdbm" />
1663      <antcall target="compile-gdbm" />
1664
1665     <else>
1666       <echo>GDBM has been prepared, will not prepare</echo>
1667       <echo>Delete ${src.packages.home}/${gdbm.version}/.flagfile to force a fresh prepare</echo>
1668     </else>
1669
1670    </if>
1671
1672  </target> 
1673
1674  <target name="configure-gdbm" if="install.gdbm">
1675    <echo>
1676      Configuring GDBM
1677    </echo>
1678    <exec executable="${gdbm.home}/configure" os="${os.mac},${os.unix}"
1679      dir="${gdbm.home}">
1680      <arg value="--prefix=${gdbm.home}"/>
1681    </exec>   
1682  </target>
1683
1684  <target name="clean-gdbm" depends="init"  if="install.gdbm">   
1685    <echo>clean GDBM</echo>
1686    <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1687      <arg value="clean"/>
1688    </exec>
1689  </target>
1690
1691
1692  <target name="distclean-gdbm" depends="init"  if="install.gdbm">   
1693    <echo>distclean GDBM</echo>
1694    <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1695      <arg value="distclean"/>
1696    </exec>
1697  </target>
1698
1699  <target name="compile-gdbm" depends="init"  if="install.gdbm">   
1700    <echo>compile GDBM</echo>
1701    <exec executable="groups" os="${os.unix}" outputproperty="usergroups"/>
1702    <exec executable="awk" os="${os.unix}" inputstring="${usergroups}" outputproperty="firstgroup">
1703      <arg line="'{print $1}'"/>
1704    </exec>
1705
1706    <exec executable="make" os="${os.unix}" dir="${gdbm.home}"/>
1707    <exec executable="make" os="${os.unix}" dir="${gdbm.home}">
1708      <arg value="BINOWN=${env.USER}"/>
1709      <arg value="BINGRP=${firstgroup}"/>
1710      <arg value="install"/>
1711    </exec>
1712  </target>
1713
1714</project>
Note: See TracBrowser for help on using the browser.