root/greenstone3/trunk/build.xml @ 17917

Revision 17917, 72.4 KB (checked in by ak19, 11 years ago)
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,Windows Vista"/> <!-- 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.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}" 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}" 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/${index.zip}"/>
569    </fileset>
570    <available file="${gberg.dir}/index/${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    <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1052
1053    <jar destfile="${build.home}/phind.jar">
1054      <fileset dir="${build.home}">
1055        <include name="org/greenstone/applet/phind/**"/>
1056      </fileset>
1057      <manifest>
1058        <attribute name="Built-By" value="${user.name}" />
1059      </manifest>
1060    </jar>
1061    <mkdir dir="${web.applet}"/>
1062    <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1063    <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1064    <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
1065    <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
1066    <!-- skip anttasks for now
1067    <jar destfile="${build.home}/anttasks.jar">
1068      <fileset dir="${build.home}">
1069        <include name="org/greenstone/anttasks/**"/>
1070      </fileset>
1071      <manifest>
1072        <attribute name="Built-By" value="${user.name}" />
1073      </manifest>
1074    </jar>
1075    <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1076    <jar destfile="${build.home}/gsdl3test.jar">
1077      <fileset dir="${build.home}">
1078        <include name="org/greenstone/gsdl3/**/*Test.class"/>
1079        <include name="org/greenstone/testing/**"/>
1080      </fileset>
1081      <manifest>
1082        <attribute name="Built-By" value="${user.name}" />
1083      </manifest>
1084    </jar>
1085    <jar destfile="${build.home}/server.jar">
1086      <fileset dir="${build.home}">
1087        <include name="org/greenstone/server/**"/>
1088      </fileset>
1089      <fileset file="${basedir}/resources/java/server.properties"/>
1090      <manifest>
1091        <attribute name="Built-By" value="${user.name}"/>
1092      </manifest>
1093    </jar>
1094    <copy file="${build.home}/server.jar" todir="${basedir}"/>
1095  </target>
1096 
1097  <!-- ================== Packages targets ================================ -->
1098  <!-- these targets refer to the greenstone source packages - these need
1099  updating less often, so are in  separate targets to the core -->
1100  <target name="prepare-packages" depends="init,prepare-indexers"/>
1101 
1102  <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nosvn.mode">
1103    <svn>
1104      <checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers" revision="${branch.revision}"/>
1105    </svn>
1106  </target>
1107 
1108  <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
1109    <antcall target="checkout-indexers"/>
1110  </target>
1111
1112  <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1113    description="Update only the source packages"/>
1114
1115  <target name="svnupdate-packages" unless="nosvn.mode">
1116    <svn>
1117      <update dir="${src.packages.home}" revision="${branch.revision}"/>
1118    </svn>
1119  </target>
1120 
1121  <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
1122    description="Configure only the packages."/>
1123 
1124  <target name="configure-javagdbm">
1125    <echo>
1126      Configuring JavaGDBM
1127    </echo>
1128    <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
1129      dir="${javagdbm.home}">
1130      <arg value="--prefix=${basedir}"/>
1131      <arg value="--libdir=${lib.jni}"/>
1132    </exec>   
1133    <exec executable="${javagdbm.home}/configure" os="${os.mac}"
1134      dir="${javagdbm.home}">
1135      <arg value="--prefix=${basedir}"/>
1136      <arg value="--libdir=${lib.jni}"/>
1137      <arg value="--with-gdbm=${gdbm.installed.path}"/>
1138    </exec>   
1139  </target>
1140
1141  <!-- Message from oran. I removed the condition from this line becuase it meant
1142  the indexers would only be configured if collection building was DISabled.
1143  Shouldn't they be configured when collection building is ENabled? -->
1144
1145  <!-- <target name="configure-indexers" depends="init" if="independent-indexers"> -->
1146  <target name="configure-indexers" depends="init">
1147    <echo>Configuring Indexers</echo>
1148    <exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
1149      <arg value="--prefix=${basedir}"/>
1150      <arg value="--libdir=${lib.jni}"/>
1151    </exec>         
1152  </target>
1153
1154  <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
1155
1156  <target name="clean-javagdbm" depends="init">
1157    <exec executable="make" os="${os.unix}"
1158      dir="${javagdbm.home}">
1159      <arg value="clean"/>
1160    </exec>
1161  </target>
1162 
1163  <target name="clean-indexers" depends="init" if="independent-indexers">
1164    <exec executable="make" os="${os.unix}"
1165      dir="${indexers.home}">
1166      <arg value="clean"/>
1167    </exec>
1168    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1169      dir="${indexers.home}">
1170      <arg value="clean"/>
1171    </exec>
1172  </target>
1173
1174  <target name="distclean-packages" depends="init,distclean-javagdbm,distclean-indexers" description="Distclean only the packages"/>
1175
1176  <target name="distclean-javagdbm" depends="init">
1177    <exec executable="make" os="${os.unix}"
1178      dir="${javagdbm.home}">
1179      <arg value="distclean"/>
1180    </exec>
1181  </target>
1182 
1183  <target name="distclean-indexers" depends="init" if="independent-indexers">
1184    <exec executable="make" os="${os.unix}"
1185      dir="${indexers.home}">
1186      <arg value="distclean"/>
1187    </exec>
1188    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
1189      dir="${indexers.home}">
1190      <arg value="clean"/>
1191    </exec>
1192  </target>
1193 
1194  <target name="compile-packages" description="Compile only the source packages">
1195   
1196    <!-- javagdbm -->
1197    <echo>compile javagdbm</echo>
1198    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
1199    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
1200      <arg value="install"/>
1201    </exec>
1202
1203    <!-- windows: just the java stuff. -->
1204    <echo>Windows: compile javagdbm (java only)</echo>
1205    <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
1206      <arg value="compile"/>
1207      <arg value="javaonly"/>
1208    </exec>
1209
1210    <!-- install the jar file -->
1211    <echo>Install the javagdbm jar file</echo>
1212    <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1213
1214
1215    <!-- Search4j -->
1216    <antcall target="compile-search4j"/>
1217
1218    <!-- Indexers -->
1219
1220    <!-- this may be in gs2build - we will be recompiling, but never mind -->
1221    <echo>Indexers: make (from ${indexers.home})</echo>
1222    <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
1223    <echo>Indexers: make install</echo>
1224    <exec executable="make" os="${os.unix}" dir="${indexers.home}">
1225      <arg value="install"/>
1226    </exec>
1227
1228    <echo>Indexers: make</echo>
1229    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1230      <arg value="all"/>
1231    </exec>
1232    <echo>Indexers: make install</echo>
1233    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1234      <arg value="install"/>
1235    </exec>
1236
1237    <!-- install the jar and jni files -->
1238    <echo>Install the indexers' jar and jni files</echo>
1239    <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1240    <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1241    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1242    <antcall target="install-jni-files"/>
1243  </target>
1244
1245  <target name="compile-search4j">
1246
1247    <!-- windows -->
1248    <exec executable="${src.packages.home}/search4j/compile.bat" os="${os.windows}" dir="${src.packages.home}/search4j"/>
1249
1250    <!-- unix -->
1251    <exec executable="${src.packages.home}/search4j/configure" os="${os.unix}" dir="${src.packages.home}/search4j"><arg line="--bindir=${basedir}/bin"/></exec>
1252    <exec executable="make" os="${os.unix}" dir="${src.packages.home}/search4j"/>
1253
1254    <!-- install -->
1255    <copy todir="bin"><fileset dir="${src.packages.home}/search4j" includes="search4j,search4j.exe"/></copy>
1256    <if><bool><istrue value="${current.os.isunix}"/></bool>
1257      <chmod perm="+x" file="bin/search4j"/>
1258    </if>
1259
1260  </target>
1261
1262  <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1263
1264  <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1265    <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1266    <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1267    <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1268    <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1269    <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1270    <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1271  </target>
1272  <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1273    <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1274    <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1275    <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1276    <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1277    <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1278    <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1279  </target>
1280  <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1281    <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1282    <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1283    <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1284    <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1285    <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1286    <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1287  </target>
1288 
1289  <!-- ================== gs2building targets ===============-->
1290
1291
1292  <target name="update-gs2building" if="collection.building.enabled"
1293    depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1294    description="Update only the Greenstone 2 building components"/>
1295
1296  <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode">
1297  </target>
1298
1299  <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1300    <!-- please keep this function in sync with checkout-gs2build -->
1301
1302    <echo>updating gs2build</echo>
1303    <!-- svn updates -->
1304    <svn>
1305      <!-- perllib -->
1306      <update dir="gs2build" revision="${branch.revision}"/>
1307    </svn>
1308  </target>
1309 
1310  <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1311    <svn>
1312      <update dir="${gli.home}" revision="${branch.revision}"/>
1313    </svn>
1314  </target>
1315
1316  <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1317  </target>
1318  <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1319    <!-- please keep this function in sync with update-gs2build -->
1320    <echo>checking out gs2build</echo>
1321
1322    <!-- this has to be created first to avoid errors when trying to export to it later -->
1323    <mkdir dir="${basedir}/gs2build/src/lib"/>
1324
1325    <!-- svn checkouts -->
1326    <svn>
1327      <!-- perllib -->
1328      <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1329
1330    </svn>
1331  </target>
1332
1333  <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1334    <antcall target="checkout-gs2build"/>
1335    <antcall target="unzip-windows-packages"/>
1336    <antcall target="checkout-winbin"/>
1337    <antcall target="get-windows-binaries"/>
1338    <antcall target="delete-winbin"/>
1339    <antcall target="get-macos-extra"/>
1340  </target>
1341
1342  <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1343    unless="nosvn.mode">
1344    <svn>
1345      <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1346    </svn>
1347  </target>
1348
1349  <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1350    <svn>
1351      <update dir="winbin" revision="${branch.revision}"/>
1352    </svn>
1353  </target>
1354 
1355  <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1356    <move todir="${gs2build.home}/bin/windows" failonerror="false">
1357      <fileset dir="${basedir}/winbin/bin"/>
1358    </move>
1359  </target>
1360  <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1361    <delete dir="${basedir}/winbin"/>
1362  </target>
1363 
1364  <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows"> 
1365    <unzip src="${gs2build.home}/common-src/packages/windows/gdbm/gdbm.zip"
1366      dest="${gs2build.home}/common-src/packages/windows/gdbm"/>
1367    <unzip src="${gs2build.home}/common-src/packages/windows/crypt/crypt.zip"
1368      dest="${gs2build.home}/common-src/packages/windows/crypt"/>
1369    <unzip src="${gs2build.home}/common-src/packages/windows/expat/expat.zip"
1370      dest="${gs2build.home}/common-src/packages/windows/expat"/>
1371    <unzip src="${gs2build.home}/common-src/indexers/packages/windows/iconv/iconv.zip"
1372      dest="${gs2build.home}/common-src/indexers/packages/windows/iconv"/>
1373  </target>
1374 
1375  <!-- downloads a good XML-Parser -->
1376  <target name="get-macos-extra" depends="init" if="need.macos.extra">
1377    <!--
1378    <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1379      dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1380      usetimestamp="true"/>
1381      -->
1382    <echo>Nothing extra currently needed for MacOs prepare</echo>
1383  </target>
1384
1385  <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1386  <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
1387    <!-- make sure these directories are present, otherwise chmod craps out
1388    this chmod is needed in case we are unpacking for a second time -->
1389    <!--
1390    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1391    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1392    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1393    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1394    <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1395      dest="${gs2build.home}/perllib/cpan/"
1396      compression="gzip"/>
1397    -->
1398    <echo>Nothing extra currently needed for MacOs install</echo>
1399  </target>
1400
1401  <target name="install-indexer-files" depends="init" unless="indexers.present">
1402    <copy todir="${indexers.home}">
1403      <fileset dir="${gs2build.home}/common-src/indexers" />
1404    </copy>
1405    <chmod file="${indexers.home}/configure" perm="a+x"/>
1406  </target>
1407
1408  <target name="rename-gs2build-files" depends="gs2build-edit-setup-bat" if="collection.building.enabled"/>
1409 
1410  <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1411    <!-- we want a windows path in the setup.bat file -->
1412    <pathconvert targetos="windows" property="gs2build.home.windows">
1413      <path path="${gs2build.home}"/>
1414    </pathconvert>
1415    <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1416      <filterset>
1417        <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1418      </filterset>
1419    </move> 
1420    <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1421  </target>
1422 
1423  <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1424    <antcall target="checkout-gli"/>
1425  </target>
1426 
1427  <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1428    <echo>checking out gli</echo>
1429    <svn>
1430      <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1431    </svn>
1432  </target>
1433 
1434  <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1435    description="Configure only the Greenstone 2 building components">
1436    <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1437      dir="${gs2build.home}">
1438      <arg value="--prefix=${gs2build.home}"/>
1439    </exec>
1440    <exec executable="${gs2build.home}/configure" os="${os.mac}"
1441      dir="${gs2build.home}">
1442      <arg value="--prefix=${gs2build.home}"/>
1443      <arg value="--with-gdbm=${gdbm.installed.path}"/>
1444    </exec>
1445  </target>
1446
1447  <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1448    description="Clean only the Greenstone 2 building components"
1449    if="collection.building.enabled"/>
1450 
1451  <target name="clean-gli" depends="init" if="collection.building.enabled">
1452    <!-- gli -->
1453    <property name="gli.home" value="${basedir}/gli"/>
1454    <!-- linux -->
1455    <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1456      resolveExecutable="true"/>
1457    <!-- windows -->
1458    <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1459      resolveExecutable="true"/>
1460  </target>
1461 
1462  <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1463    <!-- gs2build -->
1464    <!--linux:  -->
1465    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1466      <arg value="clean"/>
1467    </exec>
1468    <!-- windows: -->   
1469    <!-- run the setup script -->
1470    <!--<exec executable="${compile.windows.c++.setup}" os="${os.windows}" />-->
1471    <!--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-->
1472    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}" >
1473      <arg value="/f"/>
1474      <arg value="win32.mak"/>
1475      <arg value="clean"/>
1476    </exec>
1477  </target>
1478 
1479  <target name="distclean-gs2building" depends="init,clean-gli,clean-gs2build,distclean-gs2build"
1480    description="Distclean only the Greenstone 2 building components"
1481    if="collection.building.enabled"/>
1482
1483  <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1484    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1485      <arg value="distclean"/>
1486    </exec>
1487  </target>
1488 
1489  <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1490    description="Compile only the Greenstone 2 building components">
1491  </target>
1492 
1493  <target name="compile-gli" depends="init" if="collection.building.enabled">
1494    <!-- gli -->
1495    <property name="gli.home" value="${basedir}/gli"/>
1496
1497    <!-- linux -->
1498    <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1499    <!--remote gli-->
1500    <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1501      resolveExecutable="true"/>
1502    <!-- windows -->
1503    <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1504    <!--remote gli-->
1505    <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1506      resolveExecutable="true"/>
1507    <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1508  </target>
1509 
1510  <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1511    <!-- gs2build -->
1512    <!--linux: make, make install -->
1513    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1514    </exec>
1515    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1516      <arg value="install"/>
1517    </exec>
1518    <!-- run the setup script -->
1519    <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1520     <!--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-->
1521    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1522      <arg value="/f"/>
1523      <arg value="win32.mak"/>
1524    </exec>
1525    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1526      <arg value="/f"/>
1527      <arg value="win32.mak"/>
1528      <arg value="install"/>
1529    </exec>
1530    <!-- LuceneWrapper jar file not installed by default -->
1531    <mkdir dir="${gs2build.home}/bin/java"/>
1532    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1533    <antcall target="install-gs2build-indexers-windows"/>
1534    <antcall target="install-macos-extra"/>
1535  </target>
1536 
1537  <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1538    <copy todir="${gs2build.home}/bin/windows">
1539      <fileset dir="${gs2build.home}/common-src/indexers/bin">
1540        <include name="*.*"/>
1541      </fileset>
1542    </copy>
1543  </target>
1544
1545  <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1546    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1547      <env key="gsdl3path" path="${basedir}"/>
1548      <env key="gsdlpath" path="${basedir}/gs2build"/>
1549    </exec>
1550    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1551      <env key="gsdl3path" path="${basedir}"/>
1552      <env key="gsdlpath" path="${basedir}/gs2build"/>
1553      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1554    </exec>
1555    <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1556      <env key="GSDL3PATH" path="${basedir}"/>
1557      <env key="GSDLPATH" path="${basedir}/gs2build"/>
1558    </exec>
1559    <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.
1560    </echo>
1561  </target>
1562 
1563
1564  <!-- ======================== TESTING Targets ========================= -->
1565 
1566  <target name="test" description="Run the (incomplete) JUnit test suite "
1567    depends="init">
1568    <mkdir dir="${basedir}/test"/>
1569    <junit printsummary="withOutAndErr"
1570      errorproperty="test.failed"
1571      failureproperty="test.failed"
1572      fork="${junit.fork}">
1573      <formatter type="plain"/>
1574      <classpath>
1575        <pathelement location="${build.home}/gsdl3test.jar"/>
1576        <path refid="compile.classpath"/>
1577      </classpath>
1578      <test name="${testcase}" if="testcase"/>
1579      <batchtest todir="${basedir}/test" unless="testcase">
1580        <fileset dir="${build.home}" ncludes="**/*Test.class" />
1581      </batchtest>
1582    </junit>
1583    <echo>
1584      *********************************************
1585      Test output can be found in directory 'test'
1586      *********************************************
1587    </echo>
1588  </target>
1589
1590  <!-- ======================== FLAX Targets ========================= -->
1591  <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1592    <echo>checking out flax ...</echo>
1593    <mkdir dir="${basedir}/src/java/org/flax"/>
1594    <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1595    <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1596    <mkdir dir="${web.home}/interfaces/flax"/>
1597    <mkdir dir="${web.home}/sites/flax"/>
1598    <mkdir dir="${basedir}/flax-resources"/>
1599    <mkdir dir="${basedir}/flax-lib"/>
1600    <svn>
1601      <checkout url="${flax.checkout.path}/src/java/org/flax/" 
1602        destPath="${basedir}/src/java/org/flax"/>
1603      <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1604        destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1605      <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1606        destPath="${web.home}/WEB-INF/classes/flax"/>
1607      <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1608        destPath="${web.home}/interfaces/flax"/>
1609      <checkout url="${flax.checkout.path}/web/sites/flax/"
1610        destPath="${web.home}/sites/flax"/>
1611      <checkout url="${flax.checkout.path}/flax-resources"
1612        destPath="${basedir}/flax-resources"/>
1613      <checkout url="${flax.checkout.path}/lib"
1614        destPath="${basedir}/flax-lib"/>
1615    </svn>
1616    <echo>prepare flax files...</echo>
1617    <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1618    <antcall target="flax-copy-files" />
1619    <antcall target="unzip-flax-collections" />
1620    <antcall target="unzip-flax-resources" />
1621  </target>
1622
1623  <target name="update-flax" description="update flax from repository">
1624    <echo>updating flax ...</echo>
1625    <svn>
1626      <update dir="${basedir}/src/java/org/flax"/>
1627      <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1628      <update dir="${web.home}/WEB-INF/classes/flax"/>
1629      <update dir="${web.home}/interfaces/flax"/>
1630      <update dir="${web.home}/sites/flax"/>
1631    </svn>
1632    <antcall target="flax-copy-files" />
1633    <antcall target="unzip-flax-collections" />       
1634  </target>
1635
1636  <target name="unzip-flax-collections" >
1637    <property name="coll.dir" value="${web.home}/sites/flax/collect"/>
1638    <unzip dest="${coll.dir}"> 
1639      <fileset dir="${coll.dir}">
1640        <include name="*.zip"/>
1641      </fileset>   
1642    </unzip>   
1643    <delete>
1644      <fileset dir="${coll.dir}" includes="*.zip"/>
1645    </delete>
1646  </target>
1647
1648  <target name="unzip-flax-resources" >
1649    <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1650    <unzip dest="${classes.dir}"> 
1651      <fileset dir="${classes.dir}">
1652        <include name="*.zip"/>
1653      </fileset>   
1654    </unzip>   
1655    <delete>
1656      <fileset dir="${classes.dir}" includes="*.zip"/>
1657    </delete>
1658  </target>
1659 
1660  <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1661    <echo>copying flax files ...</echo>
1662    <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1663    <!-- A configuration file containing web service binding information for the axis engine -->
1664    <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1665    <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1666    <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />   
1667  </target>
1668
1669
1670  <!-- ======================== GDBM Targets ========================= -->
1671
1672  <target name="prepare-gdbm" depends="init" if="install.gdbm">
1673
1674    <if>
1675      <bool>
1676        <not><available file="${src.packages.home}/${gdbm.version}/.flagfile"/></not>
1677      </bool>
1678
1679      <get src="http://www.greenstone.org/gs3files/${gdbm.version}.tar.gz"
1680        dest="${src.packages.home}/${gdbm.version}.tar.gz" usetimestamp="true"/>
1681      <untar compression= "gzip" src="${src.packages.home}/${gdbm.version}.tar.gz" dest="${src.packages.home}" />
1682      <echo file="${src.packages.home}/${gdbm.version}/.flagfile">
1683        the timestamp of this file is the time that gdbm was extracted from the tar files.
1684        it is used to figure out whether the files need to be refreshed or not in `ant prepare-gdbm`
1685      </echo>
1686      <chmod dir="${src.packages.home}/${gdbm.version}" perm="ugo+wrx" includes="**" />
1687      <antcall target="configure-gdbm" />
1688      <antcall target="compile-gdbm" />
1689
1690     <else>
1691       <echo>GDBM has been prepared, will not prepare</echo>
1692       <echo>Delete ${src.packages.home}/${gdbm.version}/.flagfile to force a fresh prepare</echo>
1693     </else>
1694
1695    </if>
1696
1697  </target> 
1698
1699  <target name="configure-gdbm" if="install.gdbm">
1700    <echo>
1701      Configuring GDBM
1702    </echo>
1703    <exec executable="${gdbm.home}/configure" os="${os.mac},${os.unix}"
1704      dir="${gdbm.home}">
1705      <arg value="--prefix=${gdbm.home}"/>
1706    </exec>   
1707  </target>
1708
1709  <target name="clean-gdbm" depends="init"  if="install.gdbm">   
1710    <echo>clean GDBM</echo>
1711    <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1712      <arg value="clean"/>
1713    </exec>
1714  </target>
1715
1716
1717  <target name="distclean-gdbm" depends="init"  if="install.gdbm">   
1718    <echo>distclean GDBM</echo>
1719    <exec executable="make" os="${os.unix}" dir="${gdbm.home}" >
1720      <arg value="distclean"/>
1721    </exec>
1722  </target>
1723
1724  <target name="compile-gdbm" depends="init"  if="install.gdbm">   
1725    <echo>compile GDBM</echo>
1726    <exec executable="groups" os="${os.unix}" outputproperty="usergroups"/>
1727    <exec executable="awk" os="${os.unix}" inputstring="${usergroups}" outputproperty="firstgroup">
1728      <arg line="'{print $1}'"/>
1729    </exec>
1730
1731    <exec executable="make" os="${os.unix}" dir="${gdbm.home}"/>
1732    <exec executable="make" os="${os.unix}" dir="${gdbm.home}">
1733      <arg value="BINOWN=${env.USER}"/>
1734      <arg value="BINGRP=${firstgroup}"/>
1735      <arg value="install"/>
1736    </exec>
1737  </target>
1738
1739</project>
Note: See TracBrowser for help on using the browser.