forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibmongoclient-legacy.rb
65 lines (52 loc) · 1.81 KB
/
libmongoclient-legacy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class LibmongoclientLegacy < Formula
homepage "https://www.mongodb.org"
url "https://github.com/mongodb/mongo-cxx-driver/archive/legacy-1.0.6.tar.gz"
sha256 "fcdaade5ec8b32d66021a18ae2f2580f86d26a13a9bf57002e8c174a51637e9c"
head "https://github.com/mongodb/mongo-cxx-driver.git", :branch => "legacy"
bottle do
sha256 "7914c62076e4d4b461ed82f0c44208b8cc22c84e33666915ea6647d13edbd995" => :el_capitan
sha256 "94c5aa46b91a696521aa9f941fd3e820559ee388b96aa97d5a4edc77163e88f2" => :yosemite
sha256 "0210ee728a5c684368f4ac2f3a1e7dade663995eb464f758c59f0a54bfa69bec" => :mavericks
end
conflicts_with "libmongoclient", :because => "libmongoclient contains 26compat branch"
option :cxx11
depends_on "scons" => :build
if build.cxx11?
depends_on "boost" => "c++11"
else
depends_on "boost"
end
def install
ENV.cxx11 if build.cxx11?
boost = Formula["boost"].opt_prefix
args = [
"--prefix=#{prefix}",
"-j#{ENV.make_jobs}",
"--cc=#{ENV.cc}",
"--cxx=#{ENV.cxx}",
"--extrapath=#{boost}",
"--sharedclient",
# --osx-version-min is required to override --osx-version-min=10.6 added
# by SConstruct which causes "invalid deployment target for -stdlib=libc++"
# when using libc++
"--osx-version-min=#{MacOS.version}",
"install",
]
args << "--libc++" if MacOS.version >= :mavericks
scons *args
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <mongo/client/dbclient.h>
int main() {
mongo::DBClientConnection c;
mongo::client::initialize();
return 0;
}
EOS
system ENV.cxx, "-L#{lib}", "-lmongoclient",
"-L#{Formula["boost"].opt_lib}", "-lboost_system",
testpath/"test.cpp", "-o", testpath/"test"
system "./test"
end
end