root/greenstone3/trunk/build.xml @ 15029

Revision 15029, 63.0 KB (checked in by kjdon, 12 years ago)

need to add os attribute to the windows executable commands in clean-gs2build command so they don't get executed on linux

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