Index: /greenstone3/trunk/build.xml
===================================================================
--- /greenstone3/trunk/build.xml	(revision 14732)
+++ /greenstone3/trunk/build.xml	(revision 14732)
@@ -0,0 +1,1445 @@
+<?xml version="1.0"?>
+
+<!-- ====================================================================== 
+     March 2005                                                    
+
+     Greenstone3 build and install script
+                   
+     kjdon                                                                
+     ====================================================================== -->
+<project name="greenstone3" default="usage" basedir=".">
+
+	<!-- ============ classpath =================== -->
+	<path id="project.classpath">
+	   <fileset dir="lib/java">
+	      <include name="**/*.jar"/>
+	   </fileset>
+	</path>
+
+	<!-- ============ self defined tasks =================== -->
+
+	<taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpath="${basedir}/lib/java/anttasks.jar"/>
+	<taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpath="${basedir}/lib/java/anttasks.jar"/>
+	<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
+	<taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpath="${basedir}/lib/java/anttasks.jar"/>
+
+
+<!-- ===================== Property Definitions =========================== -->
+
+<!--
+
+  Each of the following properties are used in the build script.
+  Values for these properties are set by the first place they are
+  defined, from the following list:
+
+  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
+
+  * Definitions from a "build.properties" file in the top level
+    source directory of this application.
+
+  * Definitions from a "build.properties" file in the user's
+    home directory.
+
+  * Default definitions in this build.xml file.
+
+  You will note below that property values can be composed based on the
+  contents of previously defined properties.  This is a powerful technique
+  that helps you minimize the number of changes required when your development
+  environment is modified.  Note that property composition is allowed within
+  "build.properties" files as well as in the "build.xml" script.
+
+-->
+
+  <property file="build.properties"/>
+  <property file="${user.home}/build.properties"/>
+
+  <!-- get properties from the environment -->
+  <property environment="env"/>
+  <property name="build.home" value="${basedir}/build"/>
+  <property name="src.home" value="${basedir}/src/java"/>
+  <property name="src.packages.home" value="${basedir}/src/packages"/>
+  <property name="packages.home" value="${basedir}/packages"/>
+  <!-- this may be set in build.properties, eg if you move the web dir to 
+  tomcats webapps directory -->
+  <property name="web.home" value="${basedir}/web"/>
+  <!-- jar files needed by applets go here -->
+  <property name="web.applet" value="${web.home}/applet"/>
+  <!-- jar files needed by the servlet (and extra ones) go here -->
+  <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
+  <!-- other files needed by the servlet go here -->
+  <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
+  <!-- jni libraries and java wrappers go here -->
+  <property name="lib.jni" value="${basedir}/lib/jni"/>
+    
+  <property name="javadocs" value="${basedir}/docs/javadoc"/>
+
+  <property name="app.name"      value="greenstone3"/>
+  <property name="app.path"      value="/${app.name}"/>
+
+
+  <!-- version number stuff -->
+
+  <!-- app.version defaults to trunk -->
+  <condition property="app.version" value="trunk">
+    <not><isset property="app.version"/></not>
+  </condition>
+
+	<!-- determine the 'branch path' -->
+  <condition property="branch.path" value="trunk">
+    <equals arg1="${app.version}" arg2="trunk" />
+  </condition>
+  <condition property="branch.path" value="branches/${app.version}">
+    <not><equals arg1="${app.version}" arg2="trunk" /></not>
+  </condition>
+
+
+  <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
+
+  <property name="svn.root" value="http://svn.greenstone.org"/>
+<!--  <property name="cvs.root" value=":pserver:cvs_anon@cvs.scms.waikato.ac.nz:2402/usr/local/global-cvs/gsdl-src"/> -->
+  <!-- catalina home is set to tomcat basedir is already installed, otherwise
+  use greenstone's tomcat -->
+  <condition property="catalina.home" value="${tomcat.installed.path}"> 
+    <and>
+      <isset property="tomcat.installed.path"/>
+      <not>
+	<equals arg1="" arg2="${tomcat.installed.path}"/>
+      </not>
+    </and>
+  </condition>
+  <property name="catalina.home" value="${packages.home}/tomcat"/>
+
+  <property name="os.linux" value="Linux"/> 
+  <property name="os.mac" value="Mac OS X"/>
+  <property name="os.solaris" value="SunOS"/>
+  <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
+  <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP,Windows NT,Windows ME"/> <!-- check this!!!-->
+
+  <!-- this is true for linux and macs -->
+  <condition property="current.os.isunix">
+    <os family="unix"/>
+  </condition>
+  
+  <condition property="current.os.isunixnotmac">
+    <and>
+      <os family="unix"/>
+      <not>
+	<os family="mac"/>
+      </not>
+    </and>
+  </condition>
+  <condition property="current.os.ismac">
+    <os family="mac"/>
+  </condition>
+  
+  <condition property="current.os.iswindows">
+    <os family="windows"/>
+  </condition>
+
+  <condition property="collection.building.enabled">
+    <not>
+      <isset property="disable.collection.building"/>
+    </not>
+  </condition>
+
+  <condition property="collection.building.enabled.windows">
+    <and>
+      <isset property="collection.building.enabled"/>
+      <isset property="current.os.iswindows"/>
+    </and>
+  </condition>
+  
+  <condition property="collection.building.enabled.unix">
+    <and>
+      <isset property="collection.building.enabled"/>
+      <isset property="current.os.isunix"/>
+    </and>
+  </condition>
+  
+  <condition property="independent-indexers">
+    <isset property="disable.collection.building"/>
+  </condition>
+    
+  <!-- ============= Base dirs for each package and component ============ -->
+  <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
+  <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
+  <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
+  <property name="gs2build.home" value="${basedir}/gs2build"/>
+  <property name="gli.home" value="${basedir}/gli"/>
+  <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
+
+  <!--<property name="indexers.home" value="${basedir}/src/packages/indexers">-->
+  <condition property="indexers.home" value="${basedir}/src/packages/indexers">
+    <isset property="disable.collection.building"/>
+  </condition>
+  <condition property="indexers.home" value="${gs2build.home}/indexers">
+    <not>
+      <isset property="disable.collection.building"/>
+    </not>
+  </condition>
+
+  <property name="mg.home" value="${indexers.home}/mg"/>
+  <property name="mgpp.home" value="${indexers.home}/mgpp"/>
+  <property name="lucene.home" value="${indexers.home}/lucene-gs"/>
+
+
+<!--  ==================== Compilation Control Options ==================== -->
+
+<!--
+
+  These properties control option settings on the Javac compiler when it
+  is invoked using the <javac> task.
+
+  compile.debug        Should compilation include the debug option?
+
+  compile.deprecation  Should compilation include the deprecation option?
+
+  compile.optimize     Should compilation include the optimize option?
+
+-->
+
+  <property name="compile.debug"       value="true"/>
+  <property name="compile.deprecation" value="true"/>
+  <property name="compile.optimize"    value="true"/>
+
+<!--
+
+  Rather than relying on the CLASSPATH environment variable, Ant includes
+  features that makes it easy to dynamically construct the classpath you
+  need for each compilation.  The example below constructs the compile
+  classpath to include the servlet.jar file, as well as the other components
+  that Tomcat makes available to web applications automatically, plus anything
+  that you explicitly added.
+
+-->
+
+  <path id="compile.classpath">
+    <!-- Include all jar files and libraries in our jni lib directory -->
+    <pathelement location="${lib.jni}"/>
+    <fileset dir="${lib.jni}">
+      <include name="*.jar"/>
+    </fileset>
+    <!-- Include all jar files in our web lib directory -->
+    <pathelement location="${web.lib}"/>
+    <fileset dir="${web.lib}">
+      <include name="*.jar"/>
+    </fileset>
+    
+    <!-- Include the axis jar files -->
+    <!--<fileset dir="${basedir}/comms/soap/axis/lib">
+      <include name="*.jar"/>
+    </fileset>-->
+    
+    <!-- include the jar files from the source packages -->
+    <!-- mg and mgpp get installed into lib/jni but they may not be there yet
+    so we add them in by name -->
+    <pathelement location="${lib.jni}/mg.jar"/>
+    <pathelement location="${lib.jni}/mgpp.jar"/>
+    
+    <!-- Include all elements that Tomcat exposes to applications -->
+    <pathelement location="${catalina.home}/common/classes"/>
+    <fileset dir="${catalina.home}/common/endorsed">
+      <include name="*.jar"/>
+    </fileset>
+    <fileset dir="${catalina.home}/common/lib">
+      <include name="*.jar"/>
+    </fileset>
+    <pathelement location="${catalina.home}/shared/classes"/>
+    <fileset dir="${catalina.home}/shared/lib">
+      <include name="*.jar"/>
+    </fileset>
+  </path>
+
+  <path id="local.tomcat.classpath">
+    <!-- explicitly include the jni java wrappers in the classpath -->
+    <pathelement location="${lib.jni}"/>
+    <fileset dir="${lib.jni}">
+      <include name="*.jar"/>
+    </fileset>
+  </path>
+  
+  <path id="local.tomcat.path">
+    <pathelement location="${basedir}/bin/script"/>
+    <pathelement location="${basedir}/bin"/>
+    <pathelement location="${lib.jni}"/>
+    <pathelement path="${env.PATH}"/>
+    <pathelement path="${env.Path}"/>
+  </path>
+
+  <target name="test-setup">
+    <echo>ant java version=${ant.java.version}</echo>
+    <echo>is unix : ${current.os.isunix}</echo>
+    <echo>is mac : ${current.os.ismac}</echo>
+    <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
+    <echo>is windows : ${current.os.iswindows}</echo>
+    <echo>os.unix: ${os.unix}</echo>
+  </target>
+<!-- ==================== Primary and Global Targets ============================= -->
+
+  <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
+
+  <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
+    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.">
+<!--  <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
+    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.">-->
+
+    <!-- make sure .sh files are executable -->
+    <chmod dir="${basedir}" perm="ugo+rx" 
+      includes="*.sh"/>
+    <chmod dir="${basedir}/bin/script" perm="ugo+rx" 
+      includes="*.sh,*.pl"/>
+  </target>
+  <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile" 
+    description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
+  
+<!--  <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
+    description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>-->
+  <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-gs2building,svnupdate-web"
+    description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
+
+
+  <target name="configure-c++" depends="init,configure-packages,configure-core,configure-gs2building"
+    description="Configure any C/C+/+ package code and gs2building code if necessary"/>
+  
+  <target name="configure" depends="init,configure-tomcat,configure-web"
+    description="Configure the installation. Includes setting up config files. Should be re-run if you change the build.properties file."/>
+
+  <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
+    description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
+  
+  <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
+    description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
+    
+  <target name="update" depends="init,svnupdate,clean,configure,configure-c++,compile" 
+    description="Update (thru Subversion) all the source (including core, packages and gs2building), then clean, configure and recompile."/>
+
+  <target name="start" depends="init,start-tomcat"
+    description="Startup the Tomcat server." />
+
+  <target name="stop" depends="init,stop-tomcat" 
+    description="Shutdown the Tomcat server."/>
+  
+  <target name="restart" description="Shutdown and restart Tomcat"  depends="init,stop,start"/>
+
+
+<!-- =========== Help targets ===================================  -->
+  
+  <property name="install-command" value="ant [options] prepare install"/>
+  
+  <target name="usage" description="Print a help message">
+    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
+    <echo message="  Execute 'ant -help' for Ant help."/>
+    <echo>To install Greenstone3, run '${install-command}'. 
+There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
+To log the output, use the '-logfile build.log' option.
+The README.txt file has more information about the ant targets and install process.
+    </echo>
+  </target>
+  
+  <target name="help" depends="usage" description="Print a help message"/>
+  
+  <target name="debug" depends="init" description="Display all the currently used properties">
+    <echoproperties/>
+  </target>
+
+<!-- ====== initialization and setup targets ================== -->
+
+  <target name="accept-properties" unless="properties.accepted">
+    <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
+tomcat.server=${tomcat.server}
+tomcat.port=${tomcat.port} 
+tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
+proxy.host=${proxy.host}
+proxy.port=${proxy.port}
+If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
+    </input>
+    <condition property="do.abort"> 
+      <equals arg1="n" arg2="${properties.ok}"/>
+    </condition>
+    <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
+  </target>
+
+<!--  <target name="check-cvsroot">
+    <condition property="svnroot.notset">
+      <or>
+			<not>
+			  <isset property="env.CVSROOT"/>
+			</not>
+			<equals arg1="" arg2="${env.CVSROOT}"/>
+      </or>
+    </condition>
+    <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
+  </target> -->
+
+  <!-- this sets up some initial properties -->
+  <target name="init">
+
+    <condition property="java.too.old">
+      <or>
+	<equals arg1="1.1" arg2="${ant.java.version}"/>
+	<equals arg1="1.2" arg2="${ant.java.version}"/>
+	<equals arg1="1.3" arg2="${ant.java.version}"/>
+      </or>
+    </condition>
+    <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
+    
+    <available file="${indexers.home}" property="indexers.present"/>
+    <available file="${basedir}/gli" property="gli.present"/>
+    <available file="${basedir}/gs2build" property="gs2build.present"/>
+
+    <condition property="tomcat.islocal">
+      <or>
+	<not>
+	  <isset property="tomcat.installed.path"/>
+	</not>
+	<equals arg1="" arg2="${tomcat.installed.path}"/>
+      </or>
+    </condition>
+    
+      <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
+    <condition property="proxy.present">
+      <and>
+	<isset property="proxy.host"/>
+	<not>
+	  <equals arg1="" arg2="${proxy.host}"/>
+	</not>
+      </and>
+    </condition>
+
+    <condition property="need.macos.extra">
+      <and>
+	<isset property="current.os.ismac"/>
+	<not>
+	  <isset property="disable.collection.building"/>
+	</not>
+      </and>
+    </condition>
+  </target>
+
+  <target name="setup-proxy" depends="init" if="proxy.present">
+    <condition property="ask.user">
+      <or>
+	<equals arg1="" arg2="${proxy.user}"/>
+	<equals arg1="" arg2="${proxy.password}"/>
+      </or>
+    </condition>
+    <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
+    <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
+  </target>
+     
+ <!-- ========== Web app Targets ================================ -->
+  
+  <target name="prepare-web" depends="init,configure-java-version">
+    <mkdir dir="${web.home}/applet"/>
+    <mkdir dir="${web.home}/logs"/>
+  </target>
+  
+  <!-- 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 -->
+  <target name="configure-java-version" depends="init"
+    description="Run this target if you have changed the default version of java since installing greenstone3">
+    <condition property="need.xalan.jar">
+      <equals arg1="1.5" arg2="${ant.java.version}"/>
+    </condition>
+    <antcall target="activate-xalan-jar"/>
+    <antcall target="deactivate-xalan-jar"/>
+  </target>
+  
+  <target name="activate-xalan-jar" if="need.xalan.jar">
+    <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
+  </target>
+  
+  <target name="deactivate-xalan-jar" unless="need.xalan.jar">
+    <delete file="${web.lib}/xalan.jar"/>
+  </target>
+
+  <target name="prepare-collections" depends="init">
+    <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
+    <!-- gs2mgdemo -->
+    <unzip src="${collect.dir}/gs2mgdemo/import.zip" 
+      dest="${collect.dir}/gs2mgdemo"/>
+    <unzip src="${collect.dir}/gs2mgdemo/metadata.zip" 
+      dest="${collect.dir}/gs2mgdemo"/>
+    <unzip src="${collect.dir}/gs2mgdemo/index/index.zip" 
+      dest="${collect.dir}/gs2mgdemo/index"/>
+    <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
+    <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
+    <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
+    <!-- gs2mgppdemo -->
+    <unzip src="${collect.dir}/gs2mgppdemo/import.zip" 
+      dest="${collect.dir}/gs2mgppdemo"/>
+    <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip" 
+      dest="${collect.dir}/gs2mgppdemo"/>
+    <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip" 
+      dest="${collect.dir}/gs2mgppdemo/index"/>
+    <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
+    <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
+    <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
+    <!-- gberg -->
+    <unzip src="${collect.dir}/gberg/index/index.zip" 
+      dest="${collect.dir}/gberg/index"/>
+    <delete file="${collect.dir}/gberg/index/index.zip"/>
+  </target>
+
+  
+  <target name="configure-web" depends="init"
+    description="Configure only the web app config files">
+    <!-- we want a unix path in the global.properties file -->
+    <pathconvert targetos="unix" property="src.gsdl3.home.unix">
+      <path path="${web.home}"/>
+    </pathconvert>
+    <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
+    <filter token="gsdl3version" value="${app.version}"/>
+    <filter token="tomcat.server" value="${tomcat.server}"/>
+    <filter token="tomcat.port" value="${tomcat.port}"/>
+    <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
+    <chmod file="${web.classes}/global.properties" perm="600"/>
+    <chmod file="${web.classes}/log4j.properties" perm="600"/>
+  </target>
+
+  <target name="compile-web" depends="init">
+    <javac srcdir="${web.classes}"
+      destdir="${web.classes}"
+      debug="${compile.debug}"
+      deprecation="${compile.deprecation}"
+      optimize="${compile.optimize}">
+      <classpath>
+	<path refid="compile.classpath"/>
+      </classpath>
+    </javac>
+  </target>
+
+	<target name="svnupdate-web" unless="nosvn.mode">
+		<svn>
+			<update dir="${web.home}"/>
+		</svn>
+	</target>
+
+  <target name="update-web" depends="init,svnupdate-web,configure-web"
+    description="update only the web stuff (config files)"/>
+
+
+<!-- ======================= Tomcat Targets ========================== -->
+  
+  <!-- this target downloads and installs Tomcat -->
+  <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
+  <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
+
+    <!-- check that packages dir is there -->
+    <mkdir dir="${packages.home}"/>
+    <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25.zip"
+      dest="${packages.home}/apache-tomcat-5.5.25.zip"
+      usetimestamp="true"/>
+    <unzip src="${packages.home}/apache-tomcat-5.5.25.zip" 
+      dest="${packages.home}"/>
+    <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25-compat.zip"
+      dest="${packages.home}/apache-tomcat-5.5.25-compat.zip"
+      usetimestamp="true"/>
+    <unzip src="${packages.home}/apache-tomcat-5.5.25-compat.zip" 
+      dest="${packages.home}"/>
+    <!-- delete any existing tomcat -->
+    <delete dir="${packages.home}/tomcat"/>
+    <move todir="${packages.home}/tomcat">
+      <fileset dir="${packages.home}/apache-tomcat-5.5.25"/>
+    </move>
+    <copy file="${basedir}/resources/tomcat/setclasspath.bat"
+      tofile="${packages.home}/tomcat/bin/setclasspath.bat"
+      overwrite="true"/>
+    <copy file="${basedir}/resources/tomcat/setclasspath.sh"
+      tofile="${packages.home}/tomcat/bin/setclasspath.sh"
+      overwrite="true"/>
+    <!-- make sure we have execute permission for the .sh files -->
+    <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx" 
+      includes="*.sh"/>   
+  </target>
+  
+  <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
+  
+  <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
+    <!-- re-setup the server.xml file -->
+    <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
+      <filterset>
+	<filter token="port" value="${tomcat.port}"/>
+	<filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
+      </filterset>
+    </copy>
+    <!-- set up the greenstone3 context -->
+    <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
+      <filterset>
+	<filter token="gsdl3webhome" value="${basedir}/web"/>
+      </filterset>
+    </copy>
+  </target>
+
+  <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
+    <!-- re-setup the server.xml file -->
+    <!-- need to edit the config file, or do we get the user to do this???-->
+  </target>
+    
+  <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
+   <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
+    <property name="tomcat.path" refid="local.tomcat.path"/>
+    <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
+    <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
+      <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
+      <env key="GSDL3HOME" value="${basedir}"/>
+      <env key="PATH" path="${tomcat.path}"/>
+      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
+      <env key="CATALINA_HOME" value="${catalina.home}"/>
+      <env key="CLASSPATH" path="${tomcat.classpath}"/>
+      <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
+      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
+    </exec>
+    <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
+      <env key="GSDLOS" value="windows"/>
+      <env key="GSDL3HOME" value="${basedir}"/>
+      <env key="Path" path="${tomcat.path}"/>
+      <env key="PATH" path="${tomcat.path}"/>
+      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
+      <env key="CLASSPATH" path="${tomcat.classpath}"/>
+    </exec>
+    <!-- wait for the server to startup in case other targets need it running -->
+    <waitfor maxwait="5" maxwaitunit="second">
+      <and>
+	<socket server="${tomcat.server}" port="${tomcat.port}"/>
+	<http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
+      </and>
+    </waitfor>
+  </target>
+  <!-- windows: do we want to launch a webrowser?? -->
+  <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
+    <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
+      <env key="CATALINA_HOME" value="${catalina.home}"/>
+    </exec>
+    <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
+  </target>
+
+  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
+
+  <target name="setup-catalina-ant-tasks">
+    <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
+    <taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="list"      classname="org.apache.catalina.ant.ListTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+    <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
+      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
+  </target>
+
+
+
+
+
+
+<!-- ======================= ant Targets ============================ --> 
+  <target name="prepare-ant" depends="init">
+    <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
+      dest="${packages.home}/apache-ant-1.7.0-bin.zip"
+      usetimestamp="true"/>
+    <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
+      dest="${packages.home}"/>
+    <move todir="${packages.home}/ant">
+      <fileset dir="${packages.home}/apache-ant-1.7.0"/>
+    </move>
+  </target>
+
+<!-- ======================= Axis Targets ============================ --> 
+
+  <target name="prepare-axis" depends="init">
+    <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
+      dest="${packages.home}/axis-bin-1_2_1.zip"
+      usetimestamp="true"/>
+    <unzip src="${packages.home}/axis-bin-1_2_1.zip"
+      dest="${packages.home}"/>
+    <move todir="${packages.home}/axis">
+      <fileset dir="${packages.home}/axis-1_2_1"/>
+    </move>
+    <!-- install axis into greenstone web app -->
+    <copy todir="${web.lib}">
+      <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
+	<include name="*.jar"/>
+      </fileset>
+    </copy>
+    <copy todir="${web.home}">
+      <fileset dir="${packages.home}/axis/webapps/axis/">
+	<include name="*.jsp"/>
+	<include name="*.jws"/>
+      </fileset>
+    </copy>
+    <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
+    <copy todir="${web.classes}">
+      <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
+	<include name="*.properties"/>
+      </fileset>
+    </copy>
+  </target>
+
+  <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,create-deployment-files,deploy-site"
+    description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
+  
+  <target name="deploy-site">
+    <java classname="org.apache.axis.client.AdminClient">
+      <classpath refid="compile.classpath"/>
+      <arg value="-l"/>
+      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
+      <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
+    </java>    
+  </target>
+  
+  <target name="soap-undeploy-site" depends="get-sitename"
+    description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
+    <java classname="org.apache.axis.client.AdminClient">
+      <classpath refid="compile.classpath"/>
+      <arg value="-l"/>
+      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
+      <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
+    </java>
+  </target>
+
+  <!-- this target used to deploy the preprepared localsite server  -->
+  <target name="deploy-localsite" depends="init" 
+    description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
+    <antcall target="start-tomcat"/>
+    <antcall target="deploy-site">
+      <param name="axis.sitename" value="localsite"/>
+    </antcall>
+    <antcall target="stop-tomcat"/>
+  </target>
+  
+  <target name="get-sitename" unless="axis.sitename">
+    <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
+  </target>
+
+  <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
+    <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
+    <echo>${axis.sitename}, ${axis.siteuri}</echo>
+  </target>
+
+  <target name="check-deployment-files" depends="get-sitename">
+    <condition property="deploy.exists">
+      <and>
+	<available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
+	<available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
+	<available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
+      </and>
+    </condition>
+   </target> 
+
+  <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files" 
+    if="axis.sitename" unless="deploy.exists">
+    <filter token="sitename" value="${axis.sitename}"/>
+    <filter token="siteuri" value="${axis.siteuri}"/>
+    <copy file="${basedir}/resources/soap/site.wsdd.template"
+      tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
+      filtering="true"/>
+     <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
+      tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
+      filtering="true"/>
+    <!-- create the java files and compile them -->
+    <copy file="${basedir}/resources/java/SOAPServer.java.in"
+      tofile="${src.gsdl3.home}/SOAPServer${axis.sitename}.java"
+      filtering="true"/>
+    <mkdir dir="${build.home}"/>
+    <javac srcdir="${src.home}"
+      destdir="${build.home}" 
+      debug="${compile.debug}"
+      deprecation="${compile.deprecation}"
+      optimize="${compile.optimize}">
+      <classpath refid="compile.classpath"/>
+      <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
+    </javac>
+    <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
+    <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
+  </target>
+    
+
+<!-- ====================== Core targets ============================== -->
+<!-- core targets refer to the core gsdl3 java src -->
+  
+  <target name="prepare-core" unless="nocvs.mode">
+    <!-- just get rid of empty directories-->
+    <svn>
+		<update dir="."/>
+	</svn>
+  </target>
+  
+  <target name="configure-core"/>
+
+  <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
+    description="Update only the Greenstone core" />
+  
+  <target name="svnupdate-core" unless="nocvs.mode">
+
+	<svn>
+		<update dir="." recurse="false"/>
+	</svn>
+
+   <svn>
+		<update dir="bin"/>
+		<update dir="comms"/>
+		<update dir="dist-resources"/>
+		<update dir="docs"/>
+		<update dir="lib"/>
+		<update dir="resources"/>
+		<update dir="src"/>
+		<update dir="winutil"/>
+	</svn>
+
+  </target>
+
+  <target name="clean-core"
+    description="Clean only the Greenstone core">
+    <delete dir="${build.home}"/>
+  </target>
+
+   <target name="compile-core" depends="init" 
+    description="Compile only the Greenstone core">
+    <mkdir dir="${build.home}"/>
+    <javac srcdir="${src.home}"
+      destdir="${build.home}"
+      debug="${compile.debug}"
+      deprecation="${compile.deprecation}"
+      optimize="${compile.optimize}">
+      <classpath>
+	<path refid="compile.classpath"/>
+      </classpath>
+    </javac>
+    <jar destfile="${build.home}/gsdl3.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/gsdl3/**"/>
+        <include name="org/flax/**"/>
+	<exclude name="**/Test.class"/>
+      </fileset>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}" />
+      </manifest>
+    </jar>
+    <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
+    <!-- copy the localsite server in case we need it -->
+    <copy file="${build.home}/org/greenstone/gsdl3/SOAPServerlocalsite.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServerlocalsite.class" />
+
+    <jar destfile="${build.home}/GAI.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/admin/**"/>
+      </fileset>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}" />
+      </manifest>
+    </jar>
+      
+    <jar destfile="${build.home}/phind.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/applet/phind/**"/>
+      </fileset>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}" />
+      </manifest>
+    </jar>
+    <mkdir dir="${web.applet}"/>
+    <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
+    <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
+    <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
+    <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
+    <jar destfile="${build.home}/anttasks.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/anttasks/**"/>
+      </fileset>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}" />
+      </manifest>
+    </jar>
+    <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
+    <jar destfile="${build.home}/gsdl3test.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/gsdl3/**/*Test.class"/>
+	<include name="org/greenstone/testing/**"/>
+      </fileset>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}" />
+      </manifest>
+    </jar>
+    <jar destfile="${build.home}/server.jar">
+      <fileset dir="${build.home}">
+	<include name="org/greenstone/server/**"/>
+      </fileset>
+      <fileset file="${basedir}/resources/java/server.properties"/>
+      <manifest>
+	<attribute name="Built-By" value="${user.name}"/>
+      </manifest>
+    </jar>
+    <copy file="${build.home}/server.jar" todir="${basedir}"/>
+  </target>
+ 
+<!-- ================== Packages targets ================================ -->
+  <!-- these targets refer to the greenstone source packages - these need 
+  updating less often, so are in  separate targets to the core -->
+  <target name="prepare-packages" depends="init,prepare-indexers"/>
+  
+  <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nocvs.mode">
+<!--  <target name="checkout-indexers" depends="check-svnroot,init" if="independent-indexers" unless="nocvs.mode"> -->
+    <svn>
+		<checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers"/>
+	</svn>
+  </target>
+  
+  <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
+    <antcall target="checkout-indexers"/>
+  </target>
+
+  <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
+    description="Update only the source packages"/>
+
+  <target name="svnupdate-packages" unless="nocvs.mode"> 
+   <svn>
+		<update dir="${src.packages.home}"/>
+	</svn>
+  </target>
+  
+  <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers" 
+    description="Configure only the packages."/>
+  
+  <target name="configure-javagdbm">
+    <echo>
+      Configuring JavaGDBM
+    </echo>
+    <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
+      dir="${javagdbm.home}">
+      <arg value="--prefix=${basedir}"/>
+      <arg value="--libdir=${lib.jni}"/>
+    </exec>    
+    <exec executable="${javagdbm.home}/configure" os="${os.mac}"
+      dir="${javagdbm.home}">
+      <arg value="--prefix=${basedir}"/>
+      <arg value="--libdir=${lib.jni}"/>
+     <arg value="--with-gdbm=${gdbm.installed.path}"/>
+    </exec>    
+  </target>
+
+<!-- Message from oran. I removed the condition from this line becuase it meant
+	the indexers would only be configured if collection building was DISabled.
+	Shouldn't they be configured when collection building is ENabled? -->
+
+<!--	<target name="configure-indexers" depends="init" if="independent-indexers"> -->
+<target name="configure-indexers" depends="init">
+		<echo>Configuring Indexers</echo>
+		<exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
+			<arg value="--prefix=${basedir}"/>
+			<arg value="--libdir=${lib.jni}"/>
+		</exec>          
+	</target>
+
+  <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
+
+  <target name="clean-javagdbm" depends="init">
+    <exec executable="make" os="${os.unix}"
+      dir="${javagdbm.home}">
+      <arg value="clean"/>
+    </exec>
+  </target>
+  
+  <target name="clean-indexers" depends="init" if="independent-indexers">
+    <exec executable="make" os="${os.unix}"
+      dir="${indexers.home}">
+      <arg value="clean"/>
+    </exec>
+    <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
+       dir="${indexers.home}">
+       <arg value="clean"/>
+    </exec>
+
+  </target>
+   
+	<target name="compile-packages" description="Compile only the source packages">
+
+		<!-- javagdbm -->
+		<echo>compile javagdbm</echo>
+		<exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
+		<exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
+			<arg value="install"/>
+		</exec>
+
+		<!-- windows: just the java stuff. -->
+		<echo>Windows: compile javagdbm (java only)</echo>
+		<exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
+			<arg value="compile"/>
+			<arg value="javaonly"/>
+		</exec>
+
+		<!-- install the jar file -->
+		<echo>Install the javagdbm jar file</echo>
+		<copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
+
+		<!-- Indexers -->
+
+		<!-- this may be in gs2build - we will be recompiling, but never mind -->
+		<echo>Indexers: make (from ${indexers.home})</echo>
+		<exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
+		<echo>Indexers: make install</echo>
+		<exec executable="make" os="${os.unix}" dir="${indexers.home}">
+			<arg value="install"/>
+		</exec>
+
+		<echo>Indexers: make</echo>
+		<exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
+			<arg value="all"/>
+		</exec>
+		<echo>Indexers: make install</echo>
+		<exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
+			<arg value="install"/>
+		</exec>
+
+		<!-- install the jar and jni files -->
+		<echo>Install the indexers' jar and jni files</echo>
+		<copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
+		<copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
+		<copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
+		<antcall target="install-jni-files"/>
+	</target>
+
+  <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
+
+    <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
+    <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
+    <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
+     <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
+     <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
+   </target>
+   <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
+    <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
+    <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
+     <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
+     <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
+   </target>
+   <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
+    <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
+    <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
+     <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
+    <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
+     <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
+   </target>
+ 
+  <!-- ================== gs2building targets ===============-->
+
+
+  <target name="update-gs2building" if="collection.building.enabled" 
+    depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
+    description="Update only the Greenstone 2 building components"/>
+
+  <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nocvs.mode">
+  </target>
+  <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
+    <!-- Note: can't do a -d update here cos it will get all of gsdl 
+     also, an update doesn't get new files, so we do a checkout instead. -->
+		<antcall target="checkout-gs2build"/>
+  </target>
+  
+  <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
+    <svn>
+		<update dir="${gli.home}"/>
+	</svn>
+  </target>
+
+  <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
+  </target>
+
+  <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nocvs.mode">
+    <echo>checking out gs2build</echo>
+		<!-- svn checkouts -->
+		<svn>
+			<!-- perllib -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/perllib" destPath="gs2build/perllib"/>
+
+			<!-- selected packages -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/cpan" destPath="gs2build/packages/cpan"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/expat" destPath="gs2build/packages/expat"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/html-tidy" destPath="gs2build/packages/html-tidy"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/isis-gdl" destPath="gs2build/packages/isis-gdl"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/kea" destPath="gs2build/packages/kea"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/pdftohtml" destPath="gs2build/packages/pdftohtml"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/rtftohtml" destPath="gs2build/packages/rtftohtml"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/w3mir" destPath="gs2build/packages/w3mir"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/wget" destPath="gs2build/packages/wget"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/windows" destPath="gs2build/packages/windows"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/wv" destPath="gs2build/packages/wv"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/xlhtml" destPath="gs2build/packages/xlhtml"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/packages/yaz" destPath="gs2build/packages/yaz"/>
+			
+			<!-- some of src (db2txt hashfile phind txt2db) -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/src/db2txt" destPath="gs2build/src/db2txt"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/src/hashfile" destPath="gs2build/src/hashfile"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/src/phind" destPath="gs2build/src/phind"/>
+			<checkout url="${svn.root}/gsdl/${branch.path}/src/txt2db" destPath="gs2build/src/txt2db"/>
+
+			<!-- bin -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/bin/script" destPath="gs2build/bin/script"/>
+
+			<!-- mappings -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/mappings" destPath="gs2build/mappings"/>
+
+			<!-- etc/packages -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/etc/packages" destPath="gs2build/etc/packages"/>
+	
+			<!-- collect -->
+			<checkout url="${svn.root}/gsdl/${branch.path}/collect/modelcol" destPath="gs2build/collect/modelcol"/>
+
+			<!-- gs2build-extra -->
+			<checkout url="${svn.root}/other-projects/trunk/gs2build-extra" destPath="gs2build/gs2build-extra"/>
+
+			<!-- indexers -->
+			<checkout url="${svn.root}/indexers/${branch.path}" destPath="gs2build/indexers"/>
+
+
+		</svn>
+		<!-- regular downloads -->
+
+		<!-- some files from lib -->
+		<mkdir dir="gs2build/lib"/>
+		<get src="${svn.root}/gsdl/${branch.path}/lib/text_t.h" dest="gs2build/lib/text_t.h"/>
+		<get src="${svn.root}/gsdl/${branch.path}/lib/text_t.cpp" dest="gs2build/lib/text_t.cpp"/>
+		<get src="${svn.root}/gsdl/${branch.path}/lib/gsdlconf.h" dest="gs2build/lib/gsdlconf.h"/>
+
+		<!-- some files from etc -->
+		<get src="${svn.root}/gsdl/${branch.path}/etc/marctodc.txt" dest="gs2build/etc/marctodc.txt"/>
+		<get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc-mapping.xml" dest="gs2build/etc/dc2marc-mapping.xml"/>
+		<get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc.xsl" dest="gs2build/etc/dc2marc.xsl"/>
+		<get src="${svn.root}/gsdl/${branch.path}/etc/qdc2marc-mapping.xml" dest="gs2build/etc/qdc2marc-mapping.xml"/>
+
+		<!-- some files from the gsdl root directory -->
+		<get src="${svn.root}/gsdl/${branch.path}/setup.bash" dest="gs2build/setup.bash"/>
+		<get src="${svn.root}/gsdl/${branch.path}/config.sub" dest="gs2build/config.sub"/>
+		<get src="${svn.root}/gsdl/${branch.path}/config.guess" dest="gs2build/config.guess"/>
+		<get src="${svn.root}/gsdl/${branch.path}/config.h.in" dest="gs2build/config.h.in"/>
+		<get src="${svn.root}/gsdl/${branch.path}/configtest.pl" dest="gs2build/configtest.pl"/>
+		<get src="${svn.root}/gsdl/${branch.path}/install-sh" dest="gs2build/install-sh"/>
+		<get src="${svn.root}/gsdl/${branch.path}/acconfig.h" dest="gs2build/acconfig.h"/>
+		<get src="${svn.root}/gsdl/${branch.path}/aclocal.m4" dest="gs2build/aclocal.m4"/>
+		<get src="${svn.root}/gsdl/${branch.path}/WIN32cfg.h" dest="gs2build/WIN32cfg.h"/>
+
+	</target>
+
+  <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
+    <antcall target="checkout-gs2build"/>
+    <antcall target="rename-gs2build-files"/>
+    <antcall target="unzip-windows-packages"/>
+    <antcall target="checkout-winbin"/>
+    <antcall target="get-windows-binaries"/>
+    <antcall target="delete-winbin"/>
+    <antcall target="get-macos-extra"/>
+  </target>
+
+  <target name="checkout-winbin" depends="init" if="current.os.iswindows" 
+    unless="nocvs.mode">
+    <svn>
+		<checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin"/>
+	</svn>	
+  </target>
+
+  <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nocvs.mode">
+		<svn>
+			<update dir="${svn.root}/other-projects/trunk/winbin"/>
+		</svn>	
+	</target>
+  
+  <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
+    <move todir="${gs2build.home}/bin/windows" failonerror="false">
+      <fileset dir="${basedir}/winbin/bin"/>
+    </move>
+  </target>
+  <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
+    <delete dir="${basedir}/winbin"/>
+  </target>
+  
+  <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">  
+    <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
+    dest="${gs2build.home}/packages/windows/gdbm"/>
+   <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
+    dest="${gs2build.home}/packages/windows/crypt"/>
+       <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
+    dest="${gs2build.home}/packages/windows/expat"/>
+   </target>
+  
+  <!-- downloads a good XML-Parser -->
+  <target name="get-macos-extra" depends="init" if="need.macos.extra">	
+      <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
+      dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
+      usetimestamp="true"/>
+  </target>  
+
+  <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
+  <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
+    <!-- make sure these directories are present, otherwise chmod craps out 
+    this chmod is needed in case we are unpacking for a second time -->
+    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
+    <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
+    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
+    <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
+    <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
+      dest="${gs2build.home}/perllib/cpan/"
+      compression="gzip"/>
+  </target>
+
+  <target name="install-indexer-files" depends="init" unless="indexers.present">
+    <copy todir="${indexers.home}">
+      <fileset dir="${gs2build.home}/indexers" />
+    </copy>
+    <chmod file="${indexers.home}/configure" perm="a+x"/>
+  </target>
+
+  <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
+  
+  <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
+    <!-- we want a windows path in the setup.bat file -->
+    <pathconvert targetos="windows" property="gs2build.home.windows">
+      <path path="${gs2build.home}"/>
+    </pathconvert>
+    <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
+      <filterset>
+	<filter token="gsdlhome" value="${gs2build.home.windows}"/>
+     </filterset>
+    </move>  
+    <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
+  </target>
+  
+  <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
+    <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
+    <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
+    <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
+    <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
+  </target> 
+  
+  <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
+    <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
+    <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>    
+    <chmod file="${gs2build.home}/configure" perm="a+x"/>
+    <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
+    <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>  
+    <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
+    <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
+    <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
+    <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>  
+  </target>
+  
+  <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
+    <antcall target="checkout-gli"/>
+  </target>
+  
+<!--  <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode"> -->
+  <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nocvs.mode">
+    <echo>checking out gli</echo>
+    <svn>
+		<checkout url="${svn.root}/gli/${branch.path}" destPath="gli"/>
+	</svn>
+  </target>
+    
+  <target name="configure-gs2building" depends="init" if="collection.building.enabled"
+    description="Configure only the Greenstone 2 building components">
+    <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
+      dir="${gs2build.home}">
+      <arg value="--prefix=${gs2build.home}"/>
+    </exec>
+    <exec executable="${gs2build.home}/configure" os="${os.mac}"
+      dir="${gs2build.home}">
+      <arg value="--prefix=${gs2build.home}"/>
+      <arg value="--with-gdbm=${gdbm.installed.path}"/>
+    </exec>
+  </target>
+
+  <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build" 
+    description="Clean only the Greenstone 2 building components" 
+    if="collection.building.enabled"/>
+  
+  <target name="clean-gli" depends="init" if="collection.building.enabled">
+    <!-- gli -->
+    <property name="gli.home" value="${basedir}/gli"/>
+    <!-- linux -->
+    <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
+      resolveExecutable="true"/>
+    <!-- windows -->
+    <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
+      resolveExecutable="true"/>
+  </target>
+  
+  <target name="clean-gs2build" depends="init" if="collection.building.enabled">
+    <!-- gs2build -->
+    <!--linux:  -->
+    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
+      <arg value="clean"/>
+    </exec>
+    <!-- windows: -->    
+    <!-- run the setup script -->
+    <exec executable="${compile.windows.c++.setup}"/>
+    <exec executable="nmake" dir="${gs2build.home}">
+     <arg value="/f"/>
+     <arg value="win32.mak"/>
+     <arg value="clean"/>
+    </exec>
+  </target>
+  
+  <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
+    <!-- gs2build -->
+    <!--linux:  -->
+    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
+      <arg value="distclean"/>
+    </exec>
+    <!-- windows: -->    
+  </target>
+  
+  <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
+    description="Compile only the Greenstone 2 building components">
+  </target>
+  
+  <target name="compile-gli" depends="init" if="collection.building.enabled">
+    <!-- gli -->
+    <property name="gli.home" value="${basedir}/gli"/>
+
+		<!-- change the version number -->
+		<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;"/>
+    <!-- linux -->
+    <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
+     <!--remote gli-->
+     <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
+      resolveExecutable="true"/>
+    <!-- windows -->
+    <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
+    <!--remote gli-->
+     <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
+      resolveExecutable="true"/> 
+     <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
+  </target>
+  
+  <target name="compile-gs2build" depends="init" if="collection.building.enabled">
+    <!-- gs2build -->
+    <!--linux: make, make install -->
+    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
+    </exec>
+    <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
+      <arg value="install"/>
+    </exec>
+    <!-- run the setup script -->
+    <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>
+    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
+     <arg value="/f"/>
+     <arg value="win32.mak"/>
+    </exec>
+    <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
+     <arg value="/f"/>
+     <arg value="win32.mak"/>
+     <arg value="install"/>
+    </exec>
+    <!-- LuceneWrapper jar file not installed by default -->
+    <mkdir dir="${gs2build.home}/bin/java"/>
+    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
+    <antcall target="install-gs2build-indexers-windows"/>
+    <antcall target="install-macos-extra"/>
+  </target>
+  
+  <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
+    <copy todir="${gs2build.home}/bin/windows">
+      <fileset dir="${gs2build.home}/indexers/bin">
+	<include name="*.*"/>
+      </fileset>
+    </copy>
+  </target>
+
+  <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
+    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
+      <env key="gsdl3path" path="${basedir}"/>
+      <env key="gsdlpath" path="${basedir}/gs2build"/>
+    </exec>
+    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
+      <env key="gsdl3path" path="${basedir}"/>
+      <env key="gsdlpath" path="${basedir}/gs2build"/>
+      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
+    </exec>
+    <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
+      <env key="GSDL3PATH" path="${basedir}"/>
+      <env key="GSDLPATH" path="${basedir}/gs2build"/>
+    </exec>
+    <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.
+    </echo>
+  </target>
+ 
+
+<!-- ======================== TESTING Targets ========================= -->
+  
+  <target name="test" description="Run the (incomplete) JUnit test suite "
+    depends="init">
+    <mkdir dir="${basedir}/test"/>
+    <junit printsummary="withOutAndErr"
+      errorproperty="test.failed"
+      failureproperty="test.failed"
+      fork="${junit.fork}">
+      <formatter type="plain"/>
+      <classpath>
+	<pathelement location="${build.home}/gsdl3test.jar"/>
+	<path refid="compile.classpath"/>
+      </classpath>
+      <test name="${testcase}" if="testcase"/>
+      <batchtest todir="${basedir}/test" unless="testcase">
+	<fileset dir="${build.home}"
+	  includes="**/*Test.class"
+	  />
+      </batchtest>
+    </junit>
+    <echo>
+      *********************************************
+       Test output can be found in directory 'test'
+      *********************************************
+    </echo>
+  </target>
+  <target name="checkout-flax" description="check out flax source code from another repository">
+    <echo>checking out flax ...</echo>
+    <mkdir dir="${basedir}/src/java/org/flax"/>
+    <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
+    <mkdir dir="${basedir}/web/WEB-INF/classes/flax"/>
+    <mkdir dir="${basedir}/web/interfaces/flax"/>
+    <mkdir dir="${basedir}/web/sites/flax"/>
+    <svn>
+      <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/flax/"  
+                destPath="${basedir}/src/java/org/flax"/>
+      <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/greenstone/gsdl3/flax/" 
+                destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
+      <checkout url="${flax.svn.root}/flax1.0/trunk/web/WEB-INF/classes/flax/" 
+                destPath="${basedir}/web/WEB-INF/classes/flax"/>
+      <checkout url="${flax.svn.root}/flax1.0/trunk/web/interfaces/flax/" 
+                destPath="${basedir}/web/interfaces/flax"/>
+      <checkout url="${flax.svn.root}/flax1.0/trunk/web/sites/flax/" 
+                destPath="${basedir}/web/sites/flax"/>
+    </svn>
+    <move file="${basedir}/web/WEB-INF/web.xml" tofile="${basedir}/web/WEB-INF/web.xml.greenstone3backup"/>
+    <copy file="${basedir}/web/WEB-INF/classes/flax/web.xml" todir="${basedir}/web/WEB-INF" />
+
+    <property name="coll.dir" value="${basedir}/web/sites/flax/collect"/>
+    <!-- betterfa -->
+    <unzip src="${coll.dir}/betterfa/archives/archives.zip" dest="${coll.dir}/betterfa/archives"/>
+    <unzip src="${coll.dir}/betterfa/import/import.zip" dest="${coll.dir}/betterfa/import"/>
+    <unzip src="${coll.dir}/betterfa/index/index.zip" dest="${coll.dir}/betterfa/index"/>
+    <!-- imagegue -->
+    <unzip src="${coll.dir}/imagegue/archives/archives.zip" dest="${coll.dir}/imagegue/archives"/>
+    <unzip src="${coll.dir}/imagegue/import/import.zip" dest="${coll.dir}/imagegue/import"/>
+    <unzip src="${coll.dir}/imagegue/index/index.zip" dest="${coll.dir}/imagegue/index"/>
+    <!-- wikill -->
+    <unzip src="${coll.dir}/wikill/archives/archives.zip" dest="${coll.dir}/wikill/archives"/>
+    <unzip src="${coll.dir}/wikill/import/import.zip" dest="${coll.dir}/wikill/import"/>
+    <unzip src="${coll.dir}/wikill/index/index.zip" dest="${coll.dir}/wikill/index"/>
+
+  </target>
+
+</project>
+
+
