Changeset 9874 for trunk/gsdl3/build.xml


Ignore:
Timestamp:
2005-05-16T11:02:50+12:00 (19 years ago)
Author:
kjdon
Message:

merged from branch ant-install-branch: merge 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/build.xml

    r8424 r9874  
    11<?xml version="1.0"?>
     2
    23<!-- ======================================================================
    3      Oct 11, 2004 1:54:59 AM                                                       
    4 
    5      GSDL3 build script for rebuilding gsdl3.jar
     4     March 2005                                                   
     5
     6     GSDL3 build and install script
    67                   
    7      schweer                                                               
     8     kjdon                                                               
    89     ====================================================================== -->
    9 <project name="gsdl3" default="build">
    10 
    11     <property name="src" value="src/java"/>
    12     <property name="build" value="classes"/>
    13     <property name="lib" value="lib/java"/>
    14     <property name="weblib" value="web/lib"/>
    15     <property name="javadocs" value="docs/javadoc"/>
    16 
    17     <description>
    18         GSDL3 build script for rebuilding gsdl3.jar
    19     </description>
    20 
    21     <target name="init">
    22         <tstamp/>
    23         <mkdir dir="${build}"/>
    24     </target>
    25 
    26     <target name="build" depends="init" description="build the java code">
    27         <javac debug="true" destdir="${build}" extdirs="${lib}:comms/jakarta/tomcat/common/lib/servlet.jar" optimize="false" srcdir="${src}" excludes="org/greenstone/testing/** org/greenstone/applet/** "/>
    28     </target>
    29 
    30     <target name="jar" depends="build" description="re-create gsdl3.jar">
    31         <jar destfile="${lib}/gsdl3.jar">
    32             <fileset dir="${build}" excludes="org/greenstone/testing/**" />
    33             <manifest>
    34                 <attribute name="Built-By" value="${user.name}" />
    35             </manifest>
    36         </jar>
    37     </target>
    38 
    39     <target name="install" depends="jar" description="copy gsdl3.jar to where it's supposed to be">
    40         <copy file="${lib}/gsdl3.jar" todir="${weblib}"/>
    41     </target>
    42 
    43 
    44     <target name="javadocs" depends="init" description="create javadocs">
    45         <javadoc author="true" destdir="${javadocs}" extdirs="${lib}" failonerror="true" private="true" source="1.4" sourcepath="${src}" version="true">
    46             <packageset dir="${src}" excludes="org/greenstone/testing/** org/greenstone/applet/** org/greenstone/gdbm/**"/>
    47         </javadoc>
    48     </target>
     10<project name="gsdl3" default="usage" basedir=".">
     11
     12 <!-- ============ self defined tasks =================== -->
     13
     14  <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpath="${basedir}/lib/java/anttasks.jar"/>
     15  <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpath="${basedir}/lib/java/anttasks.jar"/>
     16
     17
     18
     19<!-- ===================== Property Definitions =========================== -->
     20
     21<!--
     22
     23  Each of the following properties are used in the build script.
     24  Values for these properties are set by the first place they are
     25  defined, from the following list:
     26
     27  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
     28
     29  * Definitions from a "build.properties" file in the top level
     30    source directory of this application.
     31
     32  * Definitions from a "build.properties" file in the user's
     33    home directory.
     34
     35  * Default definitions in this build.xml file.
     36
     37  You will note below that property values can be composed based on the
     38  contents of previously defined properties.  This is a powerful technique
     39  that helps you minimize the number of changes required when your development
     40  environment is modified.  Note that property composition is allowed within
     41  "build.properties" files as well as in the "build.xml" script.
     42
     43-->
     44
     45  <property file="build.properties"/>
     46  <property file="${user.home}/build.properties"/>
     47
     48  <!-- get properties from the environment -->
     49  <property environment="env"/>
     50  <property name="src.home" value="${basedir}/src/java"/>
     51  <property name="build.home" value="${basedir}/build"/>
     52  <property name="packages.home" value="${basedir}/packages"/>
     53  <property name="javalib" value="${basedir}/lib/java"/>
     54  <property name="web.home" value="${basedir}/web"/>
     55  <property name="web.lib" value="${web.home}/lib"/>
     56  <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
     57 
     58  <property name="javadocs" value="${basedir}/docs/javadoc"/>
     59
     60  <property name="app.name"      value="gsdl3"/>
     61  <property name="app.path"      value="/${app.name}"/>
     62  <property name="app.version"   value="3.00alpha"/>
     63  <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/>
     64 
     65  <property name="os.linux" value="Linux"/> <!-- mac??-->
     66  <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP, Windows NT,Windows ME"/> <!-- check this!!!-->
     67
     68  <condition property="current.os.islinux">
     69    <os family="unix"/>
     70  </condition>
     71  <condition property="current.os.iswindows">
     72    <os family="windows"/>
     73  </condition>
     74  <!-- ============= Base dirs for each package and component ============ -->
     75  <property name="applet.home" value="${src.home}/org/greenstone/applet"/>
     76  <property name="gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
     77  <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
     78  <property name="gs2build.home" value="${basedir}/gs2build"/>
     79  <property name="gli.home" value="${basedir}/gli"/>
     80  <property name="vishnu.home" value="${packages.home}/vishnu"/>
     81  <property name="mg.home" value="${packages.home}/mg"/>
     82  <property name="mgpp.home" value="${packages.home}/mgpp"/>
     83  <property name="mysql.home" value="${packages.home}/mysql"/>
     84  <property name="gsdl-as.home" value="${packages.home}/gsdl-as"/>
     85
     86<!--  ==================== Compilation Control Options ==================== -->
     87
     88<!--
     89
     90  These properties control option settings on the Javac compiler when it
     91  is invoked using the <javac> task.
     92
     93  compile.debug        Should compilation include the debug option?
     94
     95  compile.deprecation  Should compilation include the deprecation option?
     96
     97  compile.optimize     Should compilation include the optimize option?
     98
     99-->
     100
     101  <property name="compile.debug"       value="true"/>
     102  <property name="compile.deprecation" value="true"/>
     103  <property name="compile.optimize"    value="true"/>
     104
     105<!--
     106
     107  Rather than relying on the CLASSPATH environment variable, Ant includes
     108  features that makes it easy to dynamically construct the classpath you
     109  need for each compilation.  The example below constructs the compile
     110  classpath to include the servlet.jar file, as well as the other components
     111  that Tomcat makes available to web applications automatically, plus anything
     112  that you explicitly added.
     113
     114-->
     115
     116  <path id="compile.classpath">
     117    <!-- Include all jar files in our lib directory -->
     118    <pathelement location="${javalib}"/>
     119    <fileset dir="${javalib}">
     120      <include name="*.jar"/>
     121    </fileset>
     122    <!-- Include the resources directory -->
     123    <pathelement location="${basedir}/resources/java"/>
     124    <pathelement location="${basedir}/resources/dtd"/>
     125   
     126    <!-- Include the axis jar files -->
     127    <fileset dir="${basedir}/comms/soap/axis/lib">
     128      <include name="*.jar"/>
     129    </fileset>
     130   
     131    <!-- include the jar files from the packages -->
     132    <!-- mg and mgpp get installed into lib/java but they may not be there yet -->
     133    <pathelement location="${javalib}/mg.jar"/>
     134    <pathelement location="${javalib}/mgpp.jar"/>
     135    <pathelement location="${vishnu.home}/build/vishnu.jar"/>
     136   
     137    <!-- Include all elements that Tomcat exposes to applications -->
     138    <pathelement location="${catalina.home}/common/classes"/>
     139    <fileset dir="${catalina.home}/common/endorsed">
     140      <include name="*.jar"/>
     141    </fileset>
     142    <fileset dir="${catalina.home}/common/lib">
     143      <include name="*.jar"/>
     144    </fileset>
     145    <pathelement location="${catalina.home}/shared/classes"/>
     146    <fileset dir="${catalina.home}/shared/lib">
     147      <include name="*.jar"/>
     148    </fileset>
     149  </path>
     150
     151  <path id="running.path">
     152    <pathelement location="${mysql.home}/bin"/>
     153    <pathelement location="${basedir}/bin/script"/>
     154    <pathelement location="${basedir}/bin"/>
     155    <pathelement location="${basedir}/lib"/>
     156    <pathelement path="${env.PATH}"/>
     157    <pathelement path="${env.Path}"/>
     158  </path>
     159
     160  <path id="ld.library.path">
     161    <pathelement path="${env.LD_LIBRARY_PATH}"/>
     162    <pathelement location="${basedir}/lib"/>
     163    <pathelement location="${mysql.home}/lib/mysql"/>
     164  </path>
     165
     166<!-- ==================== Primary and Global Targets ============================= -->
     167
     168  <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
     169
     170  <target name="install" depends="accept-properties,init,prepare,cvsupdate,configure,clean,compile,deploy-localsite"
     171    description="Install Greenstone 3. Use this when you first checkout the code. Also running this target later on will reinstall Greenstone. Most things will be reset back to their defaults, except for code changes."/>
     172
     173  <target name="prepare" depends="init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-mysql,prepare-collections,prepare-extra"/>
     174
     175  <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building"
     176    description="Do a cvs update for all sources. Doesn't reompile the code."/>
     177
     178    <target name="configure" depends="init,configure-tomcat,configure-files,configure-packages,configure-core,configure-gs2building"
     179    description="Configure the installation. Includes setting up config files and configuring the C/C++ packages. This is called from install and update. Should be re-run if you change the build.properties file."/>
     180
     181  <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
     182    description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
     183  <target name="clean-windows-c++" depends="init,clean-windows-c++-gs2building,clean-windows-c++-packages"
     184    description="Remove C++ compiled code for Windows. Requires Microsoft Visual Studio"/>
     185  <target name="compile" depends="init,compile-extra,compile-packages,compile-core,compile-gs2building"
     186    description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
     187  <target name="compile-windows-c++" depends="init,compile-windows-c++-gs2building,compile-windows-c++-packages"
     188    description="Compile the C/C++ code for Windows. Requires Microsoft Visual Studio"/>
     189  <target name="update" depends="init,update-packages,update-core,update-gs2building"
     190    description="Update (thru CVS) all the source (including core, packages and gs2building) and recompile. Similar to install but doesn't reinstall components such as Tomcat and axis."/>
     191
     192  <target name="start" depends="init,start-mysql,start-tomcat"
     193    description="Startup the (local) Greenstone servers (tomcat,mysql...)" />
     194
     195  <target name="stop" depends="init,stop-tomcat,stop-mysql"
     196    description="Shutdown the (local) Greenstone servers."/>
     197 
     198  <target name="restart" description="Shutdown and restart the Greenstone servers" depends="init,stop,start"/>
     199
     200
     201<!-- =========== Help targets ===================================  -->
     202 
     203  <target name="usage" description="Print a help message">
     204    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
     205    <echo message="  Execute 'ant -help' for Ant help."/>
     206    <echo>To install Greenstone, run 'ant [options] install'.
     207There 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.
     208To log the output, use the '-logfile build.log' option.
     209    </echo>
     210  </target>
     211 
     212  <target name="help" depends="usage" description="Print a help message"/>
     213 
     214  <target name="debug" depends="init" description="Display all the currently used properties">
     215    <echoproperties/>
     216  </target>
     217
     218<!-- ====== initialization and setup targets ================== -->
     219
     220  <target name="accept-properties" unless="properties.accepted">
     221    <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
     222tomcat.server=${tomcat.server}
     223tomcat.port=${tomcat.port}
     224tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
     225gsdl2.installed.path=${gsdl2.installed.path} (this is the location of Greenstone 2 if you have it)
     226proxy.host=${proxy.host}
     227proxy.port=${proxy.port}
     228mysql.installed.path=${mysql.installed.path} (this is the location of mysql if it is already installed)
     229mysql.admin.user=${mysql.admin.user}
     230mysql.port=${mysql.port}
     231If these are not acceptable, please change them and rerun this target. Continue [y/n]?" />
     232    </input>
     233    <condition property="do.abort">
     234      <equals arg1="n" arg2="${properties.ok}"/>
     235    </condition>
     236    <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
     237  </target>
     238
     239  <target name="check-cvsroot">
     240    <condition property="cvsroot.notset">
     241      <or>
     242    <not>
     243      <isset property="env.CVSROOT"/>
     244    </not>
     245    <equals arg1="" arg2="${env.CVSROOT}"/>
     246      </or>
     247    </condition>
     248    <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
     249  </target>
     250  <!-- this sets up some initial properties -->
     251  <target name="init">
     252
     253    <condition property="java.too.old">
     254      <or>
     255    <equals arg1="1.1" arg2="${ant.java.version}"/>
     256    <equals arg1="1.2" arg2="${ant.java.version}"/>
     257    <equals arg1="1.3" arg2="${ant.java.version}"/>
     258      </or>
     259    </condition>
     260    <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
     261   
     262    <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/>
     263    <available file="${basedir}/packages/mysql/bin" property="mysql.present"/>
     264    <available file="${basedir}/gli" property="gli.present"/>
     265    <available file="${basedir}/gs2build" property="gs2build.present"/>
     266    <available file="${basedir}/comms/soap/axis" property="axis.present"/>
     267    <available file="${basedir}/comms/jakarta/tomcat/webapps/axis" property="axis.installed"/>
     268    <condition property="gsdl2.islocal">
     269      <or>
     270    <not>
     271      <isset property="gsdl2.installed.path"/>
     272    </not>
     273    <equals arg1="" arg2="${gsdl2.installed.path}"/>
     274      </or>
     275    </condition>
     276    <condition property="mysql.islocal">
     277      <or>
     278    <not>
     279      <isset property="mysql.installed.path"/>
     280    </not>
     281    <equals arg1="" arg2="${mysql.installed.path}"/>
     282      </or>
     283    </condition>
     284    <condition property="tomcat.islocal">
     285      <or>
     286    <not>
     287      <isset property="tomcat.installed.path"/>
     288    </not>
     289    <equals arg1="" arg2="${tomcat.installed.path}"/>
     290      </or>
     291    </condition>
     292   
     293      <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
     294    <condition property="proxy.present">
     295      <and>
     296    <isset property="proxy.host"/>
     297    <not>
     298      <equals arg1="" arg2="${proxy.host}"/>
     299    </not>
     300      </and>
     301    </condition>
     302  </target>
     303
     304  <target name="setup-proxy" depends="init" if="proxy.present">
     305    <condition property="ask.user">
     306      <or>
     307    <equals arg1="" arg2="${proxy.user}"/>
     308    <equals arg1="" arg2="${proxy.password}"/>
     309      </or>
     310    </condition>
     311    <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}"/>
     312    <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
     313  </target>
     314
     315 <!-- ========== Miscellaneous Targets ================================ -->
     316 
     317  <target name="prepare-collections">
     318    <property name="collect.dir" value="${basedir}/web/sites/localsite/collect"/>
     319    <!-- gs3mgdemo -->
     320    <unzip src="${collect.dir}/gs3mgdemo/import.zip"
     321      dest="${collect.dir}/gs3mgdemo"/>
     322    <unzip src="${collect.dir}/gs3mgdemo/archives.zip"
     323      dest="${collect.dir}/gs3mgdemo"/>
     324    <unzip src="${collect.dir}/gs3mgdemo/index/index.zip"
     325      dest="${collect.dir}/gs3mgdemo/index"/>
     326    <!-- gs2mgdemo -->
     327    <unzip src="${collect.dir}/gs2mgdemo/import.zip"
     328      dest="${collect.dir}/gs2mgdemo"/>
     329    <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
     330      dest="${collect.dir}/gs2mgdemo"/>
     331    <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
     332      dest="${collect.dir}/gs2mgdemo/index"/>
     333    <!-- gs2mgppdemo -->
     334    <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
     335      dest="${collect.dir}/gs2mgppdemo"/>
     336    <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
     337      dest="${collect.dir}/gs2mgppdemo"/>
     338    <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
     339      dest="${collect.dir}/gs2mgppdemo/index"/>
     340    <!-- gberg -->
     341    <unzip src="${collect.dir}/gberg/index/index.zip"
     342      dest="${collect.dir}/gberg/index"/>
     343  </target>
     344
     345  <target name="prepare-extra" depends="init">
     346    <!--  copy some jar files to web/lib for the phind applet -->
     347    <copy file="${catalina.home}/common/endorsed/xml-apis.jar"
     348      tofile="${basedir}/web/lib/xml-apis.jar"/>
     349    <copy file="${catalina.home}/common/endorsed/xercesImpl.jar"
     350      tofile="${basedir}/web/lib/xercesImpl.jar"/>
     351  </target>
     352
     353  <target name="configure-files" depends="configure-files-gsdl3,configure-files-server"/>
     354 
     355  <target name="configure-files-gsdl3" depends="init">
     356    <filter token="gsdl3home" value="${basedir}"/>
     357    <copy file="${basedir}/web/WEB-INF/web.xml.in" tofile="${basedir}/web/WEB-INF/web.xml" filtering="true"/>
     358    <copy file="${basedir}/resources/java/SOAPServer.cfg.in" tofile="${basedir}/resources/java/SOAPServer.cfg" filtering="true"/>
     359  </target>
     360 
     361  <target name="configure-files-server" depends="init">
     362    <filter token="port" value="${tomcat.port}"/>
     363    <filter token="hostname" value="${tomcat.server}"/>
     364    <copy file="${basedir}/web/sites/localsite/siteConfig.xml.in" tofile="${basedir}/web/sites/localsite/siteConfig.xml" filtering="true" overwrite="true"/>
     365    <copy file="${basedir}/web/sites/gateway/siteConfig.xml.in" tofile="${basedir}/web/sites/gateway/siteConfig.xml" filtering="true" overwrite="true"/>
     366  </target>
     367
     368   <target name="compile-extra" depends="init">
     369    <javac srcdir="${web.home}/WEB-INF/classes"
     370      destdir="${web.home}/WEB-INF/classes"
     371      debug="${compile.debug}"
     372      deprecation="${compile.deprecation}"
     373      optimize="${compile.optimize}">
     374      <classpath>
     375    <path refid="compile.classpath"/>
     376      </classpath>
     377    </javac>
     378  </target>
     379
     380 
     381
     382
     383<!-- ======================= Tomcat Targets ========================== -->
     384
     385  <!-- this target sets up tomcat for the first time, or resets it any subsequent times -->
     386  <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
     387    <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip"
     388      dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
     389      usetimestamp="true"/>
     390    <delete dir="${basedir}/comms/jakarta/tomcat.bak"/>
     391    <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false">
     392      <fileset dir="${basedir}/comms/jakarta/tomcat"/>
     393    </move>
     394    <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
     395      dest="${basedir}/comms/jakarta"/>
     396    <condition property="need.tomcat.compat">
     397      <equals arg1="1.4" arg2="${ant.java.version}"/>
     398    </condition>
     399    <antcall target="prepare-tomcat-compat"/>
     400    <move todir="${basedir}/comms/jakarta/tomcat">
     401      <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/>
     402    </move>
     403    <!-- make sure we have execute permission for the .sh files -->
     404    <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx"
     405      includes="*.sh"/>
     406    <copy file="${basedir}/comms/jakarta/setclasspath.bat"
     407      tofile="${basedir}/comms/jakarta/tomcat/bin/setclasspath.bat"
     408      overwrite="true"/>
     409  </target>
     410
     411 
     412  <target name="prepare-tomcat-compat" if="need.tomcat.compat">
     413    <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip"
     414      dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
     415      usetimestamp="true"/>
     416    <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
     417      dest="${basedir}/comms/jakarta"/>
     418  </target>
     419 
     420  <target name="configure-tomcat" depends="init" if="tomcat.islocal">
     421    <!-- re-setup the server.xml file -->
     422    <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true">
     423      <filterset>
     424    <filter token="port" value="${tomcat.port}"/>
     425    <filter token="gsdl3home" value="${basedir}"/>
     426      </filterset>
     427    </copy>
     428  </target>
     429
     430  <target name="reload" description="Reload web application"
     431          depends="init,setup-catalina-ant-tasks">
     432    <reload  url="http://kanuka:7070/manager" username="admin" password="admin"
     433            path="/gsdl3"/>
     434  </target>
     435 
     436  <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
     437    <property name="tomcat.classpath" refid="compile.classpath"/>
     438    <property name="tomcat.path" refid="running.path"/>
     439    <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
     440    <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
     441      <env key="GSDLOS" value="linux"/>
     442      <env key="GSDL3HOME" value="${basedir}"/>
     443      <env key="PATH" path="${tomcat.path}"/>
     444      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
     445      <env key="CATALINA_HOME" value="${catalina.home}"/>
     446      <env key="CLASSPATH" path="${tomcat.classpath}"/>
     447      <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${basedir}/lib:${mysql.home}/lib/mysql"/>
     448    </exec>
     449    <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
     450      <env key="GSDLOS" value="windows"/>
     451      <env key="GSDL3HOME" value="${basedir}"/>
     452      <env key="Path" path="${tomcat.path}"/>
     453      <env key="PATH" path="${tomcat.path}"/>
     454      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
     455      <env key="CLASSPATH" path="${tomcat.classpath}"/>
     456    </exec>
     457    <!-- wait for the server to startup in case other targets need it running -->
     458    <waitfor maxwait="5" maxwaitunit="second">
     459      <and>
     460    <socket server="${tomcat.server}" port="${tomcat.port}"/>
     461    <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/>
     462      </and>
     463    </waitfor>
     464  </target>
     465  <!-- windows: do we want to launch a webrowser?? -->
     466  <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
     467    <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
     468      <env key="CATALINA_HOME" value="${catalina.home}"/>
     469    </exec>
     470    <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
     471  </target>
     472
     473  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
     474
     475  <target name="setup-catalina-ant-tasks">
     476    <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
     477    <taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"
     478      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     479    <taskdef name="list"      classname="org.apache.catalina.ant.ListTask"
     480      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     481    <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"
     482      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     483    <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
     484      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     485    <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"
     486      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     487    <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"
     488      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     489    <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"
     490      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     491    <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
     492      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
     493  </target>
     494
     495
     496<!-- ======================= Mysql Targets =========================== -->
     497
     498  <!-- this is one target that we only want to run once. -->
     499  <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql,setup-mysql,stop-mysql"/>
     500
     501  <target name="init-mysql-vars">
     502    <condition property="mysql.islocal.linux">
     503      <and>
     504    <isset property="mysql.islocal"/>
     505    <isset property="current.os.islinux"/>
     506      </and>
     507    </condition>
     508
     509    <condition property="mysql.islocal.windows">
     510      <and>
     511    <isset property="mysql.islocal"/>
     512    <isset property="current.os.iswindows"/>
     513      </and>
     514    </condition>
     515   </target>
     516 
     517 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows"/>
     518 
     519  <!-- install and set up the database -->
     520  <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
     521    <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
     522      dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
     523      usetimestamp="true"/>
     524    <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
     525      dest="${packages.home}"
     526      compression="gzip"/>
     527    <move todir="${packages.home}/mysql">
     528      <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
     529    </move>
     530    <!-- file permissions are screwed up, so make executables executable -->
     531    <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
     532    <chmod perm="a+x">
     533      <fileset dir="${mysql.home}/bin" />
     534    </chmod>
     535    <mkdir dir="${mysql.home}/var/"/>
     536    <mkdir dir="${mysql.home}/var/log/"/>
     537    <chmod file="${mysql.home}/var/" perm="777"/>
     538    <chmod file="${mysql.home}/var/log/" perm="777"/>
     539   
     540    <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
     541      <arg value="--datadir=./data"/>
     542      <arg value="--basedir=."/>
     543      <arg value="--user=root"/>
     544      <arg value="--force"/>
     545    </exec>
     546  </target>
     547
     548  <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
     549    <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
     550      dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
     551      usetimestamp="true"/>
     552    <!-- can we run the installer?? -->
     553    <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
     554      dest="${packages.home}"/>
     555    <move todir="${packages.home}/mysql">
     556      <fileset dir="${packages.home}/mysql-4.1.11-win32"/>
     557    </move>
     558  </target>
     559
     560  <!-- is this just linux or both??. also we probably need to do this for external mysql -->
     561  <!-- had unless mysql.present -->
     562  <target name="setup-mysql" depends="init,init-mysql-vars" if="mysql.islocal">
     563    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     564      <arg value="--user=root"/>
     565      <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"/>
     566    </exec>
     567    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     568      <arg value="--user=root"/>
     569      <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%'"/>
     570    </exec>
     571    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     572      <arg value="--user=root"/>
     573      <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost;"/>
     574    </exec>
     575    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     576      <arg value="--user=root"/>
     577      <arg value="--execute=create database localsite_gs3mgdemo;"/>
     578    </exec>
     579    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
     580      input="${basedir}/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
     581      <arg value="--user=root"/>
     582      <arg value="localsite_gs3mgdemo"/>
     583    </exec>
     584  </target>
     585 
     586  <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal"
     587    description="Startup only mysql">
     588    <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
     589      spawn="true" os="${os.linux}">
     590      <arg value="--user=root"/>
     591      <arg value="--datadir=./data"/>
     592      <arg value="--basedir=."/>
     593      <arg value="--pid_file=gsdl3.pid"/>
     594      <arg value="--socket=/tmp/mysql.sock"/>
     595      <arg value="--err-log=./var/log/mysql.log"/>
     596    </exec>
     597   <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
     598    </exec>
     599    <sleep seconds="2"/>
     600    <!-- need to test that the server has started up -->   
     601    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
     602      failonerror="true" outputproperty="throw.away">
     603      <arg value="--user=root"/>
     604      <arg value="--execute=show databases;"/>
     605    </exec>
     606    <echo>MYSQL database server started successfully</echo>
     607  </target>
     608
     609    <target name="stop-mysql" depends="init" if="mysql.islocal"
     610    description="Shutdown only mysql">
     611    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
     612      failonerror="true" os="${os.linux}">
     613      <arg value="--user=root"/>
     614      <arg value="--socket=/tmp/mysql.sock"/>
     615      <arg value="shutdown"/>
     616    </exec>
     617    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
     618      failonerror="true" os="${os.windows}">
     619      <arg value="--user=root"/>
     620      <arg value="shutdown"/>
     621    </exec>
     622    <echo>MYSQL database server shutdown successfully</echo>
     623  </target>
     624
     625  <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/>
     626
     627
     628<!-- ======================= Axis Targets ============================ -->
     629
     630  <target name="prepare-axis" depends="init">
     631    <mkdir dir="${basedir}/comms/soap"/>
     632    <get src="http://www.greenstone.org/gs3files/axis-1_1.zip"
     633      dest="${basedir}/comms/soap/axis-1_1.zip"
     634      usetimestamp="true"/>
     635    <delete dir="${basedir}/comms/soap/axis.bak"/>
     636    <move todir="${basedir}/comms/soap/axis.bak"  failonerror="false">
     637      <fileset dir="${basedir}/comms/soap/axis"/>
     638    </move>
     639    <unzip src="${basedir}/comms/soap/axis-1_1.zip"
     640      dest="${basedir}/comms/soap/"/>
     641    <move todir="${basedir}/comms/soap/axis">
     642      <fileset dir="${basedir}/comms/soap/axis-1_1"/>
     643    </move>
     644    <!-- install the webapp into tomcat -->
     645    <copy todir="${basedir}/comms/jakarta/tomcat/webapps/axis">
     646      <fileset dir="${basedir}/comms/soap/axis/webapps/axis"/>
     647    </copy>
     648  </target>
     649
     650  <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files,restart-tomcat"
     651    description="Deploy a SOAP web service for a local Greenstone site">
     652    <java classname="org.apache.axis.client.AdminClient">
     653      <classpath refid="compile.classpath"/>
     654      <arg value="-p"/>
     655      <arg value="${tomcat.port}"/>
     656      <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
     657    </java>   
     658  </target>
     659 
     660  <target name="soap-undeploy-site" depends="get-sitename"
     661    description="Undeploy a SOAP web service for a local Greenstone site">
     662    <java classname="org.apache.axis.client.AdminClient">
     663      <classpath refid="compile.classpath"/>
     664      <arg value="-p"/>
     665      <arg value="${tomcat.port}"/>
     666      <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
     667    </java>
     668  </target>
     669
     670  <target name="deploy-localsite" depends="init">
     671    <antcall target="start-tomcat"/>
     672    <antcall target="soap-deploy-site">
     673      <param name="axis.sitename" value="localsite"/>
     674      <param name="axis.siteuri" value="localsite"/>
     675    </antcall>
     676    <antcall target="stop-tomcat"/>
     677  </target>
     678 
     679  <target name="get-sitename" unless="axis.sitename">
     680    <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
     681  </target>
     682
     683  <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
     684    <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
     685    <echo>${axis.sitename}, ${axis.siteuri}</echo>
     686  </target>
     687  <target name="check-deployment-files" depends="get-sitename">
     688    <condition property="deploy.exists">
     689      <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
     690    </condition>
     691    <condition property="undeploy.exists">
     692      <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
     693    </condition>
     694    <echo>${axis.sitename}, ${deploy.exists}, ${undeploy.exists}</echo>
     695  </target>
     696  <target name="create-deployment-files" depends="get-sitename,check-deployment-files"
     697    if="axis.sitename" unless="deploy.exists">
     698    <filter token="sitename" value="${axis.sitename}"/>
     699    <filter token="siteuri" value="${axis.siteuri}"/>
     700    <copy file="${basedir}/resources/soap/site.wsdd.template"
     701      tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
     702      filtering="true"/>
     703     <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
     704      tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
     705      filtering="true"/>
     706    <!-- create the java files and compile them -->
     707    <copy file="${gsdl3.home}/SOAPServer.java.in"
     708      tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
     709      filtering="true"/>
     710    <javac srcdir="${src.home}"
     711      destdir="${build.home}"
     712      debug="${compile.debug}"
     713      deprecation="${compile.deprecation}"
     714      optimize="${compile.optimize}">
     715      <classpath refid="compile.classpath"/>
     716      <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
     717    </javac>
     718    <jar destfile="${build.home}/gsdl3.jar">
     719      <fileset dir="${build.home}">
     720    <include name="org/greenstone/gsdl3/**"/>
     721    <exclude name="**/Test.class"/>
     722      </fileset>
     723      <manifest>
     724    <attribute name="Built-By" value="${user.name}" />
     725      </manifest>
     726    </jar>
     727    <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
     728    <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
     729  </target>
     730   
     731
     732<!-- ====================== Core targets ============================== -->
     733<!-- core targets refer to the core gsdl3 java src -->
     734 
     735  <target name="prepare-core">
     736    <!-- just get rid of empty directories-->
     737    <cvs command="update -P"/>
     738  </target>
     739  <target name="configure-core"/>
     740  <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
     741    description="Update only the Greenstone core" />
     742 
     743  <target name="cvsupdate-core">
     744    <cvs command="update -l"/>
     745    <cvs command="update -dP bin comms dist-resources docs interfaces lib resources src web winutil"/>
     746  </target>
     747
     748  <target name="clean-core"
     749    description="Clean only the Greenstone core">
     750    <delete dir="${build.home}"/>
     751  </target>
     752
     753   <target name="compile-core"
     754    description="Compile only the Greenstone core">
     755    <mkdir dir="${build.home}"/>
     756    <javac srcdir="${src.home}"
     757      destdir="${build.home}"
     758      debug="${compile.debug}"
     759      deprecation="${compile.deprecation}"
     760      optimize="${compile.optimize}">
     761      <classpath>
     762    <path refid="compile.classpath"/>
     763      </classpath>
     764    </javac>
     765    <jar destfile="${build.home}/gsdl3.jar">
     766      <fileset dir="${build.home}">
     767    <include name="org/greenstone/gsdl3/**"/>
     768    <exclude name="**/Test.class"/>
     769      </fileset>
     770      <manifest>
     771    <attribute name="Built-By" value="${user.name}" />
     772      </manifest>
     773    </jar>
     774    <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
     775    <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
     776    <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
     777    <copy file="${build.home}/org/greenstone/gsdl3/LibraryServlet.class"
     778      todir="${web.classes}/org/greenstone/gsdl3"/>
     779    <jar destfile="${build.home}/phind.jar">
     780      <fileset dir="${build.home}">
     781    <include name="org/greenstone/applet/phind/**"/>
     782      </fileset>
     783      <manifest>
     784    <attribute name="Built-By" value="${user.name}" />
     785      </manifest>
     786    </jar>
     787    <copy file="${build.home}/phind.jar" todir="${javalib}"/>
     788    <copy file="${build.home}/phind.jar" todir="${web.lib}"/>
     789    <jar destfile="${build.home}/anttasks.jar">
     790      <fileset dir="${build.home}">
     791    <include name="org/greenstone/anttasks/**"/>
     792      </fileset>
     793      <manifest>
     794    <attribute name="Built-By" value="${user.name}" />
     795      </manifest>
     796    </jar>
     797    <copy file="${build.home}/anttasks.jar" todir="${javalib}"/>
     798    <jar destfile="${build.home}/gsdl3test.jar">
     799      <fileset dir="${build.home}">
     800    <include name="org/greenstone/gsdl3/**/*Test.class"/>
     801    <include name="org/greenstone/testing/**"/>
     802      </fileset>
     803      <manifest>
     804    <attribute name="Built-By" value="${user.name}" />
     805      </manifest>
     806    </jar>
     807  </target>
     808 
     809<!-- ================== Packages targets ================================ -->
     810  <!-- these targets refer to the greenstone packages - these need updating
     811  less often, so are in  separate targets to the core -->
     812  <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/>
     813 
     814  <target name="prepare-windows" depends="init" if="current.os.iswindows">
     815    <!-- need to download precompiled binaries for mg and mgpp -->
     816  </target>
     817  <target name="prepare-mgpp" depends="check-cvsroot,init" unless="mgpp.present">
     818    <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
     819  </target>
     820
     821  <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
     822    description="Update only the packages"/>
     823
     824  <target name="cvsupdate-packages">
     825    <cvs command="update -dP" dest="${packages.home}"/>
     826  </target>
     827 
     828  <target name="configure-packages" description="Configure only the packages.">
     829    <echo>
     830      Configuring MG
     831    </echo>
     832    <exec executable="configure" os="${os.linux}"
     833      dir="${mg.home}">
     834      <arg value="--prefix=${basedir}"/>
     835    </exec>   
     836    <echo>
     837      Configuring MGPP
     838    </echo>
     839    <exec executable="configure" os="${os.linux}"
     840      dir="${mgpp.home}">
     841      <arg value="--prefix=${basedir}"/>
     842    </exec>
     843  </target>
     844
     845  <target name="clean-packages"
     846    description="Clean only the packages">
     847    <!-- mg : just call the make target -->
     848    <exec executable="make" os="${os.linux}"
     849      dir="${mg.home}">
     850      <arg value="clean"/>
     851    </exec>
     852    <!-- mgpp -->
     853    <exec executable="make" os="${os.linux}"
     854      dir="${mg.home}">
     855      <arg value="clean"/>
     856    </exec>
     857    <!-- vishnu : just call the ant target -->
     858    <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
     859      inheritall="false" target="clean"/>
     860
     861    <!-- gsdl-as : just call the ant target-->
     862    <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
     863      inheritall="false" target="clean"/>
     864  </target>
     865
     866  <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
     867    description="Clean only the C/C++ packages">
     868    <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
     869      <arg value="clean"/>
     870    </exec>
     871    <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
     872      <arg value="clean"/>
     873    </exec>
     874  </target>   
     875
     876  <target name="compile-packages"
     877    description="Compile only the packages">
     878    <echo>Compiling MG</echo>
     879    <exec executable="make" os="${os.linux}"
     880       dir="${mg.home}">
     881    </exec>
     882    <exec executable="make" os="${os.linux}"
     883      dir="${mg.home}">
     884      <arg value="install"/>
     885    </exec>
     886    <!-- windows: just the java stuff. -->
     887    <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
     888      dir="${mg.home}">
     889      <arg value="compile"/>
     890      <arg value="javaonly"/>
     891    </exec>
     892    <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
     893      dir="${mg.home}">
     894      <arg value="install"/>
     895      <arg value="javaonly"/>
     896      <env key="GSDL3HOME" value="${basedir}"/>
     897    </exec>
     898   
     899    <!-- mgpp -->
     900    <echo>Compiling MGPP</echo>
     901    <exec executable="make" os="${os.linux}"
     902       dir="${mgpp.home}">
     903    </exec>
     904    <exec executable="make" os="${os.linux}"
     905      dir="${mgpp.home}">
     906      <arg value="install"/>
     907    </exec>
     908    <!-- windows: just the java stuff. -->
     909    <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
     910      dir="${mgpp.home}">
     911      <arg value="compile"/>
     912      <arg value="javaonly"/>
     913    </exec>
     914    <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
     915      dir="${mgpp.home}">
     916      <arg value="install"/>
     917      <arg value="javaonly"/>
     918      <env key="GSDL3HOME" value="${basedir}"/>
     919    </exec>
     920
     921    <!-- vishnu -->
     922    <echo>Compiling Vishnu</echo>
     923    <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
     924      inheritall="false" target="compile"/>
     925
     926    <!-- gsdl-as -->
     927    <echo>Compiling GSDL-AS</echo>
     928    <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
     929      inheritall="false" target="compile"/>
     930  </target>
     931
     932  <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
     933    description="Compile only the C/C++ packages">
     934    <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/>
     935    <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
     936      <arg value="install"/>
     937      <env key="GSDL3HOME" value="${basedir}"/>
     938    </exec>
     939   <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/>
     940    <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
     941      <arg value="install"/>
     942      <env key="GSDL3HOME" value="${basedir}"/>
     943    </exec>
     944  </target>   
     945 
     946  <!-- ================== gs2building targets ===============-->
     947
     948
     949  <target name="update-gs2building" if="gsdl2.islocal"
     950    depends="init,cvsupdate-gs2building,configure-gs2building,clean-gs2building,compile-gs2building"
     951    description="Update only the Greenstone 2 building components"/>
     952
     953  <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init">
     954    <cvs command="update -dP" dest="${gli.home}"/>
     955    <!-- Note: can't do a -d update here cos it will get all of gsdl
     956     also, an update doesn't get new files, so we do a checkout instead. -->
     957    <cvs command="co gs2build" dest="${basedir}"/>
     958    <!-- rename the .gs2build files - we may have gotten changes to the main
     959    gsdl versions - make sure they are set back to the gs2build versions -->
     960    <antcall target="rename-gs2build-files"/>
     961  </target>
     962
     963  <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
     964    <echo>checking out gs2 building stuff</echo>
     965  </target>
     966
     967  <target name="prepare-gs2build" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gs2build.present">
     968    <echo>checking out gs2build</echo>
     969    <cvs command="checkout -P" package="gs2build"/>
     970
     971    <!-- rename the .gs2build files -->
     972    <antcall target="rename-gs2build-files"/>
     973    <antcall target="unzip-windows-packages"/>
     974    <antcall target="get-windows-binaries"/>
     975  </target>
     976
     977  <target name="get-windows-binaries" depends="init" if="current.os.iswindows">
     978     <cvs command="checkout -P" package="winbin"/>
     979     <copy todir="${basedir}/bin">
     980       <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
     981     </copy>
     982     <move todir="${gs2build.home}/bin/windows" failonerror="false">
     983      <fileset dir="${basedir}/winbin/bin"/>
     984    </move>
     985    <delete dir="${basedir}/winbin"/>
     986   </target>
     987 <target name="unzip-windows-packages" depends="init"> 
     988    <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
     989    dest="${gs2build.home}/packages/windows/gdbm"/>
     990   <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
     991    dest="${gs2build.home}/packages/windows/crypt"/>
     992       <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
     993    dest="${gs2build.home}/packages/windows/expat"/>
     994   </target>
     995
     996  <target name="rename-gs2build-files" depends="rename-gs2build-files-linux,rename-gs2build-files-windows"/>
     997
     998  <target name="rename-gs2build-files-windows" if="current.os.iswindows">
     999    <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
     1000   <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
     1001   <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
     1002   <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
     1003     <filterset>
     1004       <filter token="gsdlhome" value="${gs2build.home}"/>
     1005     </filterset>
     1006    </copy> 
     1007  </target>
     1008  <target name="rename-gs2build-files-linux" if="current.os.islinux">
     1009    <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
     1010    <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>   
     1011    <chmod file="${gs2build.home}/configure" perm="a+x"/>
     1012    <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
     1013    <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/> 
     1014    <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
     1015    <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
     1016    <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
     1017    <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/> 
     1018   
     1019  </target>
     1020  <target name="prepare-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gli.present">
     1021    <echo>checking out gli</echo>
     1022    <cvs command="checkout -P" package="gli"/>
     1023  </target>
     1024   
     1025  <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
     1026    description="Configure only the Greenstone 2 building components">
     1027    <exec executable="${gs2build.home}/configure" os="${os.linux}"
     1028      dir="${gs2build.home}">
     1029      <arg value="--prefix=${gs2build.home}"/>
     1030    </exec>
     1031  </target>
     1032
     1033  <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
     1034    description="Clean only the Greenstone 2 building components">
     1035    <!-- gli -->
     1036    <property name="gli.home" value="${basedir}/gli"/>
     1037    <!-- linux -->
     1038    <exec executable="clean.sh" os="${os.linux}" dir="${gli.home}"
     1039      resolveExecutable="true"/>
     1040    <!-- windows -->
     1041    <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
     1042      resolveExecutable="true"/>
     1043    <!-- gs2build -->
     1044    <!--linux:  -->
     1045    <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
     1046      <arg value="clean"/>
     1047    </exec>
     1048    <!-- windows: -->   
     1049  </target>
     1050   
     1051  <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
     1052    description="remove all object files and executables">
     1053    <!-- run the setup script -->
     1054    <exec executable="${compile.windows.c++.setup}"/>
     1055    <exec executable="nmake" dir="${gs2build.home}">
     1056     <arg value="/f"/>
     1057     <arg value="win32.mak"/>
     1058     <arg value="clean"/>
     1059    </exec>
     1060  </target> 
     1061
     1062  <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
     1063    description="Compile only the Greenstone 2 building components">
     1064    <!-- gli -->
     1065    <property name="gli.home" value="${basedir}/gli"/>
     1066    <!-- linux -->
     1067    <exec executable="makegli.sh" os="${os.linux}" dir="${gli.home}"
     1068      resolveExecutable="true"/>
     1069    <!-- windows -->
     1070    <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
     1071      resolveExecutable="true"/>
     1072    <!-- gs2build -->
     1073    <!--linux: make, make install -->
     1074    <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
     1075    </exec>
     1076    <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
     1077      <arg value="install"/>
     1078    </exec>
     1079  </target>
     1080    <!-- windows: -->
     1081   <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows"
     1082    description="Use this if you want to compile the C++ code for the gs2build package">
     1083    <!-- run the setup script -->
     1084    <exec executable="${compile.windows.c++.setup}"/>
     1085    <exec executable="nmake" dir="${gs2build.home}">
     1086     <arg value="/f"/>
     1087     <arg value="win32.mak"/>
     1088    </exec>
     1089  </target>
     1090  <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
     1091    <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 gsdl3/gli directory.
     1092    </echo>
     1093  </target>
     1094
     1095  <target name="gli-local" depends="init" if="gsdl2.islocal">
     1096    <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux}" dir="${basedir}/gli" spawn="true">
     1097      <env key="GSDLHOME" path="${basedir}/gs2build"/>
     1098      <env key="GSDL3HOME" value="${basedir}"/>
     1099    </exec>
     1100    <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
     1101      <env key="GSDLHOME" value="${basedir}/gs2build"/>
     1102      <env key="GSDL3HOME" value="${basedir}"/>
     1103    </exec>
     1104  </target>
     1105 
     1106  <target name="gli-external" depends="init" unless="gsdl2.islocal">
     1107    <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux}" dir="${gsdl2.installed.path}/gli"/>
     1108    <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli"/>
     1109  </target>
     1110
     1111
     1112<!-- ======================== TESTING Targets ========================= -->
     1113 
     1114  <target name="test" description="Run the (incomplete) JUnit test suite "
     1115    depends="init">
     1116    <mkdir dir="${basedir}/test"/>
     1117    <junit printsummary="withOutAndErr"
     1118      errorproperty="test.failed"
     1119      failureproperty="test.failed"
     1120      fork="${junit.fork}">
     1121      <formatter type="plain"/>
     1122      <classpath>
     1123    <pathelement location="${build.home}/gsdl3test.jar"/>
     1124    <path refid="compile.classpath"/>
     1125      </classpath>
     1126      <test name="${testcase}" if="testcase"/>
     1127      <batchtest todir="${basedir}/test" unless="testcase">
     1128    <fileset dir="${build.home}"
     1129      includes="**/*Test.class"
     1130      />
     1131      </batchtest>
     1132    </junit>
     1133    <echo>
     1134      *********************************************
     1135       Test output can be found in directory 'test'
     1136      *********************************************
     1137    </echo>
     1138  </target>
     1139
     1140
     1141  <target name="reconfigure-server-settings" depends="init,configure-tomcat,configure-files-server"
     1142    description="If you have changed any of the Tomcat properties in the build.properties file, run this target to update the Tomcat configuration, and any Greenstone configuration files that specify the server address">
     1143  </target>
     1144
    491145
    501146</project>
    511147
     1148
Note: See TracChangeset for help on using the changeset viewer.