root/greenstone3/trunk/build.xml @ 18495

Revision 18495, 74.2 KB (checked in by oranfry, 11 years ago)

undoing a change to build.xml which broke svnupdate-gs2build

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