hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1345421 - in /hadoop/common/trunk/hadoop-hdfs-project: ./ hadoop-hdfs/ hadoop-hdfs/src/ hadoop-hdfs/src/contrib/fuse-dfs/ hadoop-hdfs/src/contrib/fuse-dfs/src/ hadoop-hdfs/src/main/native/ hadoop-hdfs/src/main/native/m4/
Date Sat, 02 Jun 2012 02:34:41 GMT
Author: tucu
Date: Sat Jun  2 02:34:38 2012
New Revision: 1345421

URL: http://svn.apache.org/viewvc?rev=1345421&view=rev
Log:
HADOOP-8368. Use CMake rather than autotools to build native code (ccccabe via tucu)

Added:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/config.h.cmake
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/CMakeLists.txt
Removed:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/Makefile.am
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/acinclude.m4
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/configure.ac
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/pom.xml
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/Makefile.am
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/configure.ac
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/m4/apfunctions.m4
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/m4/apjava.m4
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/m4/apsupport.m4
Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/pom.xml
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_dfs.h
    hadoop/common/trunk/hadoop-hdfs-project/pom.xml

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/pom.xml?rev=1345421&r1=1345420&r2=1345421&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/pom.xml (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/pom.xml Sat Jun  2 02:34:38 2012
@@ -415,76 +415,22 @@ http://maven.apache.org/xsd/maven-4.0.0.
             <artifactId>maven-antrun-plugin</artifactId>
             <executions>
               <execution>
-                <id>compile</id>
+                <id>make</id>
                 <phase>compile</phase>
-                <goals>
-                  <goal>run</goal>
-                </goals>
+                <goals><goal>run</goal></goals>
                 <configuration>
                   <target>
-                    <copy toDir="${project.build.directory}/native">
-                      <fileset dir="${basedir}/src/main/native"/>
-                    </copy>
-                    <mkdir dir="${project.build.directory}/native/m4"/>
+                    <mkdir dir="${project.build.directory}/native"/>
+                    <exec executable="cmake" dir="${project.build.directory}/native" 
+                        failonerror="true">
+                      <arg line="${basedir}/src/ -DGENERATED_JAVAH=${project.build.directory}/native/javah
-DJVM_ARCH_DATA_MODEL=${sun.arch.data.model}"/>
+                    </exec>
+                    <exec executable="make" dir="${project.build.directory}/native" failonerror="true">
+                      <arg line="VERBOSE=1"/>
+                    </exec>
                   </target>
                 </configuration>
               </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>make-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>compile</id>
-                <phase>compile</phase>
-                <goals>
-                  <goal>autoreconf</goal>
-                  <goal>configure</goal>
-                  <goal>make-install</goal>
-                </goals>
-                <configuration>
-                  <!-- autoreconf settings -->
-                  <workDir>${project.build.directory}/native</workDir>
-                  <arguments>
-                    <argument>-i</argument>
-                    <argument>-f</argument>
-                  </arguments>
-
-                  <!-- configure settings -->
-                  <configureEnvironment>
-                    <property>
-                      <name>ac_cv_func_malloc_0_nonnull</name>
-                      <value>yes</value>
-                    </property>
-                    <property>
-                      <name>JVM_ARCH</name>
-                      <value>${sun.arch.data.model}</value>
-                    </property>
-                  </configureEnvironment>
-                  <configureOptions>
-                  </configureOptions>
-                  <configureWorkDir>${project.build.directory}/native</configureWorkDir>
-                  <prefix>/usr/local</prefix>
-
-                  <!-- make settings -->
-                  <installEnvironment>
-                    <property>
-                      <name>ac_cv_func_malloc_0_nonnull</name>
-                      <value>yes</value>
-                    </property>
-                    <property>
-                      <name>JVM_ARCH</name>
-                      <value>${sun.arch.data.model}</value>
-                    </property>
-                  </installEnvironment>
-
-                  <!-- configure & make settings -->
-                  <destDir>${project.build.directory}/native/target</destDir>
-
-                </configuration>
-              </execution>
-              
               <!-- TODO wire here native testcases
               <execution>
                 <id>test</id>
@@ -541,7 +487,7 @@ http://maven.apache.org/xsd/maven-4.0.0.
             <artifactId>maven-antrun-plugin</artifactId>
             <executions>
               <execution>
-                <id>compile</id>
+                <id>kdc</id>
                 <phase>compile</phase>
                 <goals>
                   <goal>run</goal>

Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt?rev=1345421&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt (added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt Sat Jun  2 02:34:38
2012
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# Default to release builds
+set(CMAKE_BUILD_TYPE, Release)
+
+# If JVM_ARCH_DATA_MODEL is 32, compile all binaries as 32-bit.
+# This variable is set by maven.
+if (JVM_ARCH_DATA_MODEL EQUAL 32)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+    set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -m32")
+endif (JVM_ARCH_DATA_MODEL EQUAL 32)
+
+# Compile a library with both shared and static variants
+function(add_dual_library LIBNAME)
+    add_library(${LIBNAME} SHARED ${ARGN})
+    add_library(${LIBNAME}_static STATIC ${ARGN})
+    set_target_properties(${LIBNAME}_static PROPERTIES OUTPUT_NAME ${LIBNAME})
+endfunction(add_dual_library)
+
+# Link both a static and a dynamic target against some libraries
+function(target_link_dual_libraries LIBNAME)
+    target_link_libraries(${LIBNAME} ${ARGN})
+    target_link_libraries(${LIBNAME}_static ${ARGN})
+endfunction(target_link_dual_libraries)
+
+function(output_directory TGT DIR)
+    SET_TARGET_PROPERTIES(${TGT} PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
+    SET_TARGET_PROPERTIES(${TGT} PROPERTIES
+        ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
+    SET_TARGET_PROPERTIES(${TGT} PROPERTIES
+        LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
+endfunction(output_directory TGT DIR)
+
+function(dual_output_directory TGT DIR)
+    output_directory(${TGT} "${DIR}")
+    output_directory(${TGT}_static "${DIR}")
+endfunction(dual_output_directory TGT DIR)
+
+# Flatten a list into a string.
+function(FLATTEN_LIST INPUT SEPARATOR OUTPUT)
+  string (REPLACE ";" "${SEPARATOR}" _TMPS "${INPUT}")
+  set (${OUTPUT} "${_TMPS}" PARENT_SCOPE)
+endfunction()
+
+find_package(JNI REQUIRED)
+if (NOT GENERATED_JAVAH)
+    # Must identify where the generated headers have been placed
+    MESSAGE(FATAL_ERROR "You must set the CMake variable GENERATED_JAVAH")
+endif (NOT GENERATED_JAVAH)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O2 -D_GNU_SOURCE")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_REENTRANT -D_FILE_OFFSET_BITS=64")
+
+include_directories(
+    ${GENERATED_JAVAH}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_BINARY_DIR}
+    ${JNI_INCLUDE_DIRS}
+    main/native/
+)
+
+set(_FUSE_DFS_VERSION 0.1.0)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
+
+add_dual_library(hdfs
+    main/native/hdfs.c
+    main/native/hdfsJniHelper.c
+)
+target_link_dual_libraries(hdfs
+    ${JAVA_JVM_LIBRARY}
+)
+dual_output_directory(hdfs target/usr/local/lib)
+set(LIBHDFS_VERSION "0.0.0")
+set_target_properties(hdfs PROPERTIES
+    SOVERSION ${LIBHDFS_VERSION})
+
+add_executable(hdfs_test
+    main/native/hdfs_test.c
+)
+target_link_libraries(hdfs_test
+    hdfs
+    ${JAVA_JVM_LIBRARY}
+)
+output_directory(hdfs_test target/usr/local/bin)
+
+add_executable(hdfs_read
+    main/native/hdfs_read.c
+)
+target_link_libraries(hdfs_read
+    hdfs
+    ${JAVA_JVM_LIBRARY}
+)
+output_directory(hdfs_read target/usr/local/bin)
+
+add_executable(hdfs_write
+    main/native/hdfs_write.c
+)
+target_link_libraries(hdfs_write
+    hdfs
+    ${JAVA_JVM_LIBRARY}
+)
+output_directory(hdfs_write target/usr/local/bin)
+
+add_subdirectory(contrib/fuse-dfs/src)

Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/config.h.cmake
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/config.h.cmake?rev=1345421&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/config.h.cmake (added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/config.h.cmake Sat Jun  2 02:34:38
2012
@@ -0,0 +1,6 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#cmakedefine _FUSE_DFS_VERSION "@_FUSE_DFS_VERSION@"
+
+#endif

Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/CMakeLists.txt?rev=1345421&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/CMakeLists.txt
(added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/CMakeLists.txt
Sat Jun  2 02:34:38 2012
@@ -0,0 +1,73 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Find Linux FUSE
+IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(FUSE fuse)
+    IF(FUSE_FOUND)
+        FLATTEN_LIST("${FUSE_CFLAGS}" " " FUSE_CFLAGS)
+        FLATTEN_LIST("${FUSE_LDFLAGS}" " " FUSE_LDFLAGS)
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUSE_CFLAGS}")
+        set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} ${FUSE_LDFLAGS}")
+        MESSAGE(STATUS "Building Linux FUSE client.")
+        include_directories(${FUSE_INCLUDE_DIRS})
+    ELSE(FUSE_FOUND)
+        MESSAGE(STATUS "Failed to find Linux FUSE libraries or include files.  Will not build
FUSE client.")
+    ENDIF(FUSE_FOUND)
+ELSE (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+    MESSAGE(STATUS "Non-Linux system detected.  Will not build FUSE client.")
+ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+IF(FUSE_FOUND)
+    add_executable(fuse_dfs
+        fuse_dfs.c
+        fuse_options.c 
+        fuse_connect.c 
+        fuse_impls_access.c 
+        fuse_impls_chmod.c  
+        fuse_impls_chown.c  
+        fuse_impls_create.c  
+        fuse_impls_flush.c 
+        fuse_impls_getattr.c  
+        fuse_impls_mkdir.c  
+        fuse_impls_mknod.c  
+        fuse_impls_open.c 
+        fuse_impls_read.c 
+        fuse_impls_readdir.c 
+        fuse_impls_release.c 
+        fuse_impls_rename.c 
+        fuse_impls_rmdir.c 
+        fuse_impls_statfs.c 
+        fuse_impls_symlink.c 
+        fuse_impls_truncate.c 
+        fuse_impls_unlink.c 
+        fuse_impls_utimens.c  
+        fuse_impls_write.c
+        fuse_init.c 
+        fuse_stat_struct.c 
+        fuse_trash.c 
+        fuse_users.c 
+    )
+    target_link_libraries(fuse_dfs
+        ${FUSE_LIBRARIES}
+        ${JAVA_JVM_LIBRARY}
+        hdfs
+        m
+    )
+ENDIF(FUSE_FOUND)

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_dfs.h
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_dfs.h?rev=1345421&r1=1345420&r2=1345421&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_dfs.h
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_dfs.h
Sat Jun  2 02:34:38 2012
@@ -31,13 +31,9 @@
 #include <fuse.h>
 #include <fuse/fuse_opt.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_SETXATTR
 #include <sys/xattr.h>
-#endif
+
+#include "config.h"
 
 //
 // Check if a path is in the mount option supplied protected paths.

Modified: hadoop/common/trunk/hadoop-hdfs-project/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/pom.xml?rev=1345421&r1=1345420&r2=1345421&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/pom.xml (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/pom.xml Sat Jun  2 02:34:38 2012
@@ -34,7 +34,6 @@ http://maven.apache.org/xsd/maven-4.0.0.
     <module>hadoop-hdfs</module>
     <module>hadoop-hdfs-httpfs</module>
     <module>hadoop-hdfs/src/contrib/bkjournal</module>
-    <module>hadoop-hdfs/src/contrib/fuse-dfs</module>
   </modules>
 
   <build>



Mime
View raw message