aboutsummaryrefslogtreecommitdiffstats
path: root/devel/hadoop2/Makefile
blob: 7f5f971b63ea1f07a1ada1f2b63c281f204fa36b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Created by: Dmitry Sivachenko <demon@FreeBSD.org>
# $FreeBSD$

# Please do not submit untested updates.  Be sure to start hadoop in
# distributed mode and to run few map/reduce.  Be sure there are no exception
# in any of it's log files.  This version was tested under the load and
# no problems encountered so far.  Thanks.
PORTNAME=   hadoop
PORTVERSION=    2.7.2
CATEGORIES= devel java
MASTER_SITES=   APACHE/${PORTNAME}/common/stable \
        LOCAL/demon/:maven \
        http://archive.apache.org/dist/tomcat/tomcat-6/v${TOMCAT_VERSION}/bin/:tomcat \
        http://dist.codehaus.org/jetty/jetty-6.1.14/:jetty
PKGNAMESUFFIX=  2
DISTNAME=   ${PORTNAME}-${PORTVERSION}-src
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX} FreeBSD-hadoop2-${PORTVERSION}-maven-repository.tar.gz:maven apache-tomcat-${TOMCAT_VERSION}.tar.gz:tomcat jetty-6.1.14.zip:jetty
DIST_SUBDIR=    hadoop
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX} FreeBSD-hadoop2-${PORTVERSION}-maven-repository.tar.gz jetty-6.1.14.zip

MAINTAINER= demon@FreeBSD.org
COMMENT=    Apache Map/Reduce framework

LICENSE=    APACHE20

BUILD_DEPENDS=  ${LOCALBASE}/share/java/maven3/bin/mvn:${PORTSDIR}/devel/maven3 \
        cmake:${PORTSDIR}/devel/cmake \
        ${LOCALBASE}/protobuf25/bin/protoc:${PORTSDIR}/devel/protobuf25
LIB_DEPENDS=    libsnappy.so:${PORTSDIR}/archivers/snappy
RUN_DEPENDS=    bash:${PORTSDIR}/shells/bash \
        ssid:${PORTSDIR}/sysutils/ssid

BROKEN_FreeBSD_9=   fails to build

CONFLICTS_INSTALL=  hadoop-1*

USES=       cpe shebangfix
CPE_VENDOR= apache
USE_JAVA=   yes
JAVA_VERSION=   1.7
USE_LDCONFIG=   yes
SHEBANG_FILES=  hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/libexec/httpfs-config.sh hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/conf/httpfs-env.sh hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh hadoop-common-project/hadoop-kms/src/main/libexec/kms-config.sh hadoop-common-project/hadoop-kms/src/main/conf/kms-env.sh hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh
MAKE_ENV+=  JAVA_HOME=${JAVA_HOME} HADOOP_PROTOC_PATH=${LOCALBASE}/protobuf25/bin/protoc

OPTIONS_DEFINE=     EXAMPLES
OPTIONS_DEFAULT=    EXAMPLES

TOMCAT_VERSION= 6.0.44
HADOOP_DIST=    ${WRKSRC}/hadoop-dist/target/hadoop-${PORTVERSION}

HADOOP_LOGDIR=  /var/log/hadoop
HADOOP_RUNDIR=  /var/run/hadoop

HDFS_USER=  hdfs
MAPRED_USER=    mapred
HADOOP_GROUP=   hadoop
USERS=      ${HDFS_USER} ${MAPRED_USER}
GROUPS=     ${HADOOP_GROUP}

SUB_FILES=  hadoop-layout.sh
USE_RC_SUBR=    historyserver nodemanager resourcemanager webappproxyserver datanode namenode secondarynamenode journalnode zkfc

PLIST_SUB=  PORTVERSION="${PORTVERSION}" \
        HADOOP_LOGDIR="${HADOOP_LOGDIR}" \
        HADOOP_RUNDIR="${HADOOP_RUNDIR}" \
        HDFS_USER="${HDFS_USER}" \
        MAPRED_USER="${MAPRED_USER}" \
        HADOOP_GROUP="${HADOOP_GROUP}"
SUB_LIST=   HDFS_USER="${HDFS_USER}" \
        MAPRED_USER="${MAPRED_USER}" \
        HADOOP_GROUP="${HADOOP_GROUP}" \
        JAVA_HOME="${JAVA_HOME}" \
        HADOOP_LOGDIR="${HADOOP_LOGDIR}" \
        HADOOP_RUNDIR="${HADOOP_RUNDIR}"

post-patch:
    ${REINPLACE_CMD} -e "s#/bin/bash#${LOCALBASE}/bin/bash#" ${WRKSRC}/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java ${WRKSRC}/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java ${WRKSRC}/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java ${WRKSRC}/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java ${WRKSRC}/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh

do-build:
    ${MKDIR} ${WRKSRC}/hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/apache-tomcat-${TOMCAT_VERSION}.tar.gz ${WRKSRC}/hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads/
    ${MKDIR} ${WRKSRC}/hadoop-common-project/hadoop-kms/downloads
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/apache-tomcat-${TOMCAT_VERSION}.tar.gz ${WRKSRC}/hadoop-common-project/hadoop-kms/downloads/
    cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${LOCALBASE}/share/java/maven3/bin/mvn -Dmaven.repo.local=${WRKDIR}/m2 --offline package -Pdist,native -DskipTests -Drequire.snappy -Dsnappy.prefix=${LOCALBASE} -Drequire.openssl

post-build:
    ${RM} ${HADOOP_DIST}/etc/hadoop/*.cmd
    ${MV} ${HADOOP_DIST}/bin/rcc ${HADOOP_DIST}/bin/hadoop-rcc
# With jetty-6.1.26 tasktracker's threads hung with the following error:
# org.mortbay.io.nio.SelectorManager$SelectSet@abdcc1c JVM BUG(s) - injecting delay 59 times
# See https://issues.apache.org/jira/browse/MAPREDUCE-2386
.for dir in share/hadoop/common/lib share/hadoop/hdfs/lib share/hadoop/yarn/lib share/hadoop/tools/lib
    ${RM} ${HADOOP_DIST}/${dir}/jetty-util-6.1.26.jar ${HADOOP_DIST}/${dir}/jetty-6.1.26.jar
    ${CP} ${WRKDIR}/jetty-6.1.14/lib/jetty-6.1.14.jar ${WRKDIR}/jetty-6.1.14/lib/jetty-util-6.1.14.jar ${HADOOP_DIST}/${dir}/
.endfor
.for dir in share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/lib share/hadoop/kms/tomcat/webapps/kms/WEB-INF/lib
    ${RM} ${HADOOP_DIST}/${dir}/jetty-util-6.1.26.jar
    ${CP} ${WRKDIR}/jetty-6.1.14/lib/jetty-util-6.1.14.jar ${HADOOP_DIST}/${dir}/
.endfor

do-install:
    cd ${HADOOP_DIST}/bin && ${INSTALL_SCRIPT} hadoop hdfs mapred hadoop-rcc yarn ${STAGEDIR}${PREFIX}/bin/
    cd ${HADOOP_DIST} && ${COPYTREE_BIN} "libexec sbin" ${STAGEDIR}${PREFIX}/ "! -name *.cmd"
    cd ${HADOOP_DIST}/include && ${INSTALL_DATA} *h ${STAGEDIR}${PREFIX}/include/
    cd ${HADOOP_DIST}/lib/native && ${INSTALL_DATA} *.a ${STAGEDIR}${PREFIX}/lib/
    cd ${HADOOP_DIST}/lib/native && ${INSTALL_DATA} libhadoop.so.1.0.0 ${STAGEDIR}${PREFIX}/lib/libhadoop.so.1
    cd ${HADOOP_DIST}/lib/native && ${INSTALL_DATA} libhdfs.so.0.0.0 ${STAGEDIR}${PREFIX}/lib/libhdfs.so.0
    ${LN} -sf libhdfs.so.0 ${STAGEDIR}${PREFIX}/lib/libhdfs.so
    ${LN} -sf libhadoop.so.1 ${STAGEDIR}${PREFIX}/lib/libhadoop.so
    cd ${HADOOP_DIST}/share/hadoop && ${COPYTREE_SHARE} "*" ${STAGEDIR}${DATADIR}/ "! -name *-sources.jar -and ! -name sources"
    ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/conf
    cd ${HADOOP_DIST}/etc/hadoop && ${COPYTREE_SHARE} "*" ${STAGEDIR}${EXAMPLESDIR}/conf/
    ${INSTALL_DATA} ${WRKSRC}/hadoop-hdfs-project/hadoop-hdfs/target/classes/hdfs-default.xml ${WRKSRC}/hadoop-hdfs-project/hadoop-hdfs-httpfs/target/classes/httpfs-default.xml ${WRKSRC}/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/target/classes/yarn-default.xml ${WRKSRC}/hadoop-common-project/hadoop-common/target/classes/core-default.xml ${WRKSRC}/hadoop-tools/hadoop-distcp/target/classes/distcp-default.xml ${WRKSRC}/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/target/classes/mapred-default.xml ${STAGEDIR}/${EXAMPLESDIR}/
    ${INSTALL_DATA} ${WRKDIR}/hadoop-layout.sh ${STAGEDIR}${PREFIX}/libexec/
    ${MKDIR} ${STAGEDIR}${ETCDIR}
    ${MKDIR} ${STAGEDIR}${HADOOP_LOGDIR}
    ${MKDIR} ${STAGEDIR}${HADOOP_RUNDIR}

.include <bsd.port.mk>