Переглянути джерело

HADOOP-3123. Fix the native library build scripts to work on Solaris.
Contributed by Tom White.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@644621 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 17 роки тому
батько
коміт
b5cfc7aa6f
5 змінених файлів з 28 додано та 24 видалено
  1. 3 0
      CHANGES.txt
  2. 9 8
      build.xml
  3. 4 4
      src/native/acinclude.m4
  4. 8 8
      src/native/configure
  5. 4 4
      src/native/packageNativeHadoop.sh

+ 3 - 0
CHANGES.txt

@@ -458,6 +458,9 @@ Trunk (unreleased changes)
     HADOOP-2927. Fix TestDU to acurately calculate the expected file size.
     (shv via nigel)
 
+    HADOOP-3123. Fix the native library build scripts to work on Solaris.
+    (tomwhite via omalley)
+
 Release 0.16.2 - 2008-04-02
 
   BUG FIXES

+ 9 - 8
build.xml

@@ -119,6 +119,7 @@
   <property name="svn.cmd" value="svn"/>
   <property name="grep.cmd" value="grep"/>
   <property name="patch.cmd" value="patch"/>
+  <property name="make.cmd" value="make"/>
 
 
   <available property="clover.present" classname="com.cenqua.clover.tasks.CloverReportTask" />
@@ -348,7 +349,7 @@
 	  <arg line="${native.src.dir}/configure"/>
     </exec>
 
-    <exec dir="${build.native}" executable="make" failonerror="true">
+    <exec dir="${build.native}" executable="${make.cmd}" failonerror="true">
       <env key="OS_NAME" value="${os.name}"/>
       <env key="OS_ARCH" value="${os.arch}"/>
   	  <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
@@ -907,7 +908,7 @@
   <!-- ================================================================== -->
   <target name="compile-libhdfs" depends="init">
     <mkdir dir="${build.libhdfs}"/>
-    <exec dir="${libhdfs.src}" executable="make" failonerror="true">
+    <exec dir="${libhdfs.src}" executable="${make.cmd}" failonerror="true">
       <env key="OS_NAME" value="${os.name}"/>
       <env key="OS_ARCH" value="${os.arch}"/>
       <env key="SHLIB_VERSION" value="${libhdfs.version}"/>
@@ -921,7 +922,7 @@
     <mkdir dir="${libhdfs.test.dir}/logs"/>
     <mkdir dir="${libhdfs.test.dir}/dfs/name"/>
 
-    <exec dir="${libhdfs.src}" executable="make" failonerror="true">
+    <exec dir="${libhdfs.src}" executable="${make.cmd}" failonerror="true">
         <env key="OS_NAME" value="${os.name}"/>
         <env key="OS_ARCH" value="${os.arch}"/>
         <env key="SHLIB_VERSION" value="${libhdfs.version}"/>
@@ -934,14 +935,14 @@
   </target>
 	
   <target name="clean-libhdfs">
-    <exec dir="${libhdfs.src}" executable="make">
+    <exec dir="${libhdfs.src}" executable="${make.cmd}">
       <env key="LIBHDFS_BUILD_DIR" value="${build.libhdfs}"/>
     	<arg value="clean"/>
     </exec>
   </target>
 
   <target name="doc-libhdfs" depends="compile-libhdfs">
-	<exec dir="${libhdfs.src}" executable="make">
+	<exec dir="${libhdfs.src}" executable="${make.cmd}">
 	  <arg value="doc"/>
 	</exec>
   </target>
@@ -1003,7 +1004,7 @@
 
   <target name="compile-c++-utils" depends="create-c++-utils-makefile"
                                    if="compile.c++">
-    <exec executable="make" dir="${build.c++.utils}" searchpath="yes" 
+    <exec executable="${make.cmd}" dir="${build.c++.utils}" searchpath="yes" 
           failonerror="yes">
       <arg  value="install"/>
     </exec>
@@ -1021,7 +1022,7 @@
   <target name="compile-c++-pipes" 
           depends="create-c++-pipes-makefile,compile-c++-utils"
           if="compile.c++">
-    <exec executable="make" dir="${build.c++.pipes}" searchpath="yes" 
+    <exec executable="${make.cmd}" dir="${build.c++.pipes}" searchpath="yes" 
           failonerror="yes">
       <arg value="install"/>
     </exec>
@@ -1046,7 +1047,7 @@
   <target name="compile-c++-examples-pipes" 
           depends="create-c++-examples-pipes-makefile,compile-c++-pipes"
           if="compile.c++">
-    <exec executable="make" dir="${build.c++.examples.pipes}" searchpath="yes" 
+    <exec executable="${make.cmd}" dir="${build.c++.examples.pipes}" searchpath="yes" 
           failonerror="yes">
       <arg  value="install"/>
     </exec>

+ 4 - 4
src/native/acinclude.m4

@@ -7,12 +7,12 @@ AC_DEFUN([AC_COMPUTE_NEEDED_DSO],
 AC_CACHE_CHECK([Checking for the 'actual' dynamic-library for '-l$1'], ac_cv_libname_$1,
   [
   echo 'int main(int argc, char **argv){return 0;}' > conftest.c
-  if test -z "`${CC} -o conftest conftest.c -l$1 2>&1`"; then
+  if test -z "`${CC} ${LDFLAGS} -o conftest conftest.c -l$1 2>&1`"; then
     dnl Try objdump and ldd in that order to get the dynamic library
-    if test ! -z "`which objdump`"; then
+    if test ! -z "`which objdump | grep -v 'no objdump'`"; then
       ac_cv_libname_$1="`objdump -p conftest | grep NEEDED | grep $1 | sed 's/\W*NEEDED\W*\(.*\)\W*$/\"\1\"/'`"
-    elif test ! -z "`which ldd`"; then
-      ac_cv_libname_$1="`ldd conftest | grep $1 | sed 's/^\W*\(\w*z\.\w*\(\.\w*\)\?\)\W*=>.*$/\"\1\"/'`"
+    elif test ! -z "`which ldd | grep -v 'no ldd'`"; then
+      ac_cv_libname_$1="`ldd conftest | grep $1 | sed 's/^[[[^A-Za-z0-9]]]*\([[[A-Za-z0-9\.]]]*\)[[[^A-Za-z0-9]]]*=>.*$/\"\1\"/'`"
     else
       AC_MSG_ERROR(Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-l$1')
     fi

+ 8 - 8
src/native/configure

@@ -19516,11 +19516,11 @@ if test "${ac_cv_libname_z+set}" = set; then
 else
 
   echo 'int main(int argc, char **argv){return 0;}' > conftest.c
-  if test -z "`${CC} -o conftest conftest.c -lz 2>&1`"; then
-        if test ! -z "`which objdump`"; then
+  if test -z "`${CC} ${LDFLAGS} -o conftest conftest.c -lz 2>&1`"; then
+        if test ! -z "`which objdump | grep -v 'no objdump'`"; then
       ac_cv_libname_z="`objdump -p conftest | grep NEEDED | grep z | sed 's/\W*NEEDED\W*\(.*\)\W*$/\"\1\"/'`"
-    elif test ! -z "`which ldd`"; then
-      ac_cv_libname_z="`ldd conftest | grep z | sed 's/^\W*\(\w*z\.\w*\(\.\w*\)\?\)\W*=>.*$/\"\1\"/'`"
+    elif test ! -z "`which ldd | grep -v 'no ldd'`"; then
+      ac_cv_libname_z="`ldd conftest | grep z | sed 's/^[^A-Za-z0-9]*\([A-Za-z0-9\.]*\)[^A-Za-z0-9]*=>.*$/\"\1\"/'`"
     else
       { { echo "$as_me:$LINENO: error: Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-lz'" >&5
 echo "$as_me: error: Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-lz'" >&2;}
@@ -19712,11 +19712,11 @@ if test "${ac_cv_libname_lzo2+set}" = set; then
 else
 
   echo 'int main(int argc, char **argv){return 0;}' > conftest.c
-  if test -z "`${CC} -o conftest conftest.c -llzo2 2>&1`"; then
-        if test ! -z "`which objdump`"; then
+  if test -z "`${CC} ${LDFLAGS} -o conftest conftest.c -llzo2 2>&1`"; then
+        if test ! -z "`which objdump | grep -v 'no objdump'`"; then
       ac_cv_libname_lzo2="`objdump -p conftest | grep NEEDED | grep lzo2 | sed 's/\W*NEEDED\W*\(.*\)\W*$/\"\1\"/'`"
-    elif test ! -z "`which ldd`"; then
-      ac_cv_libname_lzo2="`ldd conftest | grep lzo2 | sed 's/^\W*\(\w*z\.\w*\(\.\w*\)\?\)\W*=>.*$/\"\1\"/'`"
+    elif test ! -z "`which ldd | grep -v 'no ldd'`"; then
+      ac_cv_libname_lzo2="`ldd conftest | grep lzo2 | sed 's/^[^A-Za-z0-9]*\([A-Za-z0-9\.]*\)[^A-Za-z0-9]*=>.*$/\"\1\"/'`"
     else
       { { echo "$as_me:$LINENO: error: Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-llzo2'" >&5
 echo "$as_me: error: Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-llzo2'" >&2;}

+ 4 - 4
src/native/packageNativeHadoop.sh

@@ -27,8 +27,8 @@
 # All these are setup by build.xml.
 #
 
-TAR='tar -c'
-UNTAR='tar -x'
+TAR='tar cf -'
+UNTAR='tar xfBp -'
 
 # Copy the pre-built libraries in $BASE_NATIVE_LIB_DIR
 if [ -d $BASE_NATIVE_LIB_DIR ]
@@ -42,7 +42,7 @@ then
     fi
     echo "Copying libraries in $BASE_NATIVE_LIB_DIR/$platform to $DIST_LIB_DIR/$platform/"
     cd $BASE_NATIVE_LIB_DIR/$platform/
-    $TAR *hadoop* | $UNTAR -C $DIST_LIB_DIR/$platform/
+    $TAR *hadoop* | (cd $DIST_LIB_DIR/$platform/; $UNTAR)
   done
 fi
 
@@ -58,7 +58,7 @@ then
     fi
     echo "Copying libraries in $BUILD_NATIVE_DIR/$platform/lib to $DIST_LIB_DIR/$platform/"
     cd $BUILD_NATIVE_DIR/$platform/lib
-    $TAR *hadoop* | $UNTAR -C $DIST_LIB_DIR/$platform/
+    $TAR *hadoop* | (cd $DIST_LIB_DIR/$platform/; $UNTAR)
   done  
 fi