Index: main/trunk/greenstone3/build.xml
===================================================================
--- main/trunk/greenstone3/build.xml	(revision 32880)
+++ main/trunk/greenstone3/build.xml	(revision 32881)
@@ -1158,9 +1158,16 @@
     <!-- assuming that index.html is not needed here -->   
 
-    <!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
+    <!--Now write out the url with /oaiserver suffix as the baseURL property in OAIConfig.xml-->
     <available file="${basedir}/resources/oai/OAIConfig.xml.in" property="oaiconfig.present"/>
     <antcall target="init-oaiconfig">
       <param name="url" value="${url}"/>
     </antcall>
+
+    <!--Now write out the url with /gs-cantaloupe suffix as the baseURL property in IIIFConfig.xml-->
+    <available file="${basedir}/resources/iiif/IIIFConfig.xml.in" property="iiifconfig.present"/>
+    <antcall target="init-iiifconfig">
+      <param name="url" value="${url}"/>
+    </antcall>
+
   </target>
 
@@ -1171,4 +1178,10 @@
   </target>
 
+  <target name="init-iiifconfig" if="iiifconfig.present">
+    <echo>Writing out baseURL ${url}gs-cantaloupe to ${web.writableclasses}/IIIFConfig.xml</echo>
+    <copy file="${basedir}/resources/iiif/IIIFConfig.xml.in" tofile="${web.writableclasses}/IIIFConfig.xml"/>
+    <rsr verbosity="1" file="${web.writableclasses}/IIIFConfig.xml" pattern="&lt;baseURL&gt;.*&lt;/baseURL&gt;" replacement="&lt;baseURL&gt;${url}gs-cantaloupe&lt;/baseURL&gt;" />   
+  </target>
+  
   <target name="stop" depends="init,stop-tomcat,stop-derby" 
     description="Shutdown the Tomcat server."/>
@@ -1296,42 +1309,71 @@
   <target name="copy-dot-svn-files" depends="init" 
 	  description="Copies all resources .svn files to .in versions - which are used during configure to generate the runtime versions." >
-    <if><bool><available file="${basedir}/resources/tomcat/greenstone3.xml.in"/></bool>
+    <if>
+      <bool><available file="${basedir}/resources/tomcat/greenstone3.xml.in"/></bool>
       <copy file="${basedir}/resources/tomcat/greenstone3.xml.in" tofile="${basedir}/resources/tomcat/greenstone3.xml.in.backup"  overwrite="true"/>
     </if>
-   
     <copy file="${basedir}/resources/tomcat/greenstone3.xml.svn" tofile="${basedir}/resources/tomcat/greenstone3.xml.in"  overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/tomcat/server_tomcat5.xml.in"/></bool>
+
+    <if>
+      <bool><available file="${basedir}/resources/tomcat/server_tomcat5.xml.in"/></bool>
       <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in.backup"  overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in"  overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/tomcat/server_tomcat7.xml.in"/></bool>
+
+    <if>
+      <bool><available file="${basedir}/resources/tomcat/server_tomcat7.xml.in"/></bool>
       <copy file="${basedir}/resources/tomcat/server_tomcat7.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat7.xml.in.backup"  overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/tomcat/server_tomcat8.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat8.xml.in" overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/tomcat/server_tomcat8.xml.in"/></bool>
+
+    <if>
+      <bool><available file="${basedir}/resources/tomcat/server_tomcat8.xml.in"/></bool>
       <copy file="${basedir}/resources/tomcat/server_tomcat8.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat8.xml.in.backup"  overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/tomcat/server_tomcat8.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat8.xml.in" overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/tomcat/web8.xml.in"/></bool>
+
+    <if>
+      <bool><available file="${basedir}/resources/tomcat/web8.xml.in"/></bool>
       <copy file="${basedir}/resources/tomcat/web8.xml.in" tofile="${basedir}/resources/tomcat/web8.xml.in.backup"  overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/tomcat/web8.xml.svn" tofile="${basedir}/resources/tomcat/web8.xml.in"  overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/oai/OAIConfig.xml.in"/></bool>
-    <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${basedir}/resources/oai/OAIConfig.xml.in.backup"  overwrite="true"/>
+
+    <if>
+      <bool><available file="${basedir}/resources/oai/OAIConfig.xml.in"/></bool>
+      <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${basedir}/resources/oai/OAIConfig.xml.in.backup"  overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/oai/OAIConfig.xml.svn" tofile="${basedir}/resources/oai/OAIConfig.xml.in"  overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/cgi/gsdl3site.cfg.in"/></bool>
+
+    <if>
+      <bool><available file="${basedir}/resources/iiif/IIIFConfig.xml.in"/></bool>
+      <copy file="${basedir}/resources/iiif/IIIFConfig.xml.in" tofile="${basedir}/resources/iiif/IIIFConfig.xml.in.backup"  overwrite="true"/>
+    </if>
+    <copy file="${basedir}/resources/iiif/IIIFConfig.xml.svn" tofile="${basedir}/resources/iiif/IIIFConfig.xml.in"  overwrite="true"/>
+
+    <if>
+      <bool><available file="${basedir}/resources/iiif/cantaloupe.properties.in"/></bool>
+      <copy file="${basedir}/resources/iiif/cantaloupe.properties.in" tofile="${basedir}/resources/iiif/cantaloupe.properties.in.backup" overwrite="true"/>
+    </if>
+    <copy file="${basedir}/resources/iiif/cantaloupe.properties.svn" tofile="${basedir}/resources/iiif/cantaloupe.properties.in" overwrite="true"/>
+
+    <if>
+      <bool><available file="${basedir}/resources/cgi/gsdl3site.cfg.in"/></bool>
       <copy file="${basedir}/resources/cgi/gsdl3site.cfg.in" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in.backup" overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/cgi/gsdl3site.cfg.svn" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in" overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/web/global.properties.in"/></bool>
-    <copy file="${basedir}/resources/web/global.properties.in" tofile="${basedir}/resources/web/global.properties.in.backup" overwrite="true"/>
+
+    <if>
+      <bool><available file="${basedir}/resources/web/global.properties.in"/></bool>
+      <copy file="${basedir}/resources/web/global.properties.in" tofile="${basedir}/resources/web/global.properties.in.backup" overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/web/global.properties.svn" tofile="${basedir}/resources/web/global.properties.in" overwrite="true"/>
-    <if><bool><available file="${basedir}/resources/web/log4j.properties.in"/></bool>
-    <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${basedir}/resources/web/log4j.properties.in.backup" overwrite="true"/>
+
+    <if>
+      <bool><available file="${basedir}/resources/web/log4j.properties.in"/></bool>
+      <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${basedir}/resources/web/log4j.properties.in.backup" overwrite="true"/>
     </if>
     <copy file="${basedir}/resources/web/log4j.properties.svn" tofile="${basedir}/resources/web/log4j.properties.in" overwrite="true"/>
-  </target>
+    
+</target>
     
   <!-- ========== Web app Targets ================================ -->
@@ -1578,5 +1620,6 @@
     <copy file="${basedir}/resources/web/global.properties.in" tofile="${web.writableclasses}/global.properties" filtering="true" overwrite="true"/>
     <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${web.writableclasses}/log4j.properties" filtering="true" overwrite="true"/>
-    <if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
+    <if>
+      <bool><istrue value="${gsdl3home.isreadonly}"/></bool>
       <!-- uncomment the writablehome properties -->
       <rsr verbosity="1" file="${web.writableclasses}/global.properties" pattern="^#gsdl3\.(writable{1})?home" replacement="gsdl3.$1home" />
@@ -1584,4 +1627,7 @@
     <chmod file="${web.writableclasses}/global.properties" perm="644"/>
     <chmod file="${web.writableclasses}/log4j.properties" perm="644"/>
+
+    <copy file="${basedir}/resources/iiif/cantaloupe.properties.in" tofile="${basedir}/cantaloupe.properties" filtering="true" overwrite="true"/>
+    <chmod file="${basedir}/cantaloupe.properties" perm="644"/>
   </target>
 
@@ -2302,7 +2348,7 @@
     <if><bool>
 	<isset property="fedora.maxpermsize"/></bool>
-      <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
+      <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M -Dcantaloupe.config=${basedir}/cantaloupe.properties ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
       <else>
-	<property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
+	<property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M -Dcantaloupe.config=${basedir}/cantaloupe.properties ${readonly.catalina.opts}"/>
       </else>
     </if>
@@ -2370,7 +2416,7 @@
     <if><bool>
 	<isset property="fedora.maxpermsize"/></bool>
-      <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
+      <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M -Dcantaloupe.config=${basedir}/cantaloupe.properties ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
       <else>
-	<property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
+	<property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M -Dcantaloupe.config=${basedir}/cantaloupe.properties ${readonly.catalina.opts}"/>
       </else>
     </if>
