root/greenstone3/trunk/build.xml @ 20215

Revision 20215, 73.8 KB (checked in by oranfry, 11 years ago)

delete build.properties.in from binary release

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