Skip to content

Instantly share code, notes, and snippets.

@dlo
Last active May 23, 2018 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlo/2d1d9aeb78d7e1f2d584cc03848632f0 to your computer and use it in GitHub Desktop.
Save dlo/2d1d9aeb78d7e1f2d584cc03848632f0 to your computer and use it in GitHub Desktop.
Homebrew recipe for hadoop 2.4.1 on macOS 10.13.4
class HadoopAT24 < Formula
desc "Framework for distributed processing of large data sets"
homepage "https://hadoop.apache.org/"
url "https://archive.apache.org/dist/hadoop/common/hadoop-2.4.1/hadoop-2.4.1-src.tar.gz"
sha256 "09f897738e9d34bceb7e7d4494bbc75e363fb32993f56dc5a6de8aab3419b990"
env :std
bottle :unneeded
depends_on :java => "1.8+"
depends_on "maven" => :build
depends_on "cmake" => :build
depends_on "zlib" => :build
depends_on "protobuf@2.5" => :build
depends_on "snappy" => :build
depends_on "openssl"
conflicts_with "yarn", :because => "both install `yarn` binaries"
patch do
# https://gauravkohli.com/tag/hadoop-2-5-1/
# https://issues.apache.org/jira/browse/YARN-2161
# https://issues.apache.org/jira/secure/attachment/12650514/YARN-2161.v1.patch
url "https://gist.githubusercontent.com/dlo/765fc37d83d65be31ec33a18d82d1c32/raw/5124604bc037c8c4476bde3d33abe285421ce3ec/configuration.c.patch"
sha256 "1c00b7a0165530a52f23c72173c0d183079a91df34bb5961b9ba2b9503dfd74c"
end
patch do
# https://issues.apache.org/jira/browse/HADOOP-10699
# https://issues.apache.org/jira/secure/attachment/12617363/HADOOP-9648.v2.patch
url "https://gist.githubusercontent.com/dlo/765fc37d83d65be31ec33a18d82d1c32/raw/db1cdafffad48696088fb27ff998461abda8b1eb/JniBasedUnixGroupsNetgroupMapping.c.patch"
sha256 "9550429d306ccc6b458c11c5af629c76df48c3163c0d82056a198300e132cc4f"
end
patch do
# http://sunnytalkstech.blogspot.in/2011/08/maven-dependency-for-toolsjar-in-jdk7.html
url "https://gist.githubusercontent.com/dlo/765fc37d83d65be31ec33a18d82d1c32/raw/a7ebd3fba5ad8609c9e97af703d21fbccf703022/pom.xml.patch"
sha256 "d89f3fac5b523fd752f8c7c8e783e1c9cc6727771b33b530db46a5a318624285"
end
## See BUILDING in hadoop source.
def caveats; <<~EOS
You may need to run the following for the build to succeed:
sudo mkdir `/usr/libexec/java_home`/Classes
sudo ln -s `/usr/libexec/java_home`/lib/tools.jar `/usr/libexec/java_home`/Classes/classes.jar
EOS
end
def install
# Update to the location of `/usr/libexec/java_home -v 1.8`
ENV["JAVA_HOME"] = "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home"
ENV["OPENSSL_ROOT_DIR"] = Formula["openssl"].opt_include
system "mvn", "package", "-Pdist,native", "-DskipTests", "-Dtar", "-Dmaven.javadoc.skip=true"
cd "hadoop-dist/target/hadoop-2.4.1" do
rm_f Dir["bin/*.cmd", "sbin/*.cmd", "libexec/*.cmd", "etc/hadoop/*.cmd"]
libexec.install %w[bin sbin include lib libexec share etc]
bin.write_exec_script Dir["#{libexec}/bin/*"]
sbin.write_exec_script Dir["#{libexec}/sbin/*"]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment