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.06.17.00.tar.gz" sha256 "dc7ee18b24521a842fc5f7166d44b3db7246354ba4b22aa58b6a2444bb6cae6b" head "https://github.com/facebook/folly.git" bottle do cellar :any sha256 "eedccf1f8b6c8c4964ba3d34b54d0c19548e294ade86f2f787ea3c2d97708534" => :mojave sha256 "5225faa9f9b6836d0d1830c8e0fbf1d38aa971f8d799f420791228349c9b509c" => :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" depends_on "snappy" depends_on "xz" depends_on "zstd" # Known issue upstream. They're working on it: # https://github.com/facebook/folly/pull/445 fails_with :gcc => "6" 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