forked from necromant2005/homebrew-boneyard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpp-netlib.rb
59 lines (53 loc) · 1.56 KB
/
cpp-netlib.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
class CppNetlib < Formula
desc "C++ libraries for high level network programming"
homepage "http://cpp-netlib.org"
url "https://github.com/cpp-netlib/cpp-netlib/archive/cpp-netlib-0.12.0-final.tar.gz"
version "0.12.0"
sha256 "d66e264240bf607d51b8d0e743a1fa9d592d96183d27e2abdaf68b0a87e64560"
revision 1
depends_on "cmake" => :build
depends_on "openssl"
depends_on "asio"
if MacOS.version < :mavericks
depends_on "boost" => "c++11"
else
depends_on "boost"
end
needs :cxx11
def install
ENV.cxx11
# NB: Do not build examples or tests as they require submodules.
system "cmake", "-DCPP-NETLIB_BUILD_TESTS=OFF", "-DCPP-NETLIB_BUILD_EXAMPLES=OFF", *std_cmake_args
system "make"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <boost/network/protocol/http/client.hpp>
int main(int argc, char *argv[]) {
namespace http = boost::network::http;
http::client::options options;
http::client client(options);
http::client::request request("");
return 0;
}
EOS
flags = [
"-std=c++11",
"-stdlib=libc++",
"-I#{include}",
"-I#{Formula["asio"].include}",
"-I#{Formula["boost"].include}",
"-L#{lib}",
"-L#{Formula["boost"].lib}",
"-lssl",
"-lcrypto",
"-lboost_system-mt",
"-lcppnetlib-uri",
"-lcppnetlib-client-connections",
"-lcppnetlib-server-parsers",
] + ENV.cflags.split
system ENV.cxx, "-o", "test", "test.cpp", *flags
system "./test"
end
end