From d90a735b486ad89a95f97f4ad5f5138c03d538fe Mon Sep 17 00:00:00 2001 From: Jeffrey Heifetz Date: Mon, 17 Apr 2017 22:52:04 -0400 Subject: [PATCH] mongodb@2.6: import from homebrew/versions. Closes #12584. Signed-off-by: Mike McQuaid --- Formula/mongodb@2.6.rb | 100 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Formula/mongodb@2.6.rb diff --git a/Formula/mongodb@2.6.rb b/Formula/mongodb@2.6.rb new file mode 100644 index 0000000000..626ab7c673 --- /dev/null +++ b/Formula/mongodb@2.6.rb @@ -0,0 +1,100 @@ +class MongodbAT26 < Formula + desc "High-performance document-oriented database" + homepage "https://www.mongodb.org/" + url "https://fastdl.mongodb.org/src/mongodb-src-r2.6.12.tar.gz" + sha256 "2dd51eabcfcd133573be74c0131c85b67764042833e7d94077e86adc0b9406dc" + + depends_on :macos => :snow_leopard + depends_on "scons" => :build + depends_on "openssl" + + def install + # This modifies the SConstruct file to include 10.10, 10.11, and 10.12 osx versions as accepted build options. + inreplace "SConstruct", /osx_version_choices = \[.+?\]/, "osx_version_choices = ['10.6', '10.7', '10.8', '10.9', '10.10', '10.11', '10.12']" + + args = %W[ + --prefix=#{prefix} + -j#{ENV.make_jobs} + --cc=#{ENV.cc} + --cxx=#{ENV.cxx} + --osx-version-min=#{MacOS.version} + --full + ] + + args << "--use-system-boost" if build.with? "boost" + args << "--64" if MacOS.prefer_64_bit? + + # Pass the --disable-warnings-as-errors flag to Scons when on Yosemite + # or later, otherwise 2.6.x won't build from source due to a Clang 3.5+ + # error - https://github.com/mongodb/mongo/pull/956#issuecomment-94545753 + args << "--disable-warnings-as-errors" if MacOS.version >= :yosemite + + if build.with? "openssl" + args << "--ssl" << "--extrapath=#{Formula["openssl"].opt_prefix}" + end + + scons "install", *args + + (buildpath+"mongod.conf").write mongodb_conf + etc.install "mongod.conf" + + (var/"mongodb").mkpath + (var/"log/mongodb").mkpath + end + + def mongodb_conf; <<-EOS.undent + systemLog: + destination: file + path: #{var}/log/mongodb/mongo.log + logAppend: true + storage: + dbPath: #{var}/mongodb + net: + bindIp: 127.0.0.1 + EOS + end + + plist_options :manual => "mongod --config #{HOMEBREW_PREFIX}/etc/mongod.conf" + + def plist; <<-EOS.undent + + + + + Label + #{plist_name} + ProgramArguments + + #{opt_bin}/mongod + --config + #{etc}/mongod.conf + + RunAtLoad + + KeepAlive + + WorkingDirectory + #{HOMEBREW_PREFIX} + StandardErrorPath + #{var}/log/mongodb/output.log + StandardOutPath + #{var}/log/mongodb/output.log + HardResourceLimits + + NumberOfFiles + 1024 + + SoftResourceLimits + + NumberOfFiles + 1024 + + + + EOS + end + + test do + system "#{bin}/mongod", "--sysinfo" + end +end