[97460] trunk/dports/java/hadoop

hum at macports.org hum at macports.org
Thu Sep 6 19:56:35 PDT 2012


Revision: 97460
          https://trac.macports.org/changeset/97460
Author:   hum at macports.org
Date:     2012-09-06 19:56:35 -0700 (Thu, 06 Sep 2012)
Log Message:
-----------
hadoop: fetch the source tarball and build and install native libraries into ${prefix}/lib (See #35902); add patch-native.diff and dependencies; install documents into ${prefix}/share/doc/${distname}.

Modified Paths:
--------------
    trunk/dports/java/hadoop/Portfile

Added Paths:
-----------
    trunk/dports/java/hadoop/files/patch-native.diff

Modified: trunk/dports/java/hadoop/Portfile
===================================================================
--- trunk/dports/java/hadoop/Portfile	2012-09-07 02:55:47 UTC (rev 97459)
+++ trunk/dports/java/hadoop/Portfile	2012-09-07 02:56:35 UTC (rev 97460)
@@ -5,7 +5,7 @@
 
 name                hadoop
 version             1.0.3
-revision            1
+revision            2
 categories          java devel science
 maintainers         hum openmaintainer
 
@@ -16,14 +16,21 @@
 
 homepage            http://hadoop.apache.org/
 platforms           darwin
-supported_archs     noarch
 license             Apache-2
 
 master_sites        apache:hadoop/common/${distname}
-distfiles           ${distname}-bin${extract.suffix}
-checksums           rmd160  a98ca552a8a6dfcc6455b53cfd7988d562c265d1 \
-                    sha256  a33d07ece0e9b7e1ecf32670cac28444ba8f56b3360548d96b56964facc2d1ef
+checksums           rmd160  e41421483156fd0fa65d608b206a17cd2a73a989 \
+                    sha256  716ab51f75ffb70343c3cca02f7ba4722f42376edb67eecbd42a426a054e6423
 
+patchfiles          patch-hadoop-env.sh.diff \
+                    patch-native.diff
+
+depends_build       bin:ant:apache-ant
+depends_lib         port:zlib \
+                    port:snappy
+
+set java_home       /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
+
 pre-fetch {
     # This port works on Mac OS X 10.6 or later, because 'sudo option -E'
     # is not available on Mac OS X 10.5 or earlier. See #34665.
@@ -31,44 +38,66 @@
         ui_error "This port works on Mac OS X 10.6 (Snow Leopard) or later"
         return -code error "Mac OS X 10.6 (Snow Leopard) or later is required"
     }
+    if {![file exists ${java_home}]} {
+        ui_error "Java 1.6 is required, but not located at ${java_home}"
+        return -code error "Java 1.6 missing"
+    }
 }
 
-patchfiles          patch-hadoop-env.sh.diff
+universal_variant   no
 
 use_configure       no
 
-build {}
+build.cmd           ant
+build.args          -Dcompile.native=true \
+                    -Dsnappy.prefix=${prefix} \
+                    -Dinstall.native=${prefix}
+build.target        compile
 
-set hadoopuser      hadoop
-
-set java_home       /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
-
-pre-configure {
-    if {![file exists ${java_home}]} {
-        ui_error "Java 1.6 is required, but not located at ${java_home}"
-        return -code error "Java 1.6 missing"
-    }
-}
-
 # Hadoop home and conf directories.
 set hadoop_basedir  ${prefix}/share/java
 set hadoop_home     ${hadoop_basedir}/${distname}
 set hadoop_conf_dir ${hadoop_home}/conf
 
+# Document directory.
+set hadoop_doc_dir  ${prefix}/share/doc/${distname}
+
 # Working directories.
 set hadoop_var_dir  ${prefix}/var/${name}
 set hadoop_log_dir  ${hadoop_var_dir}/log
 set hadoop_pid_dir  ${hadoop_var_dir}/run
 
+set hadoopuser      hadoop
+
 destroot {
     # Copy the distribution to Hadoop home directory.
-    xinstall -m 755 -d  ${destroot}${hadoop_basedir}
-    copy ${worksrcpath} ${destroot}${hadoop_basedir}
+    xinstall -m 755 -d  ${destroot}${hadoop_home}
+    foreach dir {bin conf contrib lib libexec sbin share webapps} {
+        copy ${worksrcpath}/${dir} ${destroot}${hadoop_home}
+    }
+    foreach file [glob ${worksrcpath}/hadoop-*] {
+        xinstall -m 644 ${file} ${destroot}${hadoop_home}
+    }
+    delete ${destroot}${hadoop_home}/lib/native
+    delete ${destroot}${hadoop_home}/libexec/jsvc.amd64
 
     # Patch for Mahout 0.4 to suppress warnings.
-    xinstall -m 755 -d \
-        ${destroot}${hadoop_home}/webapps/secondary/WEB-INF
+    set webinf ${destroot}${hadoop_home}/webapps/secondary/WEB-INF
+    xinstall -m 755 -d ${webinf}
+    destroot.keepdirs-append ${webinf}
 
+    # Install native libraries.
+    foreach file [glob ${worksrcpath}/build/native/**/lib/*] {
+        xinstall -m 644 ${file} ${destroot}${prefix}/lib
+    }
+    
+    # Copy extra documents.
+    xinstall -m 755 -d  ${destroot}${hadoop_doc_dir}
+    copy ${worksrcpath}/docs ${destroot}${hadoop_doc_dir}
+    foreach file [glob ${worksrcpath}/*.txt] {
+        xinstall -m 644 ${file} ${destroot}${hadoop_doc_dir}
+    }
+
     # Install an extra script for this port.
     set hadoop_bin ${destroot}${prefix}/bin/hadoop-bin
     xinstall -m 755 ${filespath}/hadoop-bin      ${hadoop_bin}

Added: trunk/dports/java/hadoop/files/patch-native.diff
===================================================================
--- trunk/dports/java/hadoop/files/patch-native.diff	                        (rev 0)
+++ trunk/dports/java/hadoop/files/patch-native.diff	2012-09-07 02:56:35 UTC (rev 97460)
@@ -0,0 +1,79 @@
+--- src/native/Makefile.am.orig	2012-05-09 05:34:52.000000000 +0900
++++ src/native/Makefile.am	2012-09-02 12:56:57.000000000 +0900
+@@ -51,7 +51,7 @@
+                        src/org/apache/hadoop/io/nativeio/errno_enum.c \
+                        src/org/apache/hadoop/io/nativeio/NativeIO.c
+ libhadoop_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS)
+-libhadoop_la_LIBADD = -ldl -ljvm
++libhadoop_la_LIBADD = -ldl
+ 
+ #
+ #vim: sw=4: ts=4: noet
+--- src/native/acinclude.m4.orig	2012-05-09 05:34:52.000000000 +0900
++++ src/native/acinclude.m4	2012-09-01 23:29:18.000000000 +0900
+@@ -13,8 +13,10 @@
+       ac_cv_libname_$1="`objdump -p conftest | grep NEEDED | grep $1 | sed 's/\W*NEEDED\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\"/'`"
++    elif test ! -z "`which otool | grep -v 'no otool'`"; then
++      ac_cv_libname_$1=\"`otool -L conftest | grep $1 | sed -e 's/^[	 ]*//' -e 's/ .*//' -e 's/.*\/\(.*\)$/\1/'`\";
+     else
+-      AC_MSG_ERROR(Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-l$1')
++      AC_MSG_ERROR(Can't find either 'objdump', 'ldd' or 'otool' to compute the dynamic library for '-l$1')
+     fi
+   else
+     ac_cv_libname_$1=libnotfound.so
+--- src/native/configure.ac.orig	2012-05-09 05:34:53.000000000 +0900
++++ src/native/configure.ac	2012-09-01 22:50:02.000000000 +0900
+@@ -54,9 +54,7 @@
+ JNI_LDFLAGS=""
+ if test $JAVA_HOME != ""
+ then
+-  JNI_LDFLAGS="-L$JAVA_HOME/jre/lib/$OS_ARCH/server"
+-  JVMSOPATH=`find $JAVA_HOME/jre/ -name libjvm.so | head -n 1`
+-  JNI_LDFLAGS="$JNI_LDFLAGS -L`dirname $JVMSOPATH`"
++  JNI_LDFLAGS="-L$JAVA_HOME/bundle/Libraries"
+ fi
+ ldflags_bak=$LDFLAGS
+ LDFLAGS="$LDFLAGS $JNI_LDFLAGS"
+@@ -73,13 +71,13 @@
+ 
+ dnl Check for JNI headers
+ JNI_CPPFLAGS=""
+-if test $JAVA_HOME != ""
+-then
+-  for dir in `find $JAVA_HOME/include -follow -type d`
++#if test $JAVA_HOME != ""
++#then
++  for dir in `find /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -follow -type d`
+   do
+     JNI_CPPFLAGS="$JNI_CPPFLAGS -I$dir"
+   done
+-fi
++#fi
+ cppflags_bak=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
+ AC_CHECK_HEADERS([jni.h], [], AC_MSG_ERROR([Native java headers not found. Is \$JAVA_HOME set correctly?]))
+--- src/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c.orig	2012-05-09 05:34:52.000000000 +0900
++++ src/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c	2012-09-01 23:46:54.000000000 +0900
+@@ -73,7 +73,8 @@
+   // was successfull or not (as long as it was called we need to call
+   // endnetgrent)
+   setnetgrentCalledFlag = 1;
+-  if(setnetgrent(cgroup) == 1) {
++  setnetgrent(cgroup);
++  if (true) {
+     UserList *current = NULL;
+     // three pointers are for host, user, domain, we only care
+     // about user now
+--- build.xml.orig	2012-05-09 05:35:00.000000000 +0900
++++ build.xml	2012-09-05 23:10:45.000000000 +0900
+@@ -680,7 +680,7 @@
+ 	  <env key="OS_ARCH" value="${os.arch}"/>
+ 	  <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
+ 	  <env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/>
+-      <arg line="${native.src.dir}/configure"/>
++      <arg line="${native.src.dir}/configure --prefix=${install.native}"/>
+     </exec>
+ 
+     <exec dir="${build.native}" executable="${make.cmd}" failonerror="true">
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120906/94ae483c/attachment-0001.html>


More information about the macports-changes mailing list