root/greenstone3/trunk/build.xml @ 19871

Revision 19871, 72.6 KB (checked in by kjdon, 11 years ago)

more tidying up and generally hackign at the build file. not tested at all, but I want to do a fresh checkout with the file

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