root/greenstone3/trunk/build.xml @ 15799

Revision 15799, 78.5 KB (checked in by ak19, 11 years ago)

Corrected build.xml overwrite on commit between r15190 and r15229 by adding in all the changes

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