root/greenstone3/trunk/build.xml @ 19961

Revision 19961, 70.3 KB (checked in by oranfry, 10 years ago)

do delete source files as we will make a separate source release

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