homebrew-core/Formula/folly.rb
2018-08-09 22:46:44 +08: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.08.09.00.tar.gz"
sha256 "3b97bc30a8cf911be592055704f71915422de6dce8993a786846d5ec486f96a1"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "1b09de30d62f1461a086c5c40060f6f4c65009a4d9cde7a96840a6556adb7433" => :high_sierra
sha256 "76c1e4b6845a0d342ecdab94a87c85abadd86d879daa59ae5e3c428f3925dccb" => :sierra
sha256 "a16466db120a99e5a16e1402d33ff3e4bdca05081b5ab1d886434d67c9091a28" => :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