homebrew-core/Formula/folly.rb
2018-05-21 22:40:27 -07:00

67 lines
1.9 KiB
Ruby

class Folly < Formula
desc "Collection of reusable C++ library artifacts developed at Facebook"
homepage "https://github.com/facebook/folly"
url "https://github.com/facebook/folly/archive/v2018.05.21.00.tar.gz"
sha256 "09caad62f909b88a92a5bbbfd881a083b08d7e4416dc1b30306c8be6c5958a0b"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "91c3294d36cf8e4ca2a78e833ef7e33325dff31d3584ddab48b40c624bf1a5d6" => :high_sierra
sha256 "0c1d69b5edb18316896bfb06c37badab4a74c3dc7229a77b0d76903347584fa5" => :sierra
sha256 "7b71c03946cd950ea486f6ef14548f843fd115985c4d6f9ca7d4fd016845d09d" => :el_capitan
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "double-conversion"
depends_on "glog"
depends_on "gflags"
depends_on "boost"
depends_on "libevent"
depends_on "xz"
depends_on "snappy"
depends_on "lz4"
depends_on "openssl"
# https://github.com/facebook/folly/issues/451
depends_on :macos => :el_capitan
needs :cxx11
# Known issue upstream. They're working on it:
# https://github.com/facebook/folly/pull/445
fails_with :gcc => "6"
def install
ENV.cxx11
cd "folly" do
system "autoreconf", "-fvi"
system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
"--disable-dependency-tracking"
system "make"
system "make", "install"
end
end
test do
(testpath/"test.cc").write <<~EOS
#include <folly/FBVector.h>
int main() {
folly::fbvector<int> numbers({0, 1, 2, 3});
numbers.reserve(10);
for (int i = 4; i < 10; i++) {
numbers.push_back(i * 2);
}
assert(numbers[6] == 12);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end