Index: /release-kits/rk3/ant-scripts/build.xml
===================================================================
--- /release-kits/rk3/ant-scripts/build.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/build.xml	(revision 20335)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+		.......................................................... 
+		August 2009
+		Release Kit for Greenstone3 (rk3)
+		Oran Fry
+		..........................................................
+-->
+
+<project name="rk3-build" default="rk3">
+
+	<!-- CONSTANTS -->
+
+	<!-- for the benefit of the shared scripts, set release-kit home -->
+	<property name="rk.name" value="rk3"/>
+	<property name="rk.home" value="${rk3.home}" />
+
+	<!-- IMPORT OTHER ANT SCRIPTS -->
+	<import file="../core/ant-scripts/init.xml"/>
+	<import file="../core/ant-scripts/operations-on-gli.xml"/>
+	<import file="../greenstone3/ant-scripts/rk3-targets.xml"/>
+
+	<import file="compile.xml"/>
+	<import file="create-distribution.xml"/>
+	<import file="create-installer.xml"/>
+	<import file="wrap.xml"/>
+
+	<!-- THE MAIN TARGET -->
+	<target name="rk3" depends="init,gs3-init">
+		<antcall target="compile"/>
+		<antcall target="create-distribution"/>
+		<ant inheritRefs="true" dir="." antfile="${rk3.home}/ant-scripts/create-components.xml" target="create-components"/>
+		<antcall target="create-installer"/>
+		<antcall target="wrap"/>
+
+	</target>
+
+	<target name="properties">
+		<echo>Required Properties:</echo>
+		<echo>version             the version string for the release</echo>
+		<echo/>
+		<echo>Optional Properties:</echo>
+		<echo>branch.path         the branch of Greenstone3 to make a release of. Eg: tags/2.81. Default: trunk.</echo>
+		<echo>branch.revision     the revision of Greenstone3 to make a release of. Eg: 18273. Default: HEAD.</echo>
+		<echo/>
+	</target>
+
+
+</project>
Index: /release-kits/rk3/ant-scripts/compile.xml
===================================================================
--- /release-kits/rk3/ant-scripts/compile.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/compile.xml	(revision 20335)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk3-compile">
+
+	<target name="compile">
+		<antcall target="checkout-greenstone3"/>
+		<ant dir="compiled" inheritAll="false">
+			<target name="prepare"/>
+			<propertyset refid="forward.properties"/>
+		</ant>
+		<antcall target="greenstone3-set-version-numbers">
+			<param name="greenstone3basedir" value="compiled"/>
+		</antcall>
+		<antcall target="gli-set-version-numbers">
+			<param name="glibasedir" value="compiled/gli"/>
+		</antcall>
+		<antcall target="gsdl-set-version-numbers">
+			<param name="gsdl.basedir" value="compiled/gs2build"/>
+		</antcall>
+		<ant dir="compiled" inheritAll="false">
+			<target name="install"/>
+			<target name="dist-tidy"/>
+			<propertyset refid="forward.properties"/>
+		</ant>
+		<antcall target="insert-xml-parser"/>
+		<antcall target="insert-ant"/>
+		<antcall target="insert-documented-examples"/>
+		<antcall target="compile-uninstaller" />
+		<antcall target="prepare-documentation"/>
+
+		<!-- windows only -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+			<antcall target="insert-windows-perl">
+				<param name="todir" value="compiled/gs2build/bin/windows"/>
+			</antcall>
+			<antcall target="insert-windows-icon"/>
+		</if>
+	</target>
+
+</project>
Index: /release-kits/rk3/ant-scripts/create-components.xml
===================================================================
--- /release-kits/rk3/ant-scripts/create-components.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/create-components.xml	(revision 20335)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk3-create-components">
+
+	<import file="${basedir}/distributions/web/resources/xml/components.xml"/>
+	<import file="${rk.home}/greenstone3/ant-scripts/rk3-targets.xml"/>
+
+	<!-- create components from the distributions folder -->
+
+	<target name="create-components">
+		<antcall target="prepare-components" />
+		<antcall target="compress-components" />
+	</target>
+
+	<target name="prepare-components">
+		<antcall target="prepare-component"><param name="component" value="core"/></antcall>
+		<antcall target="prepare-component"><param name="component" value="tomcat"/></antcall>
+		<antcall target="prepare-component"><param name="component" value="imagemagick"/></antcall>
+		<!-- windows and mac only -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="windows"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
+			<antcall target="prepare-component"><param name="component" value="ghostscript"/></antcall>
+		</if>
+
+	</target>
+
+	<target name="compress-components">
+		<antcall target="compress-component"><param name="component" value="core"/></antcall>
+		<antcall target="compress-component"><param name="component" value="tomcat"/></antcall>
+		<antcall target="compress-component"><param name="component" value="imagemagick"/></antcall>
+		<!-- windows and mac only -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="windows"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
+			<antcall target="compress-component"><param name="component" value="ghostscript"/></antcall>
+		</if>
+	</target>
+
+</project>
Index: /release-kits/rk3/ant-scripts/create-distribution.xml
===================================================================
--- /release-kits/rk3/ant-scripts/create-distribution.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/create-distribution.xml	(revision 20335)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk3-create-distribution">
+	<target name="create-distribution">
+		<!-- create distribution -->
+		<antcall target="copy-compiled-to-dist"/> <!-- from init -->
+		<antcall target="insert-uninstaller"/>
+		<antcall target="clean-user-manual"/>
+		<antcall target="clean-uninstaller"/>
+		<antcall target="strip-svn-dirs"><param name="dir" value="distributions"/></antcall> <!-- from init -->
+
+		<!-- linux only -->
+		<if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+			<!--
+			<antcall target="export-imagemagick-linux-binaries"/>
+			<antcall target="export-wvware-linux-binaries"/>
+			-->
+
+		<!-- mac only -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
+			<antcall target="export-imagemagick-darwin-binaries"/>
+			<antcall target="export-ghostscript-darwin-binaries"/>
+
+		</if></else></if>
+		
+	</target>
+
+    <target name="export-imagemagick-linux-binaries">
+        <delete dir="distributions/web/bin/linux/imagemagick"/>
+        <svn>
+                <export srcurl="${svn.root}/other-projects/trunk/linux-binaries/imagemagick" destPath="distributions/web/gs2build/bin/linux/imagemagick"/>
+        </svn>
+    </target>
+
+    <target name="export-wvware-linux-binaries">
+        <delete dir="distributions/web/bin/linux/wv"/>
+        <svn>
+                <export srcurl="${svn.root}/other-projects/trunk/linux-binaries/wv" destPath="distributions/web/gs2build/bin/linux/wv"/>
+        </svn>
+    </target>
+
+    <target name="export-imagemagick-darwin-binaries">
+        <delete dir="distributions/web/bin/darwin/imagemagick"/>
+        <svn>
+                <export srcurl="${svn.root}/other-projects/trunk/mac-binaries/intel/imagemagick" destPath="distributions/web/gs2build/bin/darwin/imagemagick"/>
+        </svn>
+    </target>
+    
+    <target name="export-ghostscript-darwin-binaries">
+        <delete dir="distributions/web/bin/darwin/ghostscript"/>
+        <svn>
+                <export srcurl="${svn.root}/other-projects/trunk/mac-binaries/intel/ghostscript" destPath="distributions/web/gs2build/bin/darwin/ghostscript"/>
+        </svn>
+    </target>
+
+</project>
Index: /release-kits/rk3/ant-scripts/create-installer.xml
===================================================================
--- /release-kits/rk3/ant-scripts/create-installer.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/create-installer.xml	(revision 20335)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk3-create-installer">
+
+	<target name="create-installer">
+		<antcall target="copy-installer-files"/>
+		<antcall target="make-installer-files-concrete"><param name="java.os" value="linux"/></antcall> <!-- from init -->
+		<antcall target="compile-binary-installer"/> <!-- from init -->
+	</target>
+
+	<target name="copy-installer-files" depends="copy-main-installer-files">
+
+		<!-- the installer descriptors -->
+		<copy todir="installer" file="${rk.home}/greenstone3/installer/antinstall-config.xml" overwrite="true"/>
+		<copy todir="installer" file="${rk.home}/greenstone3/installer/build.xml" overwrite="true"/>
+
+		<!-- the licence -->
+		<copy file="${basedir}/distributions/web/LICENSE.txt" todir="${basedir}/installer/classes" overwrite="true"/>
+
+		<!-- greenstone's ant tasks -->
+		<unjar src="${rk3.home}/core/ant-tasks/greenstone/anttasks.jar" dest="${basedir}/installer/classes"/>
+
+		<!-- windows only -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+			<!-- 7za.exe tool -->
+			<copy todir="${basedir}/installer/classes" overwrite="true" file="${rk3.home}/windows/7za/7za.exe"/>
+
+			<!-- roxes and orangevolt for windows tricks in ant -->
+			<unjar src="${rk3.home}/core/ant-tasks/orangevolt/roxes-win32forjava-1.1.1.jar" dest="${basedir}/installer/classes"/>
+			<unjar src="${rk3.home}/core/ant-tasks/orangevolt/orangevolt-ant-tasks-1.3.8.jar" dest="${basedir}/installer/classes"/>
+
+		<!-- linux and mac only -->
+		<else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
+			<!-- 7zip ant task -->
+			<unjar src="${rk3.home}/core/ant-tasks/7z-ant/7z.jar" dest="${basedir}/installer/classes"/>
+
+		</if></else></if>
+
+		<!-- clean up meta directory -->
+		<delete dir="${basedir}/installer/classes/META-INF"/>
+
+	</target>
+
+</project>
Index: /release-kits/rk3/ant-scripts/wrap.xml
===================================================================
--- /release-kits/rk3/ant-scripts/wrap.xml	(revision 20335)
+++ /release-kits/rk3/ant-scripts/wrap.xml	(revision 20335)
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk3-wrap" default="wrap">
+
+	<target name="wrap">
+		<!-- windows -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+			<antcall target="windows-wrap"/>
+		<!-- linux -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+			<antcall target="linux-wrap"/>
+		<!-- mac -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
+			<antcall target="mac-wrap"/>
+		</if></else></if></else></if>
+
+	</target>
+
+	<target name="linux-wrap">
+		<antcall target="linux-setup-for-wrapping"/>
+		<antcall target="linux-compile-wrapper"/>
+	</target>
+
+	<target name="windows-wrap">
+		<antcall target="windows-copy-files-for-wrapping"/>
+		<antcall target="windows-tweak-files-for-wrapping"/>
+		<antcall target="windows-compile-resources"/>
+		<antcall target="windows-compile-wrapper"/>
+		<antcall target="windows-link-wrapper"/>
+	</target>
+
+
+
+	<target name="linux-setup-for-wrapping">
+
+		<!-- create and setup the build directory -->
+		<mkdir dir="${basedir}/wrapped-installer/build"/>
+		<copy todir="${basedir}/wrapped-installer/build" file="${rk3.home}/linux/wrapper.cpp" overwrite="true" />
+		<copy todir="${basedir}/wrapped-installer/build" file="${rk3.home}/core/search4j/libsearch4j.cpp" overwrite="true" />
+		<copy todir="${basedir}/wrapped-installer/build" file="${rk3.home}/core/search4j/libsearch4j.h" overwrite="true" />
+
+		<!-- copy bundled files -->
+		<copy todir="${basedir}/wrapped-installer/build" file="${rk3.home}/linux/${linux-java.installer}"/>
+		<copy tofile="${basedir}/wrapped-installer/build/greenstone3.jar" file="${basedir}/installer/Greenstone-${version}-${os.suffix}.jar"/>
+
+		<!-- substitute the real java installer filename and min version into various files -->
+		<rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.installer@" replacement="${linux-java.installer}"/>
+		<rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@installer.name@" replacement="greenstone3"/>
+		<rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.extracted@" replacement="${linux-java.extracted}"/>
+		<rsr file="${basedir}/wrapped-installer/build/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
+
+	</target>
+
+	<target name="linux-compile-wrapper">
+		<mkdir dir="products"/>
+		<echo level="info">create an object file (extension .o) for each file to bundle</echo>
+		<exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
+			<arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar greenstone3.jar.o"/>
+		</exec>
+		<exec executable="/usr/bin/objcopy" dir="${basedir}/wrapped-installer/build">
+			<arg line="-I binary -O elf32-i386 -B i386 --redefine-sym _binary_${linux-java.installer}_start=java --readonly-text ${linux-java.installer} java.o"/>
+		</exec>
+
+		<!-- get size of greenstone.jar -->
+		<exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="greenstone3.jar.ls"><arg line="-l greenstone3.jar"/></exec>
+		<exec executable="sed" inputstring="${greenstone3.jar.ls}" outputproperty="greenstone3.jar.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
+
+		<!-- get size of java -->
+		<exec executable="ls" dir="${basedir}/wrapped-installer/build" outputproperty="java.ls"><arg line="-l ${linux-java.installer}"/></exec>
+		<exec executable="sed" inputstring="${java.ls}" outputproperty="java.size"><arg line="-e 's/^[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *[^\ ]*\ *\([0-9]*\).*$/\1/g'"/></exec>
+
+		<echo level="info">compile libsearch4j</echo>
+		<exec executable="g++" dir="${basedir}/wrapped-installer/build">
+			<arg line="-Wall -static -static-libgcc -c -o libsearch4j.o libsearch4j.cpp"/>
+		</exec>
+
+		<echo level="info">creating the header file for bundled java version</echo>
+		<delete file="wrapper.h"/>
+		<exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h"><arg line="extern const char greenstone3jar[${greenstone3.jar.size}];"/></exec>
+		<exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="extern const char java[${java.size}];"/></exec>
+		<exec executable="echo" output="${basedir}/wrapped-installer/build/wrapper.h" append="true"><arg line="#define java_is_bundled yes"/></exec>
+
+		<echo level="info">recompile the wrapper program</echo>
+		<exec executable="g++" dir="${basedir}/wrapped-installer/build">
+			<arg line="-Wall -static -static-libgcc -c -o wrapper.o wrapper.cpp"/>
+		</exec>
+
+		<echo level="info">relink, bundling the files to be bundled</echo>
+		<exec executable="g++" dir="${basedir}/wrapped-installer/build">
+			<arg line="-static -static-libgcc -o  ../../products/Greenstone-${version}-${os.suffix} wrapper.o libsearch4j.o greenstone3.jar.o java.o"/>
+		</exec>
+
+	</target>
+
+	<target name="windows-copy-files-for-wrapping">
+		<echo>Copying wrapper source files</echo>
+		<mkdir dir="${basedir}/wrapped-installer"/>
+		<copy todir="${basedir}/wrapped-installer" file="${rk3.home}/windows/wrapper/wrapper.cpp"/>
+		<copy todir="${basedir}/wrapped-installer" file="${rk3.home}/core/search4j/libsearch4j.cpp"/>
+		<copy todir="${basedir}/wrapped-installer" file="${rk3.home}/core/search4j/libsearch4j.h"/>
+	</target>
+	
+	<target name="windows-tweak-files-for-wrapping">
+		<echo>Substituting concrete values into source files</echo>
+		<rsr file="${basedir}/wrapped-installer/wrapper.cpp" pattern="@java.min.version@" replacement="${java.min.version}"/>
+		<rsr file="${basedir}/wrapped-installer/wrapper.cpp" pattern="@java.installer@" replacement="${windows-java.installer}"/>
+		<rsr file="${basedir}/wrapped-installer/wrapper.cpp" pattern="@java.extracted@" replacement="${windows-java.extracted}"/>
+		<rsr file="${basedir}/wrapped-installer/wrapper.cpp" pattern="@bundled.version.java@" replacement="${bundled.version.windows-java}"/>
+	</target>
+
+	<target name="windows-compile-resources">
+		<if>
+			<bool>
+				<not>
+					<uptodate targetfile="${basedir}/wrapped-installer/wrapper.RES">
+						<srcfiles dir="${rk3.home}/greenstone3/icon" includes="icon.ico"/>
+						<srcfiles dir="${rk3.home}/windows/wrapper" includes="${windows-java.installer}"/>
+						<srcfiles dir="${rk3.home}/windows/wrapper" includes="*.bmp"/>
+						<srcfiles dir="${rk3.home}/windows/wrapper" includes="*.rc"/>
+						<srcfiles dir="${rk3.home}/greenstone3/wrapper" includes="*.bmp"/>
+						<srcfiles dir="${basedir}/installer" includes="Greenstone-${version}-win32.jar"/>
+					</uptodate>
+				</not>
+			</bool>
+			
+			<echo>Compiling resources</echo>
+			
+			<echo>getting the template resource script</echo>
+			<copy todir="${basedir}/wrapped-installer" file="${rk3.home}/windows/wrapper/wrapper.rc" overwrite="true"/>
+			
+			<echo>copying the small resource files into place</echo>
+			<copy todir="${basedir}/wrapped-installer">
+				<fileset dir="${rk3.home}/windows/wrapper" includes="*.bmp"/>
+				<fileset dir="${rk3.home}/greenstone3/wrapper" includes="*.bmp"/>
+				<fileset dir="${rk3.home}/greenstone3/icon" includes="icon.ico"/>
+			</copy>
+			
+			<echo>adding greenstone3.jar to the resource script as chunks</echo>
+			<rsplit
+				resource="${basedir}/installer/Greenstone-${version}-win32.jar"
+				outputDir="${basedir}/wrapped-installer"
+				resourceScript="${basedir}/wrapped-installer/wrapper.rc"
+				resourceName="JAR"
+				resourceType="JAR"
+				chunkSize="${resources.chunksize}"
+				/>
+			
+			<echo>adding ${windows-java.installer} to the copy as chunks</echo>
+			<rsplit
+				resource="${rk3.home}/windows/wrapper/${windows-java.installer}"
+				outputDir="${basedir}/wrapped-installer"					
+				resourceScript="${basedir}/wrapped-installer/wrapper.rc"
+				resourceName="JAVA"
+				resourceType="EXE"
+				chunkSize="${resources.chunksize}"
+				/>
+
+			<echo>resource compiling the generated resource script</echo>
+			<exec executable="rc" dir="${basedir}/wrapped-installer">
+				<arg line="wrapper.rc"/>
+			</exec>
+			
+			<else>
+				<echo>Resourses are up-to-date, will not compile</echo>
+			</else>
+		</if>
+	</target>
+
+	<target name="windows-compile-wrapper">
+		<exec executable="cl" dir="${basedir}/wrapped-installer">
+			<arg line="/c -GX /DWINDOWS=yes libsearch4j.cpp /out:libsearch4j.obj"/>
+		</exec>
+		<exec executable="cl" dir="${basedir}/wrapped-installer">
+			<arg line="/c -GX /DWINDOWS=yes /DWEB wrapper.cpp /out:wrapper.obj"/>
+		</exec>
+	</target>
+
+	<target name="windows-link-wrapper">
+		<mkdir dir="products"/>
+		<exec executable="link" dir="${basedir}/wrapped-installer">
+			<arg line="/OUT:..\products\Greenstone-${version}-win32.exe gdi32.lib advapi32.lib shell32.lib user32.lib libsearch4j.obj wrapper.obj wrapper.res"/>
+		</exec>
+	</target>
+
+
+</project>
Index: /release-kits/rk3/bin/rk3
===================================================================
--- /release-kits/rk3/bin/rk3	(revision 20335)
+++ /release-kits/rk3/bin/rk3	(revision 20335)
@@ -0,0 +1,5 @@
+#!/bin/bash
+export rk_name="rk3"
+export rk_fullname="Release Kit for Greenstone3"
+export RK_HOME=$RK3_HOME
+$RK3_HOME/linux/rk $*
Index: /release-kits/rk3/build.xml
===================================================================
--- /release-kits/rk3/build.xml	(revision 20335)
+++ /release-kits/rk3/build.xml	(revision 20335)
@@ -0,0 +1,17 @@
+<project name="rk3-compile" default="compile">
+
+	<target name="compile">
+		<ant dir="core"/>
+		<!--
+		compile c++ code for launching rk3
+		<exec executable="cl" dir="bin">
+			<arg value="-GX"/>
+			<arg value="/DXXX=3"/>
+			<arg value="..\windows\rk.cpp"/>
+			<arg value="-o"/><arg value="rk3.exe"/>
+		</exec>
+		<delete file="bin/rk.obj"/>
+		-->
+	</target>
+
+</project>
Index: /release-kits/rk3/setup.bat
===================================================================
--- /release-kits/rk3/setup.bat	(revision 20335)
+++ /release-kits/rk3/setup.bat	(revision 20335)
@@ -0,0 +1,16 @@
+@echo off
+
+pushd %~dp0
+
+if not "%RK3_HOME%" == "" goto already
+set RK3_HOME=%CD%
+set ANT_HOME=%RK3_HOME%\core\ant
+set PATH=%RK3_HOME%\bin;%ANT_HOME%\bin;%PATH%
+echo Done
+goto end
+
+:already
+echo rk3 environment already set up
+
+:end
+popd
Index: /release-kits/rk3/setup.sh
===================================================================
--- /release-kits/rk3/setup.sh	(revision 20335)
+++ /release-kits/rk3/setup.sh	(revision 20335)
@@ -0,0 +1,8 @@
+if [ "$RK3_HOME" != "" ]; then
+	echo "rk3 envorinment already set up"
+else
+	home_possibly_relative=`dirname ${BASH_SOURCE:-$0}`
+	export RK3_HOME="`cd $home_possibly_relative && pwd`"
+	export PATH=$RK3_HOME/bin:$PATH
+fi
+
