--- spark.org/build/build.xml	2008-06-17 09:38:42.000000000 +0200
+++ spark/build/build.xml	2008-07-04 17:51:07.000000000 +0200
@@ -68,6 +68,7 @@
     <property name="commercial.plugin.dir" location="${basedir}/src/commercial"/>
     <property name="xtra.dir" location="${basedir}/src/xtra"/>
     <property name="target.xtra" location="${target.build}/xtra"/>
+    <property name="release.dir" value="${basedir}/installer"/>
 
     <!-- Installer Ant Script -->
 
@@ -613,7 +614,6 @@
     <property name="debian.dir" value="${basedir}/build/debian"/>
     <property name="debian.version" value="${version.major}.${version.minor}.${version.revision}"/>
     <property name="debian.work.dir" value="${work.dir}/debian/spark-${debian.version}"/>  
-    <property name="debian.release.dir" value="${basedir}/installer"/>
     <tstamp>
       <format property="debian.builddate" pattern="EEE, dd MMM yyyy HH:mm:ss Z" locale="en"/>
     </tstamp>
@@ -644,9 +644,9 @@
 	  <arg line="-d"/>
 	</exec>
 
-	<mkdir dir="${debian.release.dir}"/>
+	<mkdir dir="${release.dir}"/>
 
-        <copy todir="${debian.release.dir}">
+        <copy todir="${release.dir}">
           <fileset dir="${debian.work.dir}/.." followsymlinks="false">
             <include name="**/*.deb"/>
             <include name="**/*.changes"/>
@@ -655,6 +655,94 @@
           </fileset>
         </copy>
     </target>
+
+    <!-- dist.src =============================================================================== -->
+    <property name="release.src.out.dir" value="target/src/Spark-${version}" />
+    <property name="release.fullname.src" value="spark_src_${version}"/>
+    <target name="dist.src" depends="release.javadocs" description="Creates a source distribution package">
+
+	<mkdir dir="${release.dir}"/>
+
+        <!-- Copy non-java source -->
+        <copy todir="${release.src.out.dir}/src">
+            <fileset dir="${basedir}/src/" excludes="**/*.java"/>
+        </copy>
+
+        <!-- Copy java source -->
+        <copy todir="${release.src.out.dir}/src">
+            <fileset dir="${basedir}/src/">
+                <include name="**/*.java" />
+            </fileset>
+            <filterset>
+                <filter token="DATE" value="${builddate}"/>
+            </filterset>
+        </copy>
+
+        <!-- Copy documentation -->
+        <copy todir="${release.src.out.dir}/documentation">
+            <fileset dir="${basedir}/target/build/documentation/"/>
+        </copy>
+
+        <!-- Copy build -->
+        <copy todir="${release.src.out.dir}/build">
+            <fileset dir="${basedir}/build"/>
+        </copy>
+
+         <!-- Source Packages -->
+         <zip zipfile="${release.dir}/${release.fullname.src}.zip"
+                 basedir="${release.src.out.dir}/.."
+                 includes="**/*"
+                 />
+         <tar tarfile="${release.dir}/${release.fullname.src}.tar.gz"
+                 basedir="${release.src.out.dir}/.."
+                 includes="**/*"
+                 compression="gzip"
+                 longfile="gnu"
+                />
+
+    </target>
+
+    <!-- installer.rpm ========================================================================= -->
+    <property name="bundle.jre" value="true" />
+    <property name="target.work.subdir" value="rpm" />
+    <property name="target.rpm" value="${work.dir}/${target.work.subdir}" />
+    <property name="rpm.spec.file" value="${basedir}/build/rpm/spark.spec"/>
+    <tstamp>
+        <format property="rpm.builddate" pattern="EEE MMM dd yyyy" locale="en"/>
+    </tstamp>
+    <target name="installer.rpm" depends="dist.src" description="Builds a rpm of spark.">
+
+        <mkdir dir="${target.rpm}/SPECS" />
+        <mkdir dir="${target.rpm}/SOURCES" />
+        <mkdir dir="${target.rpm}/BUILD" />
+        <mkdir dir="${target.rpm}/SRPMS" />
+        <mkdir dir="${target.rpm}/RPMS" />
+
+        <copy tofile="${target.rpm}/SPECS/spark.spec" file="${rpm.spec.file}" />
+        <if>
+            <equals arg1="${bundle.jre}" arg2="true"/>
+            <then>
+                <!-- Include bundled jre -->
+                <copy todir="${target.rpm}/SOURCES" file="${basedir}/build/rpm/jre-dist.tar.gz" />
+            </then>
+        </if>
+        <copy todir="${target.rpm}/SOURCES" file="${release.dir}/${release.fullname.src}.tar.gz" />
+
+
+        <rpm specFile="spark.spec"
+             topDir="${target.rpm}"
+             command="-ba --define 'SPARK_VERSION ${version}' --define 'SPARK_SOURCE ${release.fullname.src}.tar.gz'"
+             failOnError="true"
+             />
+
+        <copy todir="${release.dir}" >
+            <fileset dir="${target.rpm}/SRPMS" />
+            <fileset dir="${target.rpm}/RPMS/i386" />
+        </copy>
+    </target>
+
+
+
 </project>
 
 
