root/greenstone3/trunk/build.xml @ 16602

Revision 16602, 69.7 KB (checked in by davidb, 12 years ago)

Simplification of syntax needed to get gs2build

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