homebrew-core/Formula/folly.rb

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/v2020.08.24.00.tar.gz"
sha256 "b3f41b94ba0bb88f8b2b305ff8e192fad6da12f8c982f22cd63871bfe95328d9"
license "Apache-2.0"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "d2a86bc7a945f47236cecfbf9854d826d0aba2310d0b1a6a82c6b0c2e292d779" => :catalina
sha256 "57596499dc008373cea88f4c24f02d35308430dfda9571a3c85aa80a190e044b" => :mojave
sha256 "6dc0b788b6e0667753dbe6a2c808ec57aa6b4dc841a2a13d916b74d76e87f2b0" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "double-conversion"
depends_on "fmt"
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