128 lines
3.5 KiB
Ruby
128 lines
3.5 KiB
Ruby
class MongodbAT34 < Formula
|
|
desc "High-performance, schema-free, document-oriented database"
|
|
homepage "https://www.mongodb.org/"
|
|
url "https://fastdl.mongodb.org/src/mongodb-src-r3.4.18.tar.gz"
|
|
sha256 "a1c17e9977307752ddac4b06bcb65be177035057c21955df5a65e2db74a20856"
|
|
|
|
bottle do
|
|
sha256 "9718fd2195c3dccbb9657811860193f9208df13f102cf09fee7aee5b48e85054" => :mojave
|
|
sha256 "e083476b4a2a1c030e41b4a35521d8fcb5c5b433293f612a1096fbf3b5e3db01" => :high_sierra
|
|
sha256 "a9109b38e59d4afdd41d19f84739fc899ed32790227ad097dbfe467f001d3ec9" => :sierra
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "go" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "scons" => :build
|
|
depends_on :macos => :mountain_lion
|
|
depends_on "openssl"
|
|
|
|
needs :cxx11
|
|
|
|
def install
|
|
ENV.cxx11 if MacOS.version < :mavericks
|
|
|
|
(buildpath/".brew_home/Library/Python/2.7/lib/python/site-packages/vendor.pth").write <<~EOS
|
|
import site; site.addsitedir("#{buildpath}/vendor/lib/python2.7/site-packages")
|
|
EOS
|
|
|
|
# New Go tools have their own build script but the server scons "install"
|
|
# target is still responsible for installing them.
|
|
|
|
cd "src/mongo/gotools" do
|
|
inreplace "build.sh" do |s|
|
|
s.gsub! "$(git describe)", version.to_s
|
|
s.gsub! "$(git rev-parse HEAD)", "homebrew"
|
|
end
|
|
|
|
ENV["LIBRARY_PATH"] = Formula["openssl"].opt_lib
|
|
ENV["CPATH"] = Formula["openssl"].opt_include
|
|
|
|
system "./build.sh", "ssl"
|
|
end
|
|
|
|
(buildpath/"src/mongo-tools").install Dir["src/mongo/gotools/bin/*"]
|
|
|
|
args = %W[
|
|
-j#{ENV.make_jobs}
|
|
--build-mongoreplay=true
|
|
--osx-version-min=#{MacOS.version}
|
|
--prefix=#{prefix}
|
|
--ssl
|
|
--use-new-tools
|
|
CC=#{ENV.cc}
|
|
CXX=#{ENV.cxx}
|
|
CCFLAGS=-I#{Formula["openssl"].opt_include}
|
|
LINKFLAGS=-L#{Formula["openssl"].opt_lib}
|
|
]
|
|
|
|
args << "--disable-warnings-as-errors" if MacOS.version >= :yosemite
|
|
|
|
scons "install", *args
|
|
|
|
(buildpath/"mongod.conf").write mongodb_conf
|
|
etc.install "mongod.conf"
|
|
end
|
|
|
|
def post_install
|
|
(var/"mongodb").mkpath
|
|
(var/"log/mongodb").mkpath
|
|
end
|
|
|
|
def mongodb_conf; <<~EOS
|
|
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
|
|
<?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>4096</integer>
|
|
</dict>
|
|
<key>SoftResourceLimits</key>
|
|
<dict>
|
|
<key>NumberOfFiles</key>
|
|
<integer>4096</integer>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/mongod", "--sysinfo"
|
|
end
|
|
end
|