root/greenstone3/trunk/build.xml @ 15334

Revision 15334, 74.3 KB (checked in by oranfry, 12 years ago)

only print out gsdl2.installed.path if it is set

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