root/greenstone3/trunk/build.xml @ 18343

Revision 18324, 74.2 KB (checked in by ak19, 11 years ago)

Reinstated svn export url code for grabbing gliserver.pl and gsdlCGI.pm files from greenstone 2 to put into greenstone 3's cgi-bin folder. This code had gone missing since revision 16602, but is still required for getting the Remote Greenstone 3 server running

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