Index: /main/trunk/release-kits/kits/rk2/ant-scripts/elcapitan-compile.xml
===================================================================
--- /main/trunk/release-kits/kits/rk2/ant-scripts/elcapitan-compile.xml	(revision 32010)
+++ /main/trunk/release-kits/kits/rk2/ant-scripts/elcapitan-compile.xml	(revision 32010)
@@ -0,0 +1,597 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="rk2-compile">
+
+	<target name="compile" depends="init,gs2-init">
+	<!-- checkout greenstone2 (or gsdl if a pre-2.84 release is being created) and gli -->
+		<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+			<exec executable="svn">
+				<arg value="checkout"/>
+				<arg value="${svn.root}/main/${branch.path}/greenstone2"/>
+				<arg value="${basedir}/compiled"/>
+			</exec>		  
+			<else>
+				<exec executable="svn">
+					<arg value="checkout"/>
+					<arg value="${svn.root}/main/${branch.path}/gsdl"/>
+					<arg value="${basedir}/compiled"/>
+				</exec>
+			</else>
+		</if>
+		
+		<exec executable="svn">
+			<arg value="checkout"/>
+			<arg value="${svn.root}/main/${branch.path}/gli"/>
+			<arg value="${basedir}/compiled/gli"/>
+		</exec>
+
+		<!-- drop in documentation -->
+		<copy todir="compiled" overwrite="true">
+			<fileset dir="${rk.home}/shared/greenstone2/docs" excludes="READMEar.txt,READMEes.txt,READMEfr.txt,READMEru.txt"/>
+		</copy>
+
+		<!-- set version numbers -->
+		<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>
+
+		<!-- we do not want the *.app folders if we are not mac-->
+		<if><bool><not><equals arg1="${rk.os}" arg2="mac"/></not></bool>
+			<delete dir="${basedir}/compiled/client-gli.app"/>
+			<delete dir="${basedir}/compiled/gems.app"/>
+			<delete dir="${basedir}/compiled/gs2-server.app"/>
+			<delete dir="${basedir}/compiled/gli.app"/>
+		</if>
+
+		<!-- mac or linux: get the support library -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
+			<!-- svn export the gnome support library extension-->
+
+			<!-- For Lions, need a specific gnome-lib-minimal tar file. The file name contains darwin12 for Lion, it contains the shell.name (darwin/linux) for other cases.
+				Mac OS X v10.7.4 onwards is Lion/Mountain Lion, different from Leopard/Snow Leopard. See http://en.wikipedia.org/wiki/Darwin_(operating_system) -->
+			<!--<condition property="specific.os.type" value="${os.shell}-Lion" else="${os.shell}">-->
+			<condition property="specific.os.type" value="${os.shell}-Lion" else="${os.shell}-ElCapitan">
+				<and>
+					<contains string="${os.shell}" substring="darwin" casesensitive="false"/>
+					<matches pattern="^(10\.7\.[4-9]|10\.[8-9]|1[1-9]|[2-9])" string="${os.version}"/>
+				</and>
+			</condition>
+
+			<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+				<echo>EXPORTING GNOME LIB EXTENSION</echo>
+				<exec executable="svn">
+					<arg value="export"/>
+					<arg value="${svn.root}/gs2-extensions/gnome-lib/trunk/gnome-lib-minimal-${specific.os.type}${arch}${extension-x64}.tar.gz"/>
+					<arg value="${basedir}/compiled/ext/gnome-lib-minimal-${specific.os.type}.tar.gz"/>
+				</exec>
+
+				<exec executable="tar" dir="${basedir}/compiled/ext">
+					<arg value="xvzf"/>
+					<arg value="gnome-lib-minimal-${specific.os.type}.tar.gz"/>
+				</exec>
+
+				<exec executable="/bin/bash" dir="${basedir}/compiled/ext/gnome-lib-minimal">
+					<arg value="-c"/>
+					<arg value="source setup.bash_old &amp;&amp; source devel.bash"/>
+				</exec>
+				
+				<echo>DONE EXTRACTING GNOME LIB EXTENSION</echo>
+			</if>
+		</if>
+
+		<if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
+			<!-- LD_LIBRARY_PATH is DYLD_LIBRARY_PATH on mac-->
+			<if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
+				<property name="libpathvar" value="DYLD_LIBRARY_PATH"/>
+			<else>
+				<property name="libpathvar" value="LD_LIBRARY_PATH"/>
+			</else>
+			</if>
+
+			<property name="gnome.lib.dir" value="${basedir}/compiled/ext/gnome-lib-minimal/${os.shell}"/>
+			<property name="path.arg" value="PATH=&quot;${gnome.lib.dir}/bin:${env.PATH}&quot;"/>
+			<property name="cflags.arg" value="CFLAGS=&quot;-I${gnome.lib.dir}/include&quot;"/>
+			<property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome.lib.dir}/include&quot;"/>
+			<property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome.lib.dir}/include&quot;"/>
+			<property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome.lib.dir}/lib&quot;"/>
+			<property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome.lib.dir}/lib/pkgconfig&quot;"/>
+			<property name="ldlpath.arg" value="${libpathvar}=&quot;${gnome.lib.dir}/lib&quot;"/>
+
+			<property name="allargs" value="${path.arg} ${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${pcpath.arg} ${ldlpath.arg}"/>
+		</if>	
+		
+		<!-- windows only -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+
+			<!-- unzip packages -->
+			<unzip src="${basedir}/compiled/common-src/packages/windows/crypt/crypt.zip" dest="${basedir}/compiled/common-src/packages/windows/crypt"/>
+			
+			<!-- unzip expat if the version is less that 2.84 -->
+			<if><bool><equals arg1="${post.2.83.version}" arg2="false"/></bool>
+				<unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
+			</if>
+			
+			<unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
+			<unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
+			<untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-autoconf-3070602.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
+
+			<!-- get winbin from tags if the version is greater than 2.83 otherwise get it from trunk -->
+			<if><bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
+				<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+					
+					<exec executable="svn">
+						<arg value="export"/>
+						<arg value="${svn.root}/main/${branch.path}/binaries/windows/bin"/>
+						<arg value="${basedir}/compiled/bin/windows"/>
+						<arg value="-r"/>
+						<arg value="${branch.revision}"/>
+					</exec>
+					
+					<else>
+						<exec executable="svn">
+							<arg value="export"/>
+							<arg value="${svn.root}/main/trunk/binaries/windows/bin"/>
+							<arg value="${basedir}/compiled/bin/windows"/>
+							<arg value="-r"/>
+							<arg value="${branch.revision}"/>
+						</exec>
+					</else>
+				</if>
+			</if>
+
+			<!-- insert windows perl -->
+			<unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/bin/windows"/>
+			
+			<exec executable="${basedir}/compiled/bin/windows/gunzip.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
+				<arg value="-d"/>
+				<arg value="httpd-2.2.11-gs.tar.gz"/>
+			</exec>
+				
+			<exec executable="${basedir}/compiled/bin/windows/tar.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
+				<arg value="-xvf"/>
+				<arg value="httpd-2.2.11-gs.tar"/>
+			</exec>
+			
+			<!-- Insert a unique number after every occurrence of the word tempfile to prevent some strange race conditions present on Windows 7 (iuv = InsertUniqueValue) -->
+			<iuv>
+				<fileset dir="${basedir}/compiled/runtime-src/packages/apache-httpd/httpd-2.2.11" includes="**/*.mak"/> 
+	 	        <job pattern="tempfile"/> 
+			</iuv>
+			
+			<!-- compile c code -->
+			<exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
+			<exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
+			<exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
+			<delete><fileset dir="${basedir}/compiled/apache-httpd" includes="**/*.pdb"/></delete>
+
+			<copy file="${rk.home}/shared/windows/Microsoft.VC80.CRT.manifest" tofile="${basedir}/compiled/apache-httpd/windows/bin/Microsoft.VC80.CRT.manifest"/>
+			<copy file="${rk.home}/shared/windows/Microsoft.VC80.CRT.manifest" tofile="${basedir}/compiled/apache-httpd/windows/lib/Microsoft.VC80.CRT.manifest"/>
+			<copy file="${rk.home}/shared/windows/Microsoft.VC80.CRT.manifest" tofile="${basedir}/compiled/apache-httpd/windows/modules/Microsoft.VC80.CRT.manifest"/>
+			<copy file="${rk.home}/shared/windows/msvcr80.dll" tofile="${basedir}/compiled/apache-httpd/windows/bin/msvcr80.dll"/>
+			<copy file="${rk.home}/shared/windows/msvcr80.dll" tofile="${basedir}/compiled/apache-httpd/windows/lib/msvcr80.dll"/>
+			<copy file="${rk.home}/shared/windows/msvcr80.dll" tofile="${basedir}/compiled/apache-httpd/windows/modules/msvcr80.dll"/>
+			
+			<mkdir dir="products"/>
+			<copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}${version-extra}.exe"/>
+			<move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
+
+
+		<!-- linux only -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+			<!-- add static to configure.in -->
+			<rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
+			<exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
+				<arg value="configure.in"/>
+			</exec>
+
+			<!-- set environment in packages/configure -->
+			<rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
+			<rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
+
+			<!-- run configure -->
+			<exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
+				<arg line="--enable-apache-httpd --disable-wvware"/>
+			</exec>
+
+			<exec executable="tar" dir="${basedir}/compiled/build-src/packages/wv">
+				<arg value="xvzf"/>
+				<arg value="wv-1.2.4-gs.tar.gz"/>
+			</exec>
+				
+			<exec dir="${basedir}/compiled/build-src/packages/wv/wv-gs" executable="${basedir}/compiled/build-src/packages/wv/wv-gs/configure" failonerror="true">
+			  	<arg line="--prefix=${basedir}/compiled/build-src/packages/wv --bindir=${basedir}/compiled/bin/linux --libdir=${basedir}/compiled/lib/linux --datadir=${basedir}/compiled/etc/packages --disable-shared --enable-static"/>
+				<arg line="${allargs}"/>
+			</exec>
+
+			<!-- add -static to makefiles -->
+			<rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
+			<rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
+			<rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
+
+		<!-- mac only -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
+			<!-- run configure -->
+			<exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
+				<arg line="--enable-apache-httpd"/>
+				<arg line="${allargs}"/>
+			</exec>
+
+			<!-- tweak makefiles -->
+			<rsr file="${basedir}/compiled/runtime-src/src/recpt/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
+			<rsr file="${basedir}/compiled/runtime-src/src/oaiservr/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
+
+		</if></else></if></else></if>
+
+		<!-- mac and linux: compile -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
+			<!-- make -->
+			<exec dir="${basedir}/compiled" executable="make" failonerror="true">
+				<arg line="${ldlpath.arg}"/>
+			</exec>
+
+			<!-- make install -->
+			<exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
+
+			<!-- make apache-for-dist -->
+			<exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
+
+			<if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+				<exec dir="${basedir}/compiled/build-src/packages/wv/wv-gs" executable="make" failonerror="true">
+					<arg line="${ldlpath.arg}"/>
+				</exec>
+				<exec dir="${basedir}/compiled/build-src/packages/wv/wv-gs" executable="make" failonerror="true"><arg value="install"/></exec>
+			</if>
+
+			<!-- strip executables -->
+			<exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
+				<arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
+			</exec>
+			
+			<!-- the libsqlite3.dylib is no longer compatible with Macs from Maverick/Yosemite/El Capitan onwards, so 10.9, 10.10, 10.11, 
+			     but also future versions of darwin, like anything that is version 11+, so major version numbers that are 2 digits or beyond) -->
+			<if><bool>
+			    <and>
+			      <contains string="${os.shell}" substring="darwin" casesensitive="false"/>
+			      <not><matches pattern="^(10\.9|10\.[1-9][0-9]|1[1-9]|[2-9][0-9])" string="${os.version}"/></not><!--all darwin before Maverick/10.9-->
+			    </and>			    
+			  </bool>
+			  <copy todir="${basedir}/compiled/lib/${os.shell}">
+			    <fileset dir="${basedir}/compiled/common-src/packages/sqlite/lib" includes="*.dylib"/>
+			  </copy>
+			</if>
+
+			<!-- for 64 bit need to copy in the statically compiled IsisGdl -->
+			<!--<delete file="${basedir}/compiled/bin/${os.shell}/IsisGdl"/>-->
+			<get src="http://www.greenstone.org/caveat-emptor/IsisGdl.macleopard" dest="${basedir}/compiled/bin/${os.shell}/IsisGdl"/>
+			<!--<move file="${basedir}/compiled/bin/${os.shell}/IsisGdl.bin32" tofile="${basedir}/compiled/bin/${os.shell}/IsisGdl"/>-->
+			<chmod perm="755" file="${basedir}/compiled/bin/${os.shell}/IsisGdl"/>
+		</if>
+
+		<!-- Delete all but the lib folder and the setup.bash script of the gnome support library -->
+		<if><bool><and>
+		  <not><equals arg1="${keep.src}" arg2="true"/></not>
+		  <or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or>
+		</and></bool>
+			<delete dir="${basedir}/compiled/ext/gnome-lib-minimal/${os.shell}/bin"/>
+			<delete dir="${basedir}/compiled/ext/gnome-lib-minimal/${os.shell}/include"/>
+			<delete file="${basedir}/compiled/ext/gnome-lib-minimal/setup.bat"/>
+			<delete file="${basedir}/compiled/ext/gnome-lib-minimal/devel.bash"/>
+			<delete file="${basedir}/compiled/ext/gnome-lib-minimal-${os.shell}.tar.gz"/>
+		</if>
+
+		<!-- insert the necessary additional xml parser versions-->
+		<if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+			<!-- Add the 5.6 version if necessary -->
+			<if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.6"/></not></bool>
+				<copy todir="${basedir}/compiled/perllib/cpan">
+					<fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.6,perl-5.6/**/*"/>
+				</copy>
+			</if>
+			
+			<!-- Add the 5.8 version if necessary -->
+			<if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.8"/></not></bool>
+				<copy todir="${basedir}/compiled/perllib/cpan">
+					<fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.8,perl-5.8/**/*"/>
+				</copy>
+			</if>
+			
+			<!-- Add the 5.8 mutlithreaded version if necessary -->
+			<if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.8-mt"/></not></bool>
+				<copy todir="${basedir}/compiled/perllib/cpan">
+					<fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.8-mt,perl-5.8-mt/**/*"/>
+				</copy>
+			</if>
+			
+			<!-- Add the 5.10 version if necessary -->
+			<if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.10"/></not></bool>
+				<copy todir="${basedir}/compiled/perllib/cpan">
+					<fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.10,perl-5.10/**/*"/>
+				</copy>
+			</if>
+
+			<!-- Add the 5.14 version if necessary -->
+			<if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.14"/></not></bool>
+				<copy todir="${basedir}/compiled/perllib/cpan">
+					<fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.14,perl-5.14/**/*"/>
+				</copy>
+			</if>
+		</if>
+
+		<!-- compile gli -->
+		<!-- (linux and mac) -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
+			<exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
+			<exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
+		<!-- windows -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+			<exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
+			<exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
+		</if></else></if>
+
+		<if><bool><not><equals arg1="${keep.src}" arg2="true"/></not></bool>
+		  <delete dir="compiled/gli/jar"/>
+		  <delete dir="compiled/gli/classes/org"/>
+		</if>
+		<move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
+
+		<!-- compile uninstaller -->
+		<antcall target="insert-and-compile-uninstaller" />
+
+		<!-- delete the source code -->
+		<if><bool><not><equals arg1="${keep.src}" arg2="true"/></not></bool>		
+		  <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
+		  <delete dir="compiled/common-src"/>
+		  <delete dir="compiled/build-src"/>
+		  <delete dir="compiled/runtime-src"/>
+		  <delete><fileset dir="compiled" 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,lib/**/*.a"/></delete>
+		</if>
+
+		<!-- strip .svn working-copy dirs -->
+		<antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
+
+		<!-- create needed empty files -->
+		<mkdir dir="compiled/tmp"/>
+		<chmod dir="compiled/tmp" perm="a+rwx"/>
+		<echo file="compiled/etc/usage.txt"></echo>
+
+		<!-- scripts to compile GS2 are not needed in the binary -->
+		<delete file="compiled/makegs2.bat"/>
+		<delete file="compiled/makegs2x64.bat"/>
+		<delete file="compiled/makegs2.sh"/>
+
+		<!-- windows -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
+
+			<!-- make a copy of server.exe in the root -->
+			<copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
+
+			<!-- delete sourcecode -->
+			<delete dir="${binzip.dir}/common-src"/>
+			<delete dir="${binzip.dir}/build-src"/>
+			<delete dir="${binzip.dir}/runtime-src"/>
+			
+			<!-- create simple zipped binary distribution 
+			<mkdir dir="distributions"/>
+			<property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
+			<copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
+			<delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
+			-->
+
+			<!-- delete unneeded files -->
+			<delete dir="compiled/bin/linux" />
+<!--
+    Actually, leaving these in is helpful for running a cross-platform 
+    Pure JAVA install
+			<delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc,makegs2.bat"/></delete>
+			<delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
+
+-->
+			<delete><fileset dir="compiled/gli" includes="*4gs3.bat"/></delete>
+			<delete dir="compiled/autom4te.cache" />
+
+		<!-- linux -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
+
+			<!-- grab imagemagick and wv (if less than 2.84) binaries -->
+			<delete dir="compiled/bin/linux/imagemagick"/>
+
+			<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+				<!--<if><bool><equals arg1="${x64}" arg2="true"/></bool>-->
+					<exec executable="svn">
+					        <arg value="export"/>
+					        <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-linux${extension-x64}.tar.gz"/>
+					        <arg value="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
+				        </exec>
+
+					<exec executable="tar" dir="compiled/ext">
+					        <arg value="xvzf"/>
+						<arg value="imagemagick-linux${extension-x64}.tar.gz"/>
+					</exec>
+					<delete file="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
+					<move todir="compiled/bin/linux/imagemagick">
+						<fileset dir="compiled/ext/imagemagick/linux"/>
+					</move>
+				<!--<else>
+				        <exec executable="svn">
+					        <arg value="export"/>
+						<arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
+						<arg value="compiled/bin/linux/imagemagick"/>
+					</exec>
+				</else>
+				</if>-->
+				<else>
+					<delete dir="compiled/bin/linux/wv"/>	
+					<exec executable="svn">
+						<arg value="export"/>
+						<arg value="${svn.root}/main/trunk/binaries/linux/imagemagick"/>
+						<arg value="compiled/bin/linux/imagemagick"/>
+					</exec>
+
+					<exec executable="svn">
+						<arg value="export"/>
+						<arg value="${svn.root}/main/trunk/binaries/linux/wv"/>
+						<arg value="compiled/bin/linux/wv"/>
+					</exec>
+				</else>
+			</if>
+
+			<!-- delete unneeded files -->
+			<delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
+<!--
+  Actually useful to keep these files around for a Pure Java install
+			<delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
+			<delete><fileset dir="compiled" includes="*.bat"/></delete>
+-->
+			<delete dir="compiled/common-src/packages/windows"/>
+			<delete dir="compiled/common-src/indexers/packages/windows"/>
+
+		<!-- mac -->
+		<else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
+			<!-- grab imagemagick and ghostscript binaries -->
+			<delete dir="compiled/bin/darwin/imagemagick"/>
+			<delete dir="compiled/bin/darwin/ghostscript"/>
+
+			<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+
+                    <!--<exec executable="svn">
+                       <arg value="export"/>
+                       <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.5.tar.gz"/>
+                       <arg value="compiled/ext/imagemagick-darwin-10.5.tar.gz"/>
+                    </exec>
+
+                    <exec executable="tar" dir="compiled/ext">
+                       <arg value="xvzf"/>
+                       <arg value="imagemagick-darwin-10.5.tar.gz"/>
+                    </exec>
+                    <delete file="compiled/ext/imagemagick-darwin-10.5.tar.gz"/>
+                    <move todir="compiled/bin/darwin/imagemagick">
+                       <fileset dir="compiled/ext/imagemagick/darwin"/>
+                    </move>-->
+
+			<!-- grab imagemagick binaries for El Capitan -->
+			<!-- Grab the imagemagick compiled on an XWindows-less darwin 10.11 (El Capitan)
+			     but where it was made backwards compatible with 10.8 (Mountain Lion) with mmacosx-version-min flag.
+			     Upto and including the gs3.08 release this code still referred to imagemagick-darwin-10.5.tar.gz  -->
+			<exec executable="svn">
+			  <arg value="export"/>
+			  <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.11.tar.gz"/>
+			  <arg value="compiled/ext/imagemagick-darwin-10.11.tar.gz"/>
+			</exec>
+			
+			<exec executable="tar" dir="compiled/ext">
+			  <arg value="xvzf"/>
+			  <arg value="imagemagick-darwin-10.11.tar.gz"/>
+			</exec>
+			<delete file="compiled/ext/imagemagick-darwin-10.11.tar.gz"/>
+			<move todir="compiled/bin/darwin/imagemagick">
+			  <fileset dir="compiled/ext/imagemagick/darwin"/>
+			</move>
+
+			<!-- No more use for the decompressed ext/imagemagick folder, as it contains only setup scripts
+			     that end up referring to the (empty) ext/imagemagick in the environment.
+			     On sourcing GS2's setup script, these env vars further conflict with cmdline wget on newer Macs,
+			     as DYLD_FALLBACK_LIBRARY_PATH (another env var hidden on Macs) ends up set. -->
+			<delete dir="compiled/ext/imagemagick"/>  <!-- dir = The directory to delete, including all its files and subdirectories. -->
+
+			<!--
+			    <exec executable="svn">
+			      <arg value="export"/>
+			      <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
+			      <arg value="compiled/bin/darwin/imagemagick"/>
+			    </exec>
+			    -->
+				<exec executable="svn">
+					<arg value="export"/>
+					<arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
+					<arg value="compiled/bin/darwin/ghostscript"/>
+				</exec>
+
+				<else>			    
+					<exec executable="svn">
+						<arg value="export"/>
+						<arg value="${svn.root}/main/trunk/binaries/mac/intel/imagemagick"/>
+						<arg value="compiled/bin/darwin/imagemagick"/>
+					</exec>
+			    
+					<exec executable="svn">
+						<arg value="export"/>
+						<arg value="${svn.root}/main/trunk/binaries/mac/intel/ghostscript"/>
+						<arg value="compiled/bin/darwin/ghostscript"/>
+					</exec>
+				</else>
+			</if>
+
+			<!-- delete unneeded files -->
+			<delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm"/></delete>
+<!--
+  Actually useful to keep these files around for a Pure Java install
+			<delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
+			<delete><fileset dir="compiled" includes="*.bat"/></delete>
+-->
+
+			<delete dir="compiled/common-src/packages/windows"/>
+
+		</if></else></if></else></if>
+
+		<!-- build demo collection -->
+		<!-- the envs on these execs simulate the environment when you run setup.bat -->
+		<if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>	
+			
+			<exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
+				<arg line="-S"/>
+				<arg line="bin/script/import.pl demo"/>
+				<env key="GSDLHOME" path="${basedir}/compiled"/>
+				<env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
+				<env key="GSDLOS" value="windows"/>
+				<env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
+			</exec>
+			<exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
+				<arg line="-S"/>
+				<arg line="bin/script/buildcol.pl demo"/>
+				<env key="GSDLHOME" path="${basedir}/compiled"/>
+				<env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
+				<env key="GSDLOS" value="windows"/>
+				<env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
+			</exec>
+
+			<delete dir="${basedir}/compiled/collect/demo/index"/>
+			<move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
+			
+			<else>
+				<echo file="${basedir}/compiled/buildscript.sh">
+					#!/bin/bash
+					source setup.bash
+					/usr/bin/perl -S ${basedir}/compiled/bin/script/full-rebuild.pl demo
+				</echo>
+				<chmod perm="755" file="${basedir}/compiled/buildscript.sh"/>
+				<exec dir="${basedir}/compiled" executable="/bin/bash">
+					<arg line="buildscript.sh"/>
+				</exec>
+				<delete file="${basedir}/compiled/buildscript.sh"/>
+			</else>
+		</if>
+
+		<!-- delete unneeded files -->
+		<delete dir="compiled/uninstaller" />
+		<delete file="compiled/bin/java/SignedGatherer.jar" />
+
+		<!-- tidy up gli -->
+		<antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
+
+		<!-- mac and linux: insert export to cdrom package -->
+		<if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
+			<mkdir dir="compiled/bin/windows"/>
+			<get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
+
+			<if><bool><equals arg1="${post.2.83.version}" arg2="true"/></bool>
+				<get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
+				<get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
+
+				<else>
+					<get src="${svn.root}/main/trunk/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
+					<get src="${svn.root}/main/trunk/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
+				</else>
+			</if>
+		</if>
+
+	</target>
+
+</project>
