--- build.xml.orig	2024-10-12 12:40:43 UTC
+++ build.xml
@@ -31,6 +31,7 @@ -->
     <property file="build.properties.default" />
     <property file="${user.home}/.ant/build.properties"/>
     <property name="debuglevel" value="source,lines,vars"/>
+    <property name="pycmd" value="python"/>
 
     <!-- default version and SCM information -->
     <property name="base.version" value="5.0.2"/>
@@ -104,7 +105,7 @@ -->
     <condition property="version" value="${base.version}">
       <isset property="release"/>
     </condition>
-    <property name="version" value="${base.version}-SNAPSHOT"/>
+    <property name="version" value="${base.version}"/>
     <property name="version.properties.dir"
               value="${build.src.resources}/org/apache/cassandra/config/" />
     <property name="final.name" value="${ant.project.name}-${version}"/>
@@ -358,6 +359,24 @@ -->
             <exclude name="**/ant-*.jar"/>
         </fileset>
     </path>
+    <path id="cassandra.classpath.staged">
+        <file file="${build.dir}/${final.name}.jar"/> <!-- we need the jar for tests and benchmarks (multi-version jar) -->
+        <fileset dir="${stagedlib}">
+            <include name="**/*.jar" />
+        </fileset>
+        <fileset dir="${build.dir.lib}">
+            <include name="**/assertj-core-3.15.0.jar" />
+            <include name="**/byteman*.jar" />
+            <include name="**/commons-lang-2.4.jar" />
+            <include name="**/commons-collections-3.2.1.jar" />
+            <include name="**/ohc-core-0.5.1.jar" />
+            <include name="**/ohc-core-j8-0.5.1.jar" />
+        </fileset>
+        <fileset dir="${test.lib}/jars">
+            <include name="**/*.jar" />
+            <exclude name="**/ant-*.jar"/>
+        </fileset>
+    </path>
 
   <macrodef name="create-javadoc">
     <attribute name="destdir"/>
@@ -476,6 +495,8 @@ -->
     <target name="gen-doc" description="Generate documentation" depends="gen-asciidoc,generate-cql-html" unless="ant.gen-doc.skip">
         <exec executable="make" osfamily="unix" dir="${doc.dir}">
             <arg value="html"/>
+            <arg value="PYTHON_CMD=${pycmd}"/>
+            <arg value="PYTHON_VER=${pyver}"/>
         </exec>
     </target>
 
@@ -908,6 +929,90 @@ -->
       </copy>
     </target>
 
+    <!-- FreeBSD for staging -->
+    <target name="freebsd-stage" depends="jar"
+            description="Create Cassandra directory structure for staging">
+      <mkdir dir="${dist.dir}"/>
+      <copy todir="${dist.dir}/lib">
+        <fileset dir="${build.lib}">
+          <exclude name="sigar*.jar"/>
+          <exclude name="sigar-bin/*"/>
+          <exclude name="snappy*.jar"/>
+          <exclude name="netty-all*.jar"/>
+          <exclude name="netty-tcnative-boringssl-static-2.0.61.Final-*.jar"/>
+          <exclude name="ohc*.jar"/>
+          <exclude name="licenses/snappy*.txt"/>
+          <exclude name="licenses/netty-all*.txt"/>
+          <exclude name="licenses/ohc*.txt"/>
+        </fileset>
+        <fileset dir="${build.dir}">
+          <include name="${final.name}.jar" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/bin">
+        <fileset dir="bin">
+	  <exclude name="*.bat" />
+	  <exclude name="*.ps1" />
+	  <exclude name="*.orig" />
+	</fileset>
+      </copy>
+      <copy todir="${dist.dir}/conf">
+        <fileset dir="conf">
+          <exclude name="*.ps1" />
+	  <exclude name="*.orig" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/pylib">
+        <fileset dir="pylib">
+          <include name="**" />
+          <exclude name="**/*.pyc" />
+          <exclude name="Dockerfile.ubuntu.*" />
+          <exclude name="cqlshlib/test/**" />
+          <exclude name="cassandra-cqlsh-tests.sh" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/">
+        <fileset dir="${basedir}">
+          <include name="*.txt" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/tools/bin">
+        <fileset dir="${basedir}/tools/bin">
+          <exclude name="*.bat" />
+          <exclude name="*.ps1" />
+	  <exclude name="*.orig" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/tools/">
+        <fileset dir="${basedir}/tools/">
+            <include name="*.yaml"/>
+	</fileset>
+      </copy>
+      <copy todir="${dist.dir}/tools/lib">
+        <fileset dir="${build.dir}/tools/lib/">
+            <include name="*.jar" />
+        </fileset>
+      </copy>
+    </target>
+
+    <target name="freebsd-stage-doc" depends="freebsd-stage,javadoc,gen-doc"
+            description="Create Cassandra directory structure for staging, including docs">
+      <copy todir="${dist.dir}/javadoc">
+        <fileset dir="${javadoc.dir}"/>
+      </copy>
+      <copy todir="${dist.dir}/doc">
+        <fileset dir="doc">
+          <include name="cql3/CQL.html" />
+          <include name="cql3/CQL.css" />
+          <include name="SASI.md" />
+        </fileset>
+      </copy>
+      <copy todir="${dist.dir}/doc/html">
+        <fileset dir="doc" />
+        <globmapper from="build/html/*" to="*"/>
+      </copy>
+    </target>
+    
     <!-- creates release tarballs -->
     <target name="artifacts" depends="_artifacts-init,check,gen-doc,sources-jar"
             description="Create Cassandra tarball and maven artifacts">
@@ -1198,7 +1303,7 @@ -->
           <pathelement location="${stress.build.classes}"/>
           <pathelement location="${fqltool.build.classes}"/>
           <pathelement location="${test.classes}"/>
-          <path refid="cassandra.classpath.test" />
+          <path refid="cassandra.classpath.staged" />
           <pathelement location="${stress.test.classes}"/>
           <pathelement location="${fqltool.test.classes}"/>
           <pathelement location="${test.conf}"/>
