Index: greenstone3/trunk/build.xml
===================================================================
--- greenstone3/trunk/build.xml	(revision 19843)
+++ greenstone3/trunk/build.xml	(revision 19871)
@@ -62,6 +62,6 @@
   <property name="src.packages.home" value="${basedir}/src/packages"/>
   <!-- get rid of one of these -->
-  <property name="gdbm.home" value="${gs2build.home}/common-src/packages/gdbm"/>
-  <property name="gdbm.installed.path" value="${gs2build.home}/common-src/packages/gdbm"/>  
+ <!-- <property name="gdbm.home" value="${gs2build.home}/common-src/packages/gdbm"/>
+  <property name="gdbm.installed.path" value="${gs2build.home}/common-src/packages/gdbm"/>  -->
   <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
   <property file="build.properties"/>
@@ -160,4 +160,7 @@
     </not>
   </condition>
+  <condition property="collection.building.disabled">
+    <isset property="disable.collection.building"/>
+  </condition>
 
   <condition property="collection.building.enabled.windows">
@@ -175,7 +178,7 @@
   </condition>
   
-  <condition property="independent-indexers">
+<!--  <condition property="independent-indexers">
     <isset property="disable.collection.building"/>
-  </condition>
+  </condition>-->
 
   <!-- where is search4j tool -->
@@ -187,5 +190,5 @@
   
   <!-- ============= Base dirs for each package and component ============ -->
-  <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
+<!--  <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"/>
@@ -193,8 +196,15 @@
   <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
   
-  <condition property="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}/common-src/indexers">
+  </condition>-->
+  
+<!--  <condition property="indexers.home" value="${gs2build.home}/common-src/indexers">
+    <not>
+      <isset property="disable.collection.building"/>
+    </not>
+  </condition>-->
+
+  <condition property="common.src.home" value="${gs2build.home}/common-src">
     <not>
       <isset property="disable.collection.building"/>
@@ -202,7 +212,12 @@
   </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"/>
+  <condition property="common.src.home" value="${basedir}/common-src">
+    <isset property="disable.collection.building"/>
+  </condition>
+
+  <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
+  <property name="mg.home" value="${common.src.home}/indexers/mg"/>
+  <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
+  <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
 
   <!--  ==================== Compilation Control Options ==================== -->
@@ -316,12 +331,15 @@
   </target>
 
-  <target name="new-install" depends="init,install-collection-building,install-runtime"
+  <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
+  <target name="new-install" depends="init,install-common-src,install-collection-building,install-runtime"
     description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
 
+  <target name="install-common-src" depends="init,configure-common-src,compile-common-src"/>
   <target name="install-collection-building" depends="init,configure-collection-building,compile-collection-building"/>
   <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core"/>
   
    
-  <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile" 
+<!--  <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile" -->
+  <target name="install" depends="init,configure,configure-c++,compile" 
     description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
   
@@ -1124,7 +1142,7 @@
   <!-- 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="nosvn.mode">
+  <target name="prepare-packages" depends="init"/>
+  
+<!--  <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nosvn.mode">
     <svn>
       <checkout url="${svn.root}/indexers/${branch.path}" destPath="${src.packages.home}/indexers" revision="${branch.revision}"/>
@@ -1134,5 +1152,5 @@
   <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
     <antcall target="checkout-indexers"/>
-  </target>
+  </target> -->
 
   <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
@@ -1145,5 +1163,6 @@
   </target>
   
-  <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers" 
+<!--  <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers" add common-src here instead.-->
+  <target name="configure-packages" depends="init,configure-javagdbm" 
     description="Configure only the packages."/>
   
@@ -1165,14 +1184,14 @@
   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" 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}"/>
+      <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> -->
+
+  <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
 
   <target name="clean-javagdbm" depends="init">
@@ -1183,5 +1202,5 @@
   </target>
   
-  <target name="clean-indexers" depends="init" if="independent-indexers">
+<!--  <target name="clean-indexers" depends="init" if="independent-indexers">
     <exec executable="make" os="${os.unix}"
       dir="${indexers.home}">
@@ -1192,7 +1211,7 @@
       <arg value="clean"/>
     </exec>
-  </target>
-
-  <target name="distclean-packages" depends="init,distclean-javagdbm,distclean-indexers" description="Distclean only the packages"/>
+  </target> -->
+
+  <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
 
   <target name="distclean-javagdbm" depends="init">
@@ -1203,5 +1222,5 @@
   </target>
   
-  <target name="distclean-indexers" depends="init" if="independent-indexers">
+<!--  <target name="distclean-indexers" depends="init" if="independent-indexers">
     <exec executable="make" os="${os.unix}"
       dir="${indexers.home}">
@@ -1212,5 +1231,5 @@
       <arg value="clean"/>
     </exec>
-  </target>
+  </target>-->
   
   <target name="compile-packages" description="Compile only the source packages">
@@ -1241,5 +1260,5 @@
 
     <!-- this may be in gs2build - we will be recompiling, but never mind -->
-    <echo>Indexers: make (from ${indexers.home})</echo>
+<!--    <echo>Indexers: make (from ${indexers.home})</echo>
     <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
     <echo>Indexers: make install</echo>
@@ -1256,11 +1275,11 @@
       <arg value="install"/>
     </exec>
-
+-->
     <!-- install the jar and jni files -->
-    <echo>Install the indexers' jar and jni files</echo>
+  <!--  <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"/>
+    <antcall target="install-jni-files"/>-->
   </target>
 
@@ -1282,4 +1301,10 @@
   </target>
 
+  <target name="install-auxiliary-jar-files" depends="init">
+    <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}"/>    
+  </target>
+  
   <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
 
@@ -1309,8 +1334,75 @@
   </target>
   
+  <!-- ========common-src targets =================================-->
+  <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
+  collection building is not enabled -->
+
+  <target name="update-common-src" depends="init" if="collection.building.disabled">
+  </target>
+  <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
+    <svn>
+      <update dir="{common.src.home}" revision="${branch.revision}"/>
+    </svn>    
+  </target>
+
+  <target name="prepare-common-src" depends="init" if="collection.building.disabled">
+    <antcall target="checkout-common-src"/>
+    <antcall target="unzip-windows-packages"/>
+  </target>
+
+  <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
+    <echo>checking out common-src</echo>
+    <svn>
+      <checkout url="${svn.root}/gsdl/common-src" destPath="common-src" revision="${branch.revision}"/>
+    </svn>
+  </target>
+    
+  <target name="configure-common-src" depends="init" if="collection.building.disabled">
+    <exec executable="${common.src.home}/configure" os="${os.unix}"
+      dir="${common.src.home}">
+      <arg value="--prefix=${common.src.home}"/> <!-- ??? -->
+    </exec>
+  </target>
+
+  <target name="clean-common-src" depends="init" if="collection.building.disabled">
+    <!-- unix:  -->
+    <exec executable="make" os="${os.unix}" dir="${common.src.home}">
+      <arg value="clean"/>
+    </exec>
+    <!-- windows: -->    
+    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" >
+      <arg value="/f"/>
+      <arg value="win32.mak"/>
+      <arg value="clean"/>
+    </exec>
+  </target>
+  <target name="distclean-common-src" depends="init" if="collection.building.disabled">
+    <exec executable="make" os="${os.unix}" dir="${common.src.home}">
+      <arg value="distclean"/>
+    </exec>
+  </target>
+  <target name="compile-common-src" depends="init" if="collection.building.disabled">
+    <!-- unix: -->
+    <exec executable="make" os="${os.unix}" dir="${common.src.home}">
+    </exec>
+    <exec executable="make" os="${os.unix}" dir="${common.src.home}">
+      <arg value="install"/>
+    </exec>
+    <!-- windows: -->
+    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}">
+      <arg value="/f"/>
+      <arg value="win32.mak"/>
+    </exec>
+    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}">
+      <arg value="/f"/>
+      <arg value="win32.mak"/>
+      <arg value="install"/>
+    </exec>
+  </target>
+  
   <!-- ======= collection-building targets ===========================-->
 
   <target name="update-collection-building" if="collection.building.enabled" 
-    depends="init,svnupdate-collection-building,rename-gs2build-files,configure-collection-building,clean-collection-building,compile-collection-building"
+    depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-collection-building,clean-collection-building,compile-collection-building"
     description="Update (SVN update, configure, compile etc) only the collection building components"/>
 
@@ -1393,14 +1485,14 @@
     <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
       <env key="gsdl3path" path="${basedir}"/>
-      <env key="gsdlpath" path="${basedir}/gs2build"/>
+      <env key="gsdlpath" path="${gs2build.home}"/>
     </exec>
     <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
       <env key="gsdl3path" path="${basedir}"/>
-      <env key="gsdlpath" path="${basedir}/gs2build"/>
+      <env key="gsdlpath" path="${gs2build.home}"/>
       <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
     </exec>
     <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
       <env key="GSDL3PATH" path="${basedir}"/>
-      <env key="GSDLPATH" path="${basedir}/gs2build"/>
+      <env key="GSDLPATH" path="${gs2build.home}"/>
     </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 gli.sh/bat from the greenstone3/gli directory.
@@ -1423,5 +1515,5 @@
     <antcall target="get-windows-binaries"/>
     <antcall target="delete-winbin"/>
-    <antcall target="get-macos-extra"/>
+    <!--<antcall target="get-macos-extra"/>-->
   </target>
 
@@ -1456,50 +1548,25 @@
   </target>
   
-  <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">  
-    <unzip src="${gs2build.home}/common-src/packages/windows/crypt/crypt.zip"
-      dest="${gs2build.home}/common-src/packages/windows/crypt"/>
-    <unzip src="${gs2build.home}/common-src/packages/windows/expat/expat.zip"
-      dest="${gs2build.home}/common-src/packages/windows/expat"/>
+  <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">  
+    <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
+      dest="${common.src.home}/packages/windows/crypt"/>
+    <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
+      dest="${common.src.home}/packages/windows/expat"/>
     <untar compression="gzip" 
-      src="${gs2build.home}/common-src/packages/sqlite/${sqlite.targz.version}"
-      dest="${gs2build.home}/common-src/packages/sqlite"/>
-    <unzip src="${gs2build.home}/common-src/indexers/packages/windows/iconv/iconv.zip"
-      dest="${gs2build.home}/common-src/indexers/packages/windows/iconv"/>
-  </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"/>
-      -->
-    <echo>Nothing extra currently needed for MacOS prepare</echo>
-  </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"/>
-    -->
-    <echo>Nothing extra currently needed for MacOs install</echo>
-  </target>
-
-  <target name="install-indexer-files" depends="init" unless="indexers.present">
+      src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
+      dest="${common.src.home}/packages/sqlite"/>
+    <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
+      dest="${common.src.home}/indexers/packages/windows/iconv"/>
+  </target>
+  
+
+<!--  <target name="install-indexer-files" depends="init" unless="indexers.present">
     <copy todir="${indexers.home}">
       <fileset dir="${gs2build.home}/common-src/indexers" />
     </copy>
     <chmod file="${indexers.home}/configure" perm="a+x"/>
-  </target>
-
-  <target name="rename-gs2build-files" depends="gs2build-edit-setup-bat" if="collection.building.enabled"/>
+  </target> -->
+
+<!--  <target name="rename-gs2build-files" depends="gs2build-edit-setup-bat" if="collection.building.enabled"/>-->
   
   <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
@@ -1518,13 +1585,9 @@
  
   <target name="clean-gs2build" depends="init" if="collection.building.enabled">
-    <!-- gs2build -->
-    <!--linux:  -->
+    <!-- unix:  -->
     <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
       <arg value="clean"/>
     </exec>
     <!-- windows: -->    
-    <!-- run the setup script -->
-    <!--<exec executable="${compile.windows.c++.setup}" os="${os.windows}" />-->
-    <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant--> 
     <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}" >
       <arg value="/f"/>
@@ -1535,5 +1598,5 @@
   
 
-  <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
+  <target name="distclean-gs2build" depends="init,clean-gs2build" if="collection.building.enabled">
     <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
       <arg value="distclean"/>
@@ -1565,5 +1628,5 @@
     <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
     <antcall target="install-gs2build-indexers-windows"/>
-    <antcall target="install-macos-extra"/>
+    <!--<antcall target="install-macos-extra"/>-->
   </target>
   
