Index: /gs3-extensions/mat/trunk/build.xml
===================================================================
--- /gs3-extensions/mat/trunk/build.xml	(revision 21975)
+++ /gs3-extensions/mat/trunk/build.xml	(revision 21976)
@@ -1,124 +1,141 @@
 <project name="Mat" basedir="." default="main">
-	
-	<property name="src.dir"     value="src"/>
-	<property name="build.dir"   value="build"/>
-	<property name="classes.dir" value="${build.dir}/classes"/>
-	<property name="lib.dir"     value="lib"/>
-	<property name="tmp.dir"     value="tmp"/>
-	<property name="gsdl3srchome.dir" value="../.."/>
-	<property name="web.dir" value="${gsdl3srchome.dir}/web/WEB-INF"/>
-	<property name="jcommon" value="jcommon.jar"/>
-	<property name="jfreechart" value="jfreechart.jar"/>
-	<property name="mat.dir" value="${gsdl3srchome.dir}/web/mat"/>
-	<property name="jni.dir" value="${gsdl3srchome.dir}/lib/jni"/>	
-	<property name="tomcat.home" value="${gsdl3srchome.dir}/packages/tomcat"/>
-	<property name="tomcat.lib.dir" value="${tomcat.home}/lib"/>
-	<property name="web.lib.dir" value="${web.dir}/lib"/>
-	<property name="web.class.dir" value="${web.dir}/classes/org/greenstone/mat/servlet"/>
-	<property name="mat.class.dir" value="${classes.dir}/org/greenstone/mat/servlet"/>
-	
-    	<path id="classpath">
-        	<fileset dir="${lib.dir}">
-			<include name="**/*.jar"/>
-		</fileset>
-		<dirset  dir="${lib.dir}">
-			<include name="**/classes"/>
-		</dirset>
-    	</path>
+  <property environment="env"/>
+  <property name="gsdl3srchome.dir" value="${env.GSDL3SRCHOME}"/>
+
+  <property name="scripts.dir" value="bin/script"/>
+  <property name="mat.scripts.dir" value="web/script"/>
+  <property name="src.dir"     value="src"/>
+  <property name="build.dir"   value="build"/>
+  <property name="classes.dir" value="${build.dir}/classes"/>
+  <property name="lib.dir"     value="lib"/>
+  <property name="tmp.dir"     value="tmp"/>
+  <property name="web.dir" value="${gsdl3srchome.dir}/web/WEB-INF"/>
+  <property name="web.lib.dir" value="${web.dir}/lib"/>
+  <property name="web.classes.dir" value="${web.dir}/classes"/>
+  <property name="jcommon" value="jcommon.jar"/>
+  <property name="jfreechart" value="jfreechart.jar"/>
+  <property name="jni.dir" value="${gsdl3srchome.dir}/lib/jni"/>	
+  <property name="tomcat.home" value="${gsdl3srchome.dir}/packages/tomcat"/>
+  <property name="tomcat.lib.dir" value="${tomcat.home}/lib"/>
+  <property name="web.lib.dir" value="${web.dir}/lib"/>
+  <property name="web.class.dir" value="${web.dir}/classes/org/greenstone/mat/servlet"/>
+  <property name="mat.class.dir" value="${classes.dir}/org/greenstone/mat/servlet"/>
+  <property name="mat.classes.dir" value="web/WEB-INF/classes"/>
+  
+  <path id="classpath">
+    <fileset dir="${lib.dir}">
+      <include name="**/*.jar"/>
+    </fileset>
+    <dirset  dir="${lib.dir}">
+      <include name="**/classes"/>
+    </dirset>
+  </path>
+  
+  <target name ="create_log_folder">
+    <mkdir dir="../logs/mat"/>
+  </target>
+  
+  <target name="clean">
+    <delete dir="${build.dir}"/>
+    <delete dir="${lib.dir}"/>
+  </target>
+  
+  <target name="compile" depends="setup-java-lib,setup-tmp,create_log_folder,move-mat-xml">
+    <mkdir dir="${classes.dir}"/>
+    <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
     
-	<target name ="create_log_folder">
-		<mkdir dir="../logs/mat"/>
-	</target>
-	
-	<target name="clean">
-		<delete dir="${build.dir}"/>
-		<delete dir="${lib.dir}"/>
-	</target>
+    <mkdir dir="${web.class.dir}"/>
+    <copy todir="${web.class.dir}">
+      <fileset dir="${mat.class.dir}">
+      	<include name="**/*.class"/>
+      </fileset>
+    </copy>
 
-	<target name="compile" depends="setup-java-lib,setup-tmp,create_log_folder,move-mat-xml">
-		<mkdir dir="${classes.dir}"/>
-		<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
-		
-		<mkdir dir="${web.class.dir}"/>
-		<copy todir="${web.class.dir}">
-			    <fileset dir="${mat.class.dir}">
-      				<include name="**/*.class"/>
-    			   </fileset>
-		</copy>
-		<jar destfile="web/WEB-INF/lib/mat.jar">
-		  <fileset dir="build/classes">
-		    <include name="org/greenstone/mat/**"/>
-		  </fileset>
-		</jar>
-		<jar destfile="guiext.jar">
-		  <fileset dir="build/classes">
-		    <include name="org/greenstone/admin/**"/>
-		  </fileset>
-		</jar>
-	</target>
+    <copy file="${web.classes.dir}/global.properties" tofile="${mat.classes.dir}/global.properties"/>
+    <copy file="${web.classes.dir}/log4j.properties" tofile="${mat.classes.dir}/log4j.properties"/>
 
-	<target name="move-mat-xml">
-	  <copy file="${basedir}/resources/tomcat/mat.xml" tofile="${tomcat.home}/conf/Catalina/localhost/mat.xml" overwrite="true">
-	    <filterset>
-              <filter token="matwebhome" value="${basedir}/web"/>
-	    </filterset>
-	  </copy>
-	</target>
-	
-	<target name="setup-java-lib">
+    <mkdir dir="${mat.scripts.dir}"/>
+    <copy todir="${mat.scripts.dir}">
+      <fileset dir="${scripts.dir}"/>
+    </copy>
 
-		<mkdir dir="${lib.dir}"/>
-		<copy todir="${lib.dir}">
-			    <fileset dir="${web.dir}/lib">
-      				<include name="**/*.jar"/>
-    			   </fileset>
-		</copy>
-		
-		<mkdir dir="${lib.dir}/classes"/>
-		<copy todir="${lib.dir}/classes">
-		    	<fileset dir="${web.dir}/classes"/>
-		 </copy>
-		  
-		<copy todir="${lib.dir}">
-		    <fileset dir="${jni.dir}">
-      			<include name="**/*.jar"/>
-    		   </fileset>
-		</copy>	
-		
-		<copy todir="${lib.dir}">
-		    <fileset dir="${tomcat.lib.dir}">
-      			<include name="**/servlet-api.jar"/>
-    		   </fileset>
-		</copy>	
-		
-		<copy todir="${lib.dir}">
-		    <fileset dir="${web.lib.dir}">
-      			<include name="xml-apis.jar"/>
-    		   </fileset>
-		</copy>	
-		
-		<copy todir="${lib.dir}">
-		    <fileset dir="./">
-      			<include name="**/${jcommon}"/>
-			<include name="**/${jfreechart}"/>
-		    </fileset>
-		</copy>
-
-		<mkdir dir="${mat.dir}/script"/>
-		<copy todir="${mat.dir}/script">
-		    	<fileset dir="./resources/script"/>
-		</copy>	
-	</target>
-
-	<target name ="clean-tmp">
-		<delete dir="${tmp.dir}"/>
-		<echo> ${tmp.dir} has been removed </echo>
-	</target>
-	<target name ="setup-tmp">
-		<mkdir dir="./tmp"/>
-		<echo> ${tmp.dir} has been created </echo>
-		<echo file="${tmp.dir}/log.txt">This is the log file.</echo>
-	</target>
-	<target name="clean-compile" depends="clean,compile"/>
-
+    <jar destfile="web/WEB-INF/lib/mat.jar">
+      <fileset dir="build/classes">
+	<include name="org/greenstone/mat/**"/>
+      </fileset>
+      <manifest>
+	<attribute name="Class-Path" value="${web.lib.dir}/gsdl3.jar ${jni.dir}/mg.jar ${jni.dir}/mgpp.jar ${web.lib.dir}/log4j-1.2.8.jar ${web.lib.dir}/activation.jar ${web.lib.dir}/mail.jar"/>
+      </manifest>
+    </jar>
+    <jar destfile="guiext.jar">
+      <fileset dir="build/classes">
+	<include name="org/greenstone/admin/**"/>
+      </fileset>
+    </jar>
+  </target>
+  
+  <target name="move-mat-xml">
+    <copy file="${basedir}/resources/tomcat/mat.xml" tofile="${tomcat.home}/conf/Catalina/localhost/mat.xml" overwrite="true">
+      <filterset>
+        <filter token="matwebhome" value="${basedir}/web"/>
+      </filterset>
+    </copy>
+  </target>
+  
+  <target name="setup-java-lib">
+    
+    <mkdir dir="${lib.dir}"/>
+    <copy todir="${lib.dir}">
+      <fileset dir="${web.dir}/lib">
+      	<include name="**/*.jar"/>
+      </fileset>
+    </copy>
+    
+    <mkdir dir="${lib.dir}/classes"/>
+    <copy todir="${lib.dir}/classes">
+      <fileset dir="${web.dir}/classes"/>
+    </copy>
+    
+    <copy todir="${lib.dir}">
+      <fileset dir="${jni.dir}">
+      	<include name="**/*.jar"/>
+      </fileset>
+    </copy>	
+    
+    <copy todir="${lib.dir}">
+      <fileset dir="${tomcat.lib.dir}">
+      	<include name="**/servlet-api.jar"/>
+      </fileset>
+    </copy>	
+    
+    <copy todir="${lib.dir}">
+      <fileset dir="${web.lib.dir}">
+      	<include name="xml-apis.jar"/>
+      </fileset>
+    </copy>	
+    
+    <copy todir="${lib.dir}">
+      <fileset dir="./">
+      	<include name="**/${jcommon}"/>
+	<include name="**/${jfreechart}"/>
+      </fileset>
+    </copy>
+    
+    <mkdir dir="${mat.scripts.dir}"/>
+    <copy todir="${mat.scripts.dir}/script">
+      <fileset dir="resources/script"/>
+    </copy>	
+  </target>
+  
+  <target name ="clean-tmp">
+    <delete dir="${tmp.dir}"/>
+    <echo> ${tmp.dir} has been removed </echo>
+  </target>
+  <target name ="setup-tmp">
+    <mkdir dir="./tmp"/>
+    <echo> ${tmp.dir} has been created </echo>
+    <echo file="${tmp.dir}/log.txt">This is the log file.</echo>
+  </target>
+  <target name="clean-compile" depends="clean,compile"/>
+  
 </project>
