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