root/main/trunk/greenstone3/build.xml @ 23857

Revision 23857, 89.9 KB (checked in by ak19, 9 years ago)

1. Slight adjustment to previous commit: the test is no longer for the existence of gs2build's build-src, but the existence of gs2build itself. If gs2build does not exist, then perl.path will be set to the empty string. 2. Previous commit: 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

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