homebrew-core/Formula/folly.rb

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/v2021.03.22.00.tar.gz"
sha256 "8615b9a614aa9df0e64115dae69c59e6dff27a25ab5d193cb518c11ff785c3f2"
license "Apache-2.0"
head "https://github.com/facebook/folly.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "ccf08bcea7cb9b74c4f155c27b96a56ff46da9d964c78a6070ffd78de63ea75c"
sha256 cellar: :any, big_sur: "f68a23a70cd52f66d592b49a706a46b130636c4a289898313b64ccfdbe3f79a9"
sha256 cellar: :any, catalina: "c980cf9d2fa20e14a6b639cfa846c2058f68d681711081e9cda809872d352c8e"
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/1545
depends_on macos: :catalina
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