homebrew-core/Formula/mongodb.rb
Ernie Hershey 60516bcb9f mongodb 3.1.1 (devel)
Closes Homebrew/homebrew#38441.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-04-17 10:53:54 -07:00

143 lines
4.1 KiB
Ruby

require "language/go"
class Mongodb < Formula
homepage "https://www.mongodb.org/"
depends_on "go" => :build
stable do
url "https://fastdl.mongodb.org/src/mongodb-src-r3.0.2.tar.gz"
sha256 "010522203cdb9bbff52fbd9fe299b67686bb1256e2e55eb78abf35444f668399"
go_resource "github.com/mongodb/mongo-tools" do
url "https://github.com/mongodb/mongo-tools.git",
:tag => "r3.0.1",
:revision => "bc08e57abb71b2edd1cc3ab8f9f013409718f197"
end
end
devel do
url "https://fastdl.mongodb.org/src/mongodb-src-r3.1.1.tar.gz"
sha256 "4f983680ff1cc61d021daed2e2d24c54c069d965ec47276678296240d59efb6f"
go_resource "github.com/mongodb/mongo-tools" do
url "https://github.com/mongodb/mongo-tools.git",
:tag => "r3.1.1",
:revision => "6c959d3a8bd9704b5ee9e17e60a4236db6887dc3"
end
end
bottle do
sha256 "1f770eefcd53060a807d85a8007d426e685f191cc9ea4afa1f7d465d2bf3d643" => :yosemite
sha256 "2638bfa5fd373a67650d7476678757ea0575153b149342e288dece1782bd79cf" => :mavericks
sha256 "1e93d503ad004245845bea11e0d4a831860af9d0ae35d674f95b8609fcae40bd" => :mountain_lion
end
option "with-boost", "Compile using installed boost, not the version shipped with mongodb"
depends_on "boost" => :optional
depends_on "go" => :build
depends_on :macos => :snow_leopard
depends_on "scons" => :build
depends_on "openssl" => :optional
def install
ENV.libcxx if build.devel?
# New Go tools have their own build script but the server scons "install" target is still
# responsible for installing them.
Language::Go.stage_deps resources, buildpath/"src"
cd "src/github.com/mongodb/mongo-tools" do
args = %W[]
# Once https://github.com/mongodb/mongo-tools/issues/11 is fixed, also set CPATH.
# For now, use default include path
#
if build.with? "openssl"
args << "ssl"
ENV["LIBRARY_PATH"] = "#{Formula["openssl"].opt_prefix}/lib"
# ENV["CPATH"] = "#{Formula["openssl"].opt_prefix}/include"
end
system "./build.sh", *args
end
mkdir "src/mongo-tools"
cp Dir["src/github.com/mongodb/mongo-tools/bin/*"], "src/mongo-tools/"
args = %W[
--prefix=#{prefix}
-j#{ENV.make_jobs}
--cc=#{ENV.cc}
--cxx=#{ENV.cxx}
--osx-version-min=#{MacOS.version}
]
args << "--use-system-boost" if build.with? "boost"
args << "--use-new-tools"
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/mongod</string>
<string>--config</string>
<string>#{etc}/mongod.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/mongodb/output.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/mongodb/output.log</string>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>65536</integer>
</dict>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>65536</integer>
</dict>
</dict>
</plist>
EOS
end
test do
system "#{bin}/mongod", "--sysinfo"
end
end