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.10.14.00.tar.gz" sha256 "2956d8f601da47a3753415526d54cc6a8bbcc969351d336b5ffd1ab0d563d80a" head "https://github.com/facebook/folly.git" bottle do cellar :any sha256 "6292af5bd1b6da077be3e6e945472ff5915b6018bc918c24e37cf5320143bd7b" => :catalina sha256 "c0fb527ab5e73f36b519f6294ee6bdc7814609503048e41c54da18dab1970ebb" => :mojave sha256 "0810cfb4c5263a72e914b4beb9909a8ee576224e9fbe794c4884c2ddfc7b365b" => :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 int main() { folly::fbvector 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