diff --git a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching
index 85d347fc6b41..54592ac31986 100755
--- a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching
+++ b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching
@@ -143,6 +143,24 @@ for file in $(find "${ROOT}" -path '*/share/ozone/lib/*jar' | sort); do
cp -p "$file" share/ozone/lib/
done
+# ---------------------------------------------------------
+# Copy Hadoop Native Libraries (libhadoop.so) - Conditionally
+# ---------------------------------------------------------
+NATIVE_LIBS_DIR="${ROOT}/target/native-lib"
+
+# Check if the libhadoop files actually exist before attempting to copy
+if ls "${NATIVE_LIBS_DIR}"/libhadoop* 1> /dev/null 2>&1; then
+ echo "Found Hadoop native libraries. Copying to distribution..."
+
+ # Create the native directory in the final staging area
+ run mkdir -p ./lib/native
+
+ # Copy the files and symlinks safely
+ run cp -rP "${NATIVE_LIBS_DIR}/"libhadoop* ./lib/native
+else
+ echo "Hadoop native libraries not found. Skipping native copy."
+fi
+
#workaround for https://issues.apache.org/jira/browse/MRESOURCES-236
find ./compose -name "*.sh" -exec chmod 755 {} \;
find ./kubernetes -name "*.sh" -exec chmod 755 {} \;
diff --git a/pom.xml b/pom.xml
index d103a35cce29..02ba089a81ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2633,5 +2633,125 @@
+
+ native
+
+
+ linux
+ x86_64
+
+
+ fetch-native-hadoop
+
+
+
+
+
+ com.googlecode.maven-download-plugin
+ download-maven-plugin
+ ${download-maven-plugin.version}
+ false
+
+
+ fetch-linux-library
+
+ wget
+
+ generate-resources
+
+ https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_linux_x86_64.so
+ false
+ ${project.build.directory}/native-lib
+ false
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ ${maven-antrun-plugin.version}
+ false
+
+
+ extract-linux-library
+
+ run
+
+ prepare-package
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ native-mac
+
+
+ mac
+ aarch64
+
+
+ fetch-native-hadoop
+
+
+
+
+
+ com.googlecode.maven-download-plugin
+ download-maven-plugin
+ ${download-maven-plugin.version}
+ false
+
+
+ fetch-mac-library
+
+ wget
+
+ generate-resources
+
+ https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_osx_aarch_64.dylib
+ false
+ ${project.build.directory}/native-lib
+ false
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ ${maven-antrun-plugin.version}
+ false
+
+
+ extract-mac-library
+
+ run
+
+ prepare-package
+
+
+
+
+
+
+
+
+
+
+
+
+
+