Index: /release-kits/lirk2/ant-scripts/compile.xml
===================================================================
--- /release-kits/lirk2/ant-scripts/compile.xml	(revision 18928)
+++ /release-kits/lirk2/ant-scripts/compile.xml	(revision 18929)
@@ -6,6 +6,8 @@
 		<!-- checkout -->
 		<antcall target="checkout-gsdl-gli" />
+		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
 		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
-		
+		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
+
 		<!-- configure -->
 		<antcall target="add-static-to-configure-in"/>
@@ -13,4 +15,10 @@
 		<antcall target="run-configure"/>
 		<antcall target="makefiles-add-static"/>
+
+		<!-- make common-src and reconfigure -->
+		<!-- this is a workaround to a problem with the gsdl build code -->
+		<!-- expat needs to be compiled before the perl XML Parser is configured -->
+		<antcall target="make-common-src"/>
+		<antcall target="run-configure"/>
 
 		<!-- make -->
@@ -20,17 +28,17 @@
 		<antcall target="strip-execs"/>
 
+		<!-- gli -->
+		<antcall target="compile-gli">
+			<param name="script.format"  value="sh"/>
+			<param name="glibasedir"  value="${basedir}/compiled/gli"/>
+			<param name="gsdlbasedir" value="${basedir}/compiled"/>
+		</antcall>
+
 		<!-- uninstaller -->
-		<antcall target="compile-uninstaller" /> <!-- from rk2-targets -->
+		<antcall target="compile-uninstaller" /> <!-- from init -->
 
 		<!-- build collections -->
 		<antcall target="build-demo-collection" />
 
-	</target>
-
-	<target name="checkout-gsdl-gli">
-		<svn>
-			<checkout url="${svn.root}/gsdl/${branch.path}" destPath="${basedir}/compiled"/>
-			<checkout url="${svn.root}/gli/${branch.path}" destPath="${basedir}/compiled/gli"/>
-		</svn>
 	</target>
 
@@ -104,4 +112,3 @@
 
 
-
 </project>
Index: /release-kits/lirk2/ant-scripts/create-distribution.xml
===================================================================
--- /release-kits/lirk2/ant-scripts/create-distribution.xml	(revision 18928)
+++ /release-kits/lirk2/ant-scripts/create-distribution.xml	(revision 18929)
@@ -4,17 +4,15 @@
 	<target name="create-distribution">
 
-		<antcall target="export-gsdl-gli"><param name="dest" value="distributions/web"/></antcall>
-		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="distributions/web"/></antcall>
-		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/distributions/web"/></antcall>
-		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/distributions/web/gli"/></antcall>
+		<antcall target="copy-compiled-to-dist"/> <!-- from init -->
+		<antcall target="dist-clean-sourcecode"/> <!-- from rk2-targets -->
+		<antcall target="dist-unzip-packages"/> <!-- from rk2-targets -->
+		<antcall target="insert-export-to-cd-package"><param name="gsdl.basedir" value="distributions/web"/></antcall> <!-- from rk2-targets -->
 		<antcall target="insert-uninstaller"><param name="script-format" value="sh"/></antcall> <!-- from rk2-targets -->
-		<antcall target="dist-unzip-packages"/>
-		<antcall target="drop-in-demo-collection" />
-		<antcall target="insert-export-to-cd-package"><param name="gsdl.basedir" value="distributions/web"/></antcall> <!-- from rk2-targets -->
-		<antcall target="drop-in-binaries" />
-		<antcall target="export-imagemagick-linux-binaries" />
-		<antcall target="export-wvware-linux-binaries" />
-		<antcall target="compile-gli" />
+
+		<antcall target="export-imagemagick-linux-binaries"/>
+		<antcall target="export-wvware-linux-binaries"/>
+		
 		<antcall target="remove-unneeded-files" />
+		<antcall target="strip-svn-dirs"><param name="dir" value="${basedir}/distributions/web"/></antcall>
 		<antcall target="create-needed-empty-files"><param name="gsdl.basedir" value="distributions/web"/></antcall>
 
@@ -58,34 +56,14 @@
 	</target>
 
-	<target name="compile-gli">
-		<echo>Compiling gli...</echo>
-		<exec dir="${basedir}/distributions/web/gli" executable="${basedir}/distributions/web/gli/makegli.sh"/>
-
-		<echo>Creating jar...</echo>
-		<exec dir="${basedir}/distributions/web/gli" executable="${basedir}/distributions/web/gli/makejar.sh"/>
-
-		<echo>Cleaning up intermediate files...</echo>
-		<delete dir="${basedir}/distributions/web/gli/jar"/>
-		<delete dir="${basedir}/distributions/web/gli/classes/org"/>
-
-		<echo>Putting gli server jar in a better place</echo>
-		<exec dir="${basedir}/distributions/web" executable="mv" failonerror="true">
-			<arg line="gli/GLIServer.jar bin/java" />
-		</exec>
-	</target>
-
-	<target name="dist-unzip-packages">
-		<untar src="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/distributions/web/common-src/packages/sqlite" compression="gzip"/>
-		<delete file="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz"/>
-	</target>
-
-
 	<target name="remove-unneeded-files">
+		<delete dir="${basedir}/distributions/web/uninstaller" />
+		<delete dir="${basedir}/distributions/web/autom4te.cache" />
 		<delete file="${basedir}/distributions/web/gli/.greenstonestore" />
-		<delete><fileset dir="${basedir}/distributions/web" includes="win32.mak,win32cfg.h,Install.sh,Support.htm"/></delete>
+		<delete><fileset dir="${basedir}/distributions/web" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
 		<delete file="${basedir}/distributions/web/bin/java/SignedGatherer.jar" />
 		<delete><fileset dir="${basedir}/distributions/web/gli" includes="*.bat"/></delete>
 		<delete><fileset dir="${basedir}/distributions/web" includes="*.bat"/></delete>
 		<delete dir="${basedir}/distributions/web/common-src/packages/windows"/>
+		<delete dir="${basedir}/distributions/web/common-src/indexers/packages/windows"/>
 	</target>
 
Index: /release-kits/lirk2/resources/build-demo.sh
===================================================================
--- /release-kits/lirk2/resources/build-demo.sh	(revision 18928)
+++ /release-kits/lirk2/resources/build-demo.sh	(revision 18929)
@@ -1,5 +1,7 @@
-. setup.bash
-import.pl --removeold demo
-buildcol.pl --removeold demo
-rm -rf collect/demo/index
+#!/bin/bash
+source setup.bash
+import.pl --removeold demo && \
+buildcol.pl --removeold demo && \
+rm -rf collect/demo/index collect/demo/archives && \
 mv collect/demo/building collect/demo/index
+
Index: /release-kits/mark2/ant-scripts/compile.xml
===================================================================
--- /release-kits/mark2/ant-scripts/compile.xml	(revision 18928)
+++ /release-kits/mark2/ant-scripts/compile.xml	(revision 18929)
@@ -6,9 +6,17 @@
 		<!-- checkout -->
 		<antcall target="checkout-gsdl-gli" />
+		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
 		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
+		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
 		
 		<!-- configure -->
 		<antcall target="run-configure"/>
 		<antcall target="tweak-makefiles"/>
+
+		<!-- make common-src and reconfigure -->
+		<!-- this is a workaround to a problem with the gsdl build code -->
+		<!-- expat needs to be compiled before the perl XML Parser is configured -->
+		<antcall target="make-common-src"/>
+		<antcall target="run-configure"/>
 
 		<!-- make -->
@@ -18,4 +26,11 @@
 		<antcall target="strip-execs"/>
 
+		<!-- gli -->
+		<antcall target="compile-gli">
+			<param name="script.format"  value="sh"/>
+			<param name="glibasedir"  value="${basedir}/compiled/gli"/>
+			<param name="gsdlbasedir" value="${basedir}/compiled"/>
+		</antcall>
+
 		<!-- uninstaller -->
 		<antcall target="compile-uninstaller" /> <!-- from rk2-targets -->
@@ -24,11 +39,4 @@
 		<antcall target="build-demo-collection" />
 
-	</target>
-
-	<target name="checkout-gsdl-gli">
-		<svn javahl="false">
-			<checkout url="${svn.root}/gsdl/${branch.path}" destPath="${basedir}/compiled"/>
-			<checkout url="${svn.root}/gli/${branch.path}" destPath="${basedir}/compiled/gli"/>
-		</svn>
 	</target>
 
Index: /release-kits/mark2/ant-scripts/create-distribution.xml
===================================================================
--- /release-kits/mark2/ant-scripts/create-distribution.xml	(revision 18928)
+++ /release-kits/mark2/ant-scripts/create-distribution.xml	(revision 18929)
@@ -4,17 +4,15 @@
 	<target name="create-distribution">
 
-		<antcall target="export-gsdl-gli"><param name="dest" value="distributions/web"/></antcall>
-		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="distributions/web"/></antcall>
-		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/distributions/web"/></antcall>
-		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/distributions/web/gli"/></antcall>
+		<antcall target="copy-compiled-to-dist"/> <!-- from init -->
+		<antcall target="dist-clean-sourcecode"/> <!-- from rk2-targets -->
+		<antcall target="dist-unzip-packages"/> <!-- from rk2-targets -->
+		<antcall target="insert-export-to-cd-package"><param name="gsdl.basedir" value="distributions/web"/></antcall> <!-- from rk2-targets -->
 		<antcall target="insert-uninstaller"><param name="script-format" value="sh"/></antcall> <!-- from rk2-targets -->
-		<antcall target="dist-unzip-packages"/>
-		<antcall target="drop-in-binaries" />
-		<antcall target="drop-in-demo-collection" />
-		<antcall target="insert-export-to-cd-package"><param name="gsdl.basedir" value="distributions/web"/></antcall> <!-- from rk2-targets -->
+
 		<antcall target="export-imagemagick-darwin-binaries" />
 		<antcall target="export-ghostscript-darwin-binaries" />
-		<antcall target="compile-gli" />
-		<antcall target="remove-unneeded-files" />
+
+		<antcall target="remove-unneeded-files"/>
+		<antcall target="strip-svn-dirs"><param name="dir" value="${basedir}/distributions/web"/></antcall>
 		<antcall target="create-needed-empty-files"><param name="gsdl.basedir" value="distributions/web"/></antcall>
 
@@ -75,11 +73,6 @@
 	</target>
 
-	<target name="dist-unzip-packages">
-		<untar src="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/distributions/web/common-src/packages/sqlite" compression="gzip"/>
-		<delete file="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz"/>
-	</target>
-
-
 	<target name="remove-unneeded-files">
+		<delete dir="${basedir}/distributions/web/uninstaller" />
 		<delete file="${basedir}/distributions/web/gli/.greenstonestore" />
 		<delete><fileset dir="${basedir}/distributions/web" includes="win32.mak,win32cfg.h,Install.sh,Support.htm"/></delete>
Index: /release-kits/mark2/resources/build-demo.sh
===================================================================
--- /release-kits/mark2/resources/build-demo.sh	(revision 18928)
+++ /release-kits/mark2/resources/build-demo.sh	(revision 18929)
@@ -1,5 +1,7 @@
-. setup.bash
-import.pl --removeold demo
-buildcol.pl --removeold demo
-rm -rf collect/demo/index
+#!/bin/bash
+source setup.bash
+import.pl --removeold demo && \
+buildcol.pl --removeold demo && \
+rm -rf collect/demo/index collect/demo/archives && \
 mv collect/demo/building collect/demo/index
+
Index: /release-kits/shared/ant-scripts/init.xml
===================================================================
--- /release-kits/shared/ant-scripts/init.xml	(revision 18928)
+++ /release-kits/shared/ant-scripts/init.xml	(revision 18929)
@@ -359,5 +359,5 @@
 		<!-- jar it all up -->
 		<jar
-			destfile="${basedir}/compiled/uninstaller/uninst.jar"
+			destfile="${basedir}/compiled/uninst.jar"
 			manifest="${rk.home}/uninstaller/manifest.mf"
 			basedir="${basedir}/compiled/uninstaller/build" />
@@ -365,7 +365,6 @@
 	</target>
 
-	<!-- copy the uninstaller from the compiled directory to web distribution -->
+	<!-- copy the uninstaller script from the rk to web distribution -->
 	<target name="insert-uninstaller">
-		<copy file="compiled/uninstaller/uninst.jar" todir="distributions/web" />
 		<copy file="${rk.home}/uninstaller/Uninstall.${script-format}" todir="distributions/web" />
 	</target>
@@ -391,5 +390,9 @@
 		<unzip src="${rk.home}/windows/perl.zip" dest="${gsdl.basedir}/bin/windows"/>
 	</target>
-
+	<target name="copy-compiled-to-dist">
+		<delete dir="distributions/web"/>
+		<mkdir dir="distributions"/>
+		<exec executable="cp"><arg line="-r compiled distributions/web"/></exec>
+	</target>
 
 </project>
Index: /release-kits/shared/greenstone2/ant-scripts/rk2-targets.xml
===================================================================
--- /release-kits/shared/greenstone2/ant-scripts/rk2-targets.xml	(revision 18928)
+++ /release-kits/shared/greenstone2/ant-scripts/rk2-targets.xml	(revision 18929)
@@ -97,4 +97,6 @@
 	<target name="create-binary-zip-linux">
 		<property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
+
+		<delete dir="${binzip.dir}"/>
 		<exec dir="${basedir}" executable="cp"><arg line="-r distributions/web ${binzip.dir}"/></exec>
 
@@ -137,4 +139,60 @@
 	</target>
 
+	<target name="dist-clean-sourcecode">
+		<delete>
+			<fileset dir="distributions/web" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/>
+		</delete>
+		<delete dir="distributions/web/common-src"/>
+		<delete dir="distributions/web/build-src"/>
+		<delete dir="distributions/web/runtime-src"/>
+		<svn>
+			<export srcurl="${svn.root}/gsdl/${branch.path}/common-src" destPath="distributions/web/common-src"/>
+			<export srcurl="${svn.root}/gsdl/${branch.path}/build-src" destPath="distributions/web/build-src"/>
+			<export srcurl="${svn.root}/gsdl/${branch.path}/runtime-src" destPath="distributions/web/runtime-src"/>
+		</svn>
+	</target>
+
+	<target name="dist-unzip-packages">
+		<untar src="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/distributions/web/common-src/packages/sqlite" compression="gzip"/>
+		<delete file="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz"/>
+	</target>
+
+	<target name="make-common-src">
+		<exec dir="${basedir}/compiled/common-src" executable="make" failonerror="true"/>
+		<exec dir="${basedir}/compiled/common-src" executable="make" failonerror="true"><arg value="install"/></exec>
+	</target>
+
+	<target name="checkout-gsdl-gli">
+		<svn>
+			<checkout url="${svn.root}/gsdl/${branch.path}" destPath="${basedir}/compiled"/>
+			<checkout url="${svn.root}/gli/${branch.path}" destPath="${basedir}/compiled/gli"/>
+		</svn>
+	</target>
+
+	<target name="compile-gli">
+
+		<!-- default to sh -->
+		<property name="script.format" value="sh"/>
+		
+		<echo>Compiling gli...</echo>
+		<exec dir="${glibasedir}" executable="${glibasedir}/makegli.${script.format}"/>
+
+		<echo>Creating jar...</echo>
+		<exec dir="${glibasedir}" executable="${glibasedir}/makejar.${script.format}"/>
+
+		<echo>Cleaning up intermediate files...</echo>
+		<delete dir="${glibasedir}/jar"/>
+		<delete dir="${glibasedir}/classes/org"/>
+
+		<if><bool><isset property="gsdlbasedir"/></bool>
+			<echo>Putting gli server jar in a better place</echo>
+			<exec executable="mv" failonerror="true">
+				<arg line="${glibasedir}/GLIServer.jar ${gsdlbasedir}/bin/java" />
+			</exec>
+		</if>
+
+	</target>
+
+
 </project>
 	
Index: /release-kits/wirk2/ant-scripts/compile.xml
===================================================================
--- /release-kits/wirk2/ant-scripts/compile.xml	(revision 18928)
+++ /release-kits/wirk2/ant-scripts/compile.xml	(revision 18929)
@@ -4,10 +4,23 @@
 	<target name="compile">
 		<antcall target="checkout-gsdl-gli" />
+		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
 		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
+		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
+
 		<antcall target="unzip-packages" />
 		<antcall target="get-winbin" />
 		<antcall target="insert-windows-perl"><param name="gsdl.basedir" value="compiled"/></antcall>
 		<antcall target="compile-c-code" />
-		<antcall target="compile-uninstaller" /> <!-- from rk2-targets -->
+
+		<!-- gli -->
+		<antcall target="compile-gli">
+			<param name="script.format" value="bat"/>
+			<param name="glibasedir"  value="${basedir}/compiled/gli"/>
+			<param name="gsdlbasedir" value="${basedir}/compiled"/>
+		</antcall>
+
+		<!-- uninstaller -->
+		<antcall target="compile-uninstaller" /> <!-- from init -->
+
 		<antcall target="build-demo-collection" />
 	</target>
Index: /release-kits/wirk2/ant-scripts/create-distribution.xml
===================================================================
--- /release-kits/wirk2/ant-scripts/create-distribution.xml	(revision 18928)
+++ /release-kits/wirk2/ant-scripts/create-distribution.xml	(revision 18929)
@@ -4,16 +4,13 @@
 	<target name="create-distribution">
 
-		<antcall target="export-gsdl-gli"><param name="dest" value="distributions/web"/></antcall>
-		<antcall target="drop-in-docs"><param name="gsdl.basedir" value="distributions/web"/></antcall>
-		<antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/distributions/web"/></antcall>
-		<antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/distributions/web/gli"/></antcall>
+		<antcall target="copy-compiled-to-dist"/> <!-- from init -->
+		<antcall target="dist-clean-sourcecode"/> <!-- from rk2-targets -->
+		
 		<antcall target="insert-uninstaller"><param name="script-format" value="bat"/></antcall> <!-- from rk2-targets -->
 		<antcall target="dist-unzip-packages"/>
-		<antcall target="drop-in-binaries" />
-		<antcall target="drop-in-demo-collection" />
-		<!--Don't need because server.exe takes care of the gsdlhome path now-->
-		<!--<antcall target="drop-in-misc" />-->
-		<antcall target="compile-gli" />
+		<antcall target="copy-server"/>
+		
 		<antcall target="remove-unneeded-files" />
+		<antcall target="strip-svn-dirs"><param name="dir" value="${basedir}/distributions/web"/></antcall>
 		<antcall target="create-needed-empty-files"><param name="gsdl.basedir" value="distributions/web"/></antcall>
 
@@ -22,47 +19,6 @@
 	</target>
 
-	<target name="drop-in-binaries">
-		<echo level="info">Dropping compiled binaries into distribution</echo>
-		<delete dir="${basedir}/distributions/web/bin/windows" />
-		<copy todir="${basedir}/distributions/web/bin/windows">
-			<fileset dir="${basedir}/compiled/bin/windows" includes="**/*"/>
-		</copy>
-		<copy todir="distributions/web" file="compiled/bin/windows/server.exe"/>
-		<copy todir="distributions/web/cgi-bin/library" file="compiled/cgi-bin/library.cgi"/>
-		<copy todir="distributions/web/cgi-bin/oaiserver" file="compiled/cgi-bin/oaiserver.cgi"/>
-		
-		<echo level="info">Dropping LuceneWrapper.jar in place</echo>
-		<copy file="${basedir}/compiled/bin/java/LuceneWrapper.jar" todir="${basedir}/distributions/web/bin/java" />
-	</target>
-
-	<target name="drop-in-demo-collection">
-		<echo level="info">Dropping rebuilt demo collection into distribution</echo>
-		<delete dir="${basedir}/distributions/web/collect/demo" />
-		<copy todir="${basedir}/distributions/web/collect/demo">
-			<fileset dir="${basedir}/compiled/collect/demo" includes="**/*"/>
-		</copy>
-	</target>
-
-	<target name="drop-in-misc">
-		<echo level="info">Putting the default llssite.cfg at the root of the distribution</echo>
-		<copy todir="${basedir}/distributions/web" file="${wirk2.home}/resources/llssite.cfg" overwrite="true"/>
-	</target>
-	
-	<target name="compile-gli">
-		<echo>Compiling gli...</echo>
-		<exec dir="${basedir}/distributions/web/gli" executable="${basedir}/distributions/web/gli/makegli.bat"/>
-		
-		<echo>Creating jar...</echo>
-		<exec dir="${basedir}/distributions/web/gli" executable="${basedir}/distributions/web/gli/makejar.bat"/>
-		
-		<echo>Cleaning up intermediate files...</echo>
-		<delete dir="${basedir}/distributions/web/gli/jar"/>
-		<delete dir="${basedir}/distributions/web/gli/classes/org"/>
-		
-		<echo>Putting gli server jar in a better place</echo>
-		<move file="${basedir}/distributions/web/gli/GLIServer.jar" todir="${basedir}/distributions/web/bin/java" />
-	</target>
-
 	<target name="remove-unneeded-files">
+		<delete dir="distributions/web/uninstaller"/>
 		<delete file="${basedir}/distributions/web/gli/.greenstonestore" />
 		<delete dir="${basedir}/distributions/web/bin/linux" />
@@ -91,4 +47,8 @@
 		<delete file="${basedir}/distributions/web/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz"/>
 	</target>
+
+	<target name="copy-server">
+		<copy file="distributions/web/bin/windows/server.exe" tofile="distributions/web/server.exe"/>
+	</target>
 	
 </project>
