updated on Sun Jan 8 20:02:33 UTC 2012
[aur-mirror.git] / hadoop / PKGBUILD
blob4fe0cb31c47570c778e80cd5697eae463ed65166
1 # Contributor: Mantas Vidutis <mantas.a.vidutis-at-gmail.com>
3 pkgname=hadoop
4 pkgver=0.21.0
5 _devver=0.21.1-dev
6 pkgrel=1
7 pkgdesc="Hadoop - MapReduce implementation and distributed filesystem"
8 arch=('i686' 'x86_64')
9 url="http://hadoop.apache.org"
10 license=('APACHE')
11 depends=('jre' 'zlib' 'gzip' 'lzo' 'bzip2')
12 makedepends=('jdk' 'apache-ant')
13 optdepends=('kfs')
14 conflicts=('hadoop-svn')
15 install=hadoop.install
16 source=("http://mirror.csclub.uwaterloo.ca/apache/hadoop/common/hadoop-${pkgver}/hadoop-${pkgver}.tar.gz")
17 md5sums=('ec0f791f866f82a7f2c1319a54f4db97')
19 #https://issues.apache.org/jira/secure/attachment/12394365/patch.4697
20 #https://issues.apache.org/jira/secure/attachment/12400552/patch.5292
22 compile() {
23   cd ${srcdir}/hadoop-${pkgver} || return 1
25   msg "Cleaning..."
27   ant clean || return 1
29   msg "Patching..."
31   sed -i "s/${_devver}/${pkgver}/" build.xml
33 #  patch -Np0 -i ${srcdir}/progressReporter.patch || return 1
34 #  patch -Np0 -i ${srcdir}/patch.5292 || return 1
36   sed -i "s|<ivysettings>|<ivysettings>\n<caches defaultCacheDir=\"${srcdir}/ivy_cache\"/>|" ivy/ivysettings.xml
38   msg "Building..."
40   ant -Dcompile.native=true bin-package || return 1
42   cd ${srcdir}/hadoop-${pkgver}/build || return 1
44   msg "Installing..."
46   mkdir -p ${pkgdir}/usr/share
47   mkdir -p ${pkgdir}/etc/hadoop
49   mv hadoop-${pkgver} ${pkgdir}/usr/share/hadoop || return 1
50   mv ${pkgdir}/usr/share/hadoop/conf ${pkgdir}/etc/hadoop/default || return 1
53 use_compiled() {
54   msg "Installing..."
56   mkdir -p ${pkgdir}/usr/share/hadoop
57   mkdir -p ${pkgdir}/etc/hadoop
59   cd ${srcdir}/hadoop-${pkgver}
61   mv bin lib webapps *.jar *.txt ${pkgdir}/usr/share/hadoop/ || return 1
62   mv conf ${pkgdir}/etc/hadoop/default || return 1
65 build() {
66   # compile
67   use_compiled
69   msg "Configuring..."
71   cd ${pkgdir}/etc/hadoop/default || return 1
73   # Set Java home:
74   echo 'export JAVA_HOME=/opt/java/jre' >> hadoop-env.sh
76   # Set directories:
77   echo 'export HADOOP_LOG_DIR="/var/log/hadoop"' >> hadoop-env.sh
78   echo 'export HADOOP_PID_DIR="/var/run"' >> hadoop-env.sh
80   # Disable IPv6 (comment out for IPv6 support):
81   sed -i 's|_OPTS="-D|_OPTS="-Djava.net.preferIPv4Stack=true -D|' hadoop-env.sh
83   cd ${pkgdir}/usr/share/hadoop || return 1
85   sed -i 's#^export HADOOP_HOME=`dirname "$this"`/..#export HADOOP_HOME="/usr/share/hadoop"\nexport HADOOP_CONF_DIR="/etc/hadoop"#' bin/hadoop-config.sh
87   if [ "$CARCH" = "i686" ]; then
88     rm -rf lib/native/Linux-amd64-64
89     cd lib/native/Linux-i386-32
90     sed -i "s|dependency_libs='|dependency_libs='-L/opt/java/jre/lib/i386/server |" libhadoop.la
91   fi
93   if [ "$CARCH" = "x86_64" ]; then
94     rm -rf lib/native/Linux-i386-32
95     cd lib/native/Linux-amd64-64
96     sed -i "s|dependency_libs='|dependency_libs='-L/opt/java/jre/lib/amd64/server |" libhadoop.la
97   fi
99   # Create some links, so Hadoop's KFS jar could access KFS libraries properly
100   # (it is still fine if KFS is not installed)
102   msg "Creating KFS links..."
104   for lib in libkfsClient libkfsCommon libkfsEmulator libkfsIO libkfsMeta; do
105     for ext in a so; do
106       ln -s /usr/lib/${lib}.${ext}
107     done
108   done
110   ln -s /usr/lib/libkfs_access.so