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" bottle do cellar :any_skip_relocation sha256 "233a848522494300b37a97498d6349b9d734a0bf637ade1d9a5ed56783e6982f" => :sierra sha256 "3178051c3c82b0f0b306bd85a43693fc3f5dfb898fa2eb13ab21620e00c8a916" => :el_capitan sha256 "57b17de046e3808e1357271eb7fd0de4b33aeaa1fdfcce5494a35daf4ba95260" => :yosemite end 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