root/greenstone3/trunk/build.xml @ 15124

Revision 15124, 69.9 KB (checked in by shaoqun, 12 years ago)

add codes for flax and remove all annoying Ms

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