root/greenstone3/trunk/build.xml @ 14809

Revision 14809, 63.3 KB (checked in by dmn, 12 years ago)

Further build message improvments

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