root/greenstone3/trunk/build.xml @ 14404

Revision 14404, 60.6 KB (checked in by xiao, 12 years ago)

add a target to check out source code from the flax repository.

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