root/greenstone3/trunk/build.xml @ 19649

Revision 19649, 74.3 KB (checked in by xiao, 10 years ago)

Remove flax target unzip-flax-collections

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