root/greenstone3/trunk/build.xml @ 15136

Revision 15136, 70.9 KB (checked in by oranfry, 12 years ago)

made the configure-java-version execute quicker, and made it run every time tomcat starts - this way the user will never have to rename the xalan.jar(.tmp) files or remember to run configure-java-version explicitly - would be nice to hide the ugly output it creates though

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