92 lines
2.8 KiB
Ruby
92 lines
2.8 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/v2022.02.14.00.tar.gz"
|
|
sha256 "6ec28672a524e1d9d89cdb528d64362b939b4f0afc526767d93aa1ebb2639fc1"
|
|
license "Apache-2.0"
|
|
revision 1
|
|
head "https://github.com/facebook/folly.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "36d10a9224fc274f0bb53a7ce4bf858af8312670bd836f8a24a95f5c9c32446a"
|
|
sha256 cellar: :any, arm64_big_sur: "6f71c81eb2973fac109692ca877755074d566b07af0c9ef15c591b0d72a5e3be"
|
|
sha256 cellar: :any, monterey: "ad85b502d2ffdc22a3e7cadb39135c21a4ad5366bb3aa0aade8560cb5edeb2e9"
|
|
sha256 cellar: :any, big_sur: "9b12614d2da33fc45e84e712644b1aafcae3083c615191761cb4c6a4181f0833"
|
|
sha256 cellar: :any, catalina: "8b3d381908d03e503f9804a60706c1dfb50af1d50db12e23bae45d86eafc3380"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "718a30267096c6a5917b28de4f22a5d3bf5c3ef8755e9f419827fb00e94a4328"
|
|
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"
|
|
depends_on "openssl@1.1"
|
|
depends_on "snappy"
|
|
depends_on "xz"
|
|
depends_on "zstd"
|
|
|
|
on_macos do
|
|
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1100
|
|
end
|
|
|
|
on_linux do
|
|
depends_on "gcc"
|
|
end
|
|
|
|
fails_with :clang do
|
|
build 1100
|
|
# https://github.com/facebook/folly/issues/1545
|
|
cause <<-EOS
|
|
Undefined symbols for architecture x86_64:
|
|
"std::__1::__fs::filesystem::path::lexically_normal() const"
|
|
EOS
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
ENV.llvm_clang if OS.mac? && (DevelopmentTools.clang_build_version <= 1100)
|
|
|
|
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
|
|
# Force use of Clang rather than LLVM Clang
|
|
ENV.clang if OS.mac?
|
|
|
|
(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
|