Index: main/trunk/release-kits/kits/rk2/ant-scripts/build.xml
===================================================================
--- main/trunk/release-kits/kits/rk2/ant-scripts/build.xml	(revision 21388)
+++ main/trunk/release-kits/kits/rk2/ant-scripts/build.xml	(revision 21394)
@@ -10,14 +10,8 @@
 <project name="rk2-build" default="rk2">
 
-	<!-- CONSTANTS -->
-
-	<!-- for the benefit of the shared scripts, set release-kit home -->
-	<property name="rk.name" value="rk2"/>
-	<property name="rk.home" value="${rk2.home}" />
-
 	<!-- IMPORT OTHER ANT SCRIPTS -->
-	<import file="../../../shared/core/ant-scripts/init.xml"/>
-	<import file="../../../shared/core/ant-scripts/operations-on-gli.xml"/>
-	<import file="../../../shared/greenstone2/ant-scripts/rk2-targets.xml"/>
+	<import file="${rk.home}/shared/core/ant-scripts/init.xml"/>
+	<import file="${rk.home}/shared/core/ant-scripts/operations-on-gli.xml"/>
+	<import file="${rk.home}/shared/greenstone2/ant-scripts/rk2-targets.xml"/>
 
 	<import file="compile.xml"/>
@@ -31,12 +25,5 @@
 
 	<!-- THE MAIN TARGET -->
-	<target name="rk2" depends="init,gs2-init">
-		<antcall target="compile"/>
-		<antcall target="create-distribution"/>
-		<antcall target="create-components"/>
-		<antcall target="create-installer"/>
-		<antcall target="wrap"/>
-		<antcall target="create-cdrom-components"/>
-	</target>
+	<target name="rk2" depends="init,gs2-init,compile,create-distribution,create-components,create-installer,wrap,create-cdrom-components"/>
 
 	<target name="properties">
@@ -50,3 +37,120 @@
 	</target>
 
+	<!-- TODO: Move the targets below to the xml file that calls it -->
+	<target name="checkout-gsdl-gli">
+		<exec executable="svn">
+			<arg value="checkout"/>
+			<arg value="${svn.root}/main/${branch.path}/greenstone2"/>
+			<arg value="${basedir}/compiled"/>
+		</exec>
+                <exec executable="svn">
+			<arg value="checkout"/>
+			<arg value="${svn.root}/main/${branch.path}/gli"/>
+			<arg value="${basedir}/compiled/gli"/>
+		</exec>
+	</target>
+
+	<target name="insert-export-to-cd-package">
+		<mkdir dir="${gsdl.basedir}/bin/windows"/>
+		<get src="${server.exe.location}" dest="${gsdl.basedir}/bin/windows/server.exe"/>
+		<get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="${gsdl.basedir}/bin/windows/Setup.exe"/>
+		<get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="${gsdl.basedir}/bin/windows/gssetup.exe"/>
+	</target>
+
+	<target name="create-binary-zip-unix">
+		<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>
+
+		<!-- delete sourcecode -->
+		<delete dir="${binzip.dir}/common-src"/>
+		<delete dir="${binzip.dir}/build-src"/>
+		<delete dir="${binzip.dir}/runtime-src"/>
+
+		<!-- delete loose files -->
+		<delete>
+			<fileset
+				dir="${binzip.dir}"
+				includes="README*.txt,Uninstall.sh,uninst.jar,acconfig.h,aclocal.m4,config.guess,config.sub,configtest.pl,configure,configure.in,install-sh,Makefile.in,micotest.cpp,config.h.in"
+				excludes="READMEen.txt"/>
+		</delete>
+
+	</target>
+
+	<target name="create-binary-zip-windows">
+		<property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
+		<copy todir="${binzip.dir}">
+			<fileset dir="distributions/web"/>
+		</copy>
+
+		<!-- delete sourcecode -->
+		<delete dir="${binzip.dir}/common-src"/>
+		<delete dir="${binzip.dir}/build-src"/>
+		<delete dir="${binzip.dir}/runtime-src"/>
+
+		<!-- delete loose files -->
+		<delete>
+			<fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/>
+		</delete>
+	</target>
+
+	<target name="dist-clean-sourcecode">
+
+		<!-- delete the 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"/>
+		<delete>
+			<fileset dir="distributions/web" includes="Install.txt,acconfig.h,aclocal.m4,config.guess,config.sub,configtest.pl,configure,configure.in,install-sh,Makefile.in,micotest.cpp,config.h.in,win32.mak,win32cfg.h"/>
+		</delete>
+
+       	</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="compile-gli">
+
+		<if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
+			<property name="script.format" value="sh"/>
+		<else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+			<property name="script.format" value="bat"/>
+		</if></else></if>
+		
+		<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>
+
+	<target name="copy-greenstone2-installer-files">
+		<!-- the installer descriptors -->
+		<copy todir="installer" file="${rk.home}/kits/rk2/installer/antinstall-config.xml" overwrite="true"/>
+		<copy todir="installer" file="${rk.home}/kits/rk2/installer/installer/build.xml" overwrite="true"/>
+	</target>
+
 </project>
