root/greenstone3/trunk/build.xml @ 18110

Revision 18110, 72.6 KB (checked in by cc108, 11 years ago)

adding new compile classpath to lib\java folder

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