forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boost150.rb
110 lines (90 loc) · 3.12 KB
/
boost150.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
class Boost150 < Formula
desc "Collection of portable C++ source libraries"
homepage "http://www.boost.org"
url "https://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2"
sha256 "c9ace2b8c81fa6703d1d17c7e478de3bc51101c5adbdeb3f6cb72cf3045a8529"
bottle do
cellar :any
sha256 "a598ebe3edd2c549bc29f5992e6b5892b3ad92487df6f35b6f79f525ed86f7ee" => :yosemite
sha256 "2632b8727a17f65d28290c6a6d35efd3dd547a924ea3cda6ddcb40ca06ba4899" => :mavericks
sha256 "0927666451be2e618e4a6ddda3415dc8d7843241eefe37785aa0659ebdd12d53" => :mountain_lion
end
keg_only "Conflicts with boost in main repository."
env :userpaths
option :universal
option "with-icu4c", "Build regexp engine with icu support"
option "with-single", "Build also single-threading variant"
option "with-mpi", "Build with MPI support"
depends_on "icu4c" => :optional
depends_on :mpi => [:cc, :cxx, :optional]
fails_with :llvm do
build 2335
cause "Dropped arguments to functions when linking with boost"
end
def install
# Boost.Signals does not work with libc++
ENV.libstdcxx if ENV.compiler == :clang
ENV.universal_binary if build.universal?
# https://svn.boost.org/trac/boost/ticket/8841
if (build.with? "mpi") && (build.with? "single")
raise <<-EOS.undent
Building MPI support for both single and multi-threaded flavors
is not supported. Please use "--with-mpi" together with
"--without-single".
EOS
end
# libdir should be set by --prefix but isn't
bootstrap_args = ["--prefix=#{prefix}", "--libdir=#{lib}"]
if build.with? "icu4c"
icu4c_prefix = Formula["icu4c"].opt_prefix
bootstrap_args << "--with-icu=#{icu4c_prefix}"
else
bootstrap_args << "--without-icu"
end
# Handle libraries that will not be built.
without_libraries = ["python"]
without_libraries << "mpi" if build.without? "mpi"
bootstrap_args << "--without-libraries=#{without_libraries.join(",")}"
args = ["--prefix=#{prefix}",
"--libdir=#{lib}",
"-d2",
"-j#{ENV.make_jobs}",
"link=shared,static",
"install"]
if build.with? "single"
args << "threading=single,multi"
else
args << "threading=multi"
end
args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal?
system "./bootstrap.sh", *bootstrap_args
system "./bjam", *args
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>
#include <assert.h>
using namespace boost::algorithm;
using namespace std;
int main()
{
string str("a,b");
vector<string> strVec;
split(strVec, str, is_any_of(","));
assert(strVec.size()==2);
assert(strVec[0]=="a");
assert(strVec[1]=="b");
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-stdlib=libstdc++",
"-L#{lib}",
"-I#{include}",
"-lboost_system",
"-o", "test"
ENV["DYLD_LIBRARY_PATH"] = "#{lib}"
system "./test"
end
end