root/main/branches/64_bit_Greenstone/greenstone3/build.xml @ 24007

Revision 24007, 89.1 KB (checked in by sjm84, 8 years ago)

Updating this branch to match the latest Greenstone3 changes

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