homebrew-core/Formula/folly.rb
2019-10-02 14:02:10 -04:00

66 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/v2019.09.30.00.tar.gz"
sha256 "c9b206c3c51ab7376b02811b6e81d8612e8776a478f627056c24f2b656b18054"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "9d8d9d5706a99bcbcd02af82f1e46e4b8bbbc90b789dacb3fb737882ace13f3d" => :catalina
sha256 "aa79b7ccec7c8c76c9590102e549a2f7d058350b9640934ae0e64fb41d388c50" => :mojave
sha256 "1efbce6e429bb47b293b0af9d58f9d3c99102a83020874a6ca06137cec264bad" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "lz4"
# https://github.com/facebook/folly/issues/966
depends_on :macos => :high_sierra
depends_on "openssl@1.1"
depends_on "snappy"
depends_on "xz"
depends_on "zstd"
def install
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=ON"
system "make"
system "make", "install"
system "make", "clean"
system "cmake", "..", *args, "-DBUILD_SHARED_LIBS=OFF"
system "make"
lib.install "libfolly.a", "folly/libfollybenchmark.a"
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++14", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end