This is an automated email from the ASF dual-hosted git repository.

ChenSammi pushed a commit to branch HDDS-10685
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-10685 by this push:
     new 5676ac4b338 HDDS-15318. Download libhadoop library during maven build 
(#10305)
5676ac4b338 is described below

commit 5676ac4b3381d4db7ffc9359d20cf941b31e5f2c
Author: Sammi Chen <[email protected]>
AuthorDate: Wed May 20 16:22:58 2026 +0800

    HDDS-15318. Download libhadoop library during maven build (#10305)
---
 .../dist/dev-support/bin/dist-layout-stitching     |  18 ++++
 pom.xml                                            | 120 +++++++++++++++++++++
 2 files changed, 138 insertions(+)

diff --git a/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching 
b/hadoop-ozone/dist/dev-support/bin/dist-layout-stitching
index 85d347fc6b4..54592ac3198 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 d103a35cce2..02ba089a81b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2633,5 +2633,125 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <id>native</id>
+      <activation>
+        <os>
+          <family>linux</family>
+          <arch>x86_64</arch>
+        </os>
+        <property>
+          <name>fetch-native-hadoop</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.googlecode.maven-download-plugin</groupId>
+            <artifactId>download-maven-plugin</artifactId>
+            <version>${download-maven-plugin.version}</version>
+            <inherited>false</inherited>
+            <executions>
+              <execution>
+                <id>fetch-linux-library</id>
+                <goals>
+                  <goal>wget</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  
<url>https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_linux_x86_64.so</url>
+                  <unpack>false</unpack>
+                  
<outputDirectory>${project.build.directory}/native-lib</outputDirectory>
+                  <skipCache>false</skipCache>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>${maven-antrun-plugin.version}</version>
+            <inherited>false</inherited>
+            <executions>
+              <execution>
+                <id>extract-linux-library</id>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <phase>prepare-package</phase>
+                <configuration>
+                  <target>
+                    <exec dir="${project.build.directory}/native-lib" 
executable="bash" failonerror="true">
+                      <arg value="-c" />
+                      <arg value="ln -sf libhadoop_linux_x86_64.so 
libhadoop.so" />
+                    </exec>
+                  </target>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>native-mac</id>
+      <activation>
+        <os>
+          <family>mac</family>
+          <arch>aarch64</arch>
+        </os>
+        <property>
+          <name>fetch-native-hadoop</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.googlecode.maven-download-plugin</groupId>
+            <artifactId>download-maven-plugin</artifactId>
+            <version>${download-maven-plugin.version}</version>
+            <inherited>false</inherited>
+            <executions>
+              <execution>
+                <id>fetch-mac-library</id>
+                <goals>
+                  <goal>wget</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  
<url>https://raw.githubusercontent.com/apache/ozone-thirdparty/master/hadoop-native-lib/${hadoop.version}/libhadoop_osx_aarch_64.dylib</url>
+                  <unpack>false</unpack>
+                  
<outputDirectory>${project.build.directory}/native-lib</outputDirectory>
+                  <skipCache>false</skipCache>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>${maven-antrun-plugin.version}</version>
+            <inherited>false</inherited>
+            <executions>
+              <execution>
+                <id>extract-mac-library</id>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <phase>prepare-package</phase>
+                <configuration>
+                  <target>
+                    <exec dir="${project.build.directory}/native-lib" 
executable="bash" failonerror="true">
+                      <arg value="-c" />
+                      <arg value="ln -sf libhadoop_osx_aarch_64.dylib 
libhadoop.dylib" />
+                    </exec>
+                  </target>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to