root/greenstone3/trunk/build.xml @ 15078

Revision 15078, 66.7 KB (checked in by shaoqun, 12 years ago)

add a unzip-flax-collections target and use it in flax-update

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