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/v2017.09.18.00.tar.gz" sha256 "588b9bf141b91387e45b5a4a86ecf1ddd2c35078a4ce2b50df6dfcefe407313e" head "https://github.com/facebook/folly.git" bottle do cellar :any sha256 "5949309d046067cc6f8950a11ae7e38c6ddbd0ac65104bfac8d3db78ab28965b" => :high_sierra sha256 "ac9e0747a7faa53d99b31c4dea839be3c3280548e3b6e6563a55738591a14ec0" => :sierra sha256 "3831309e570852c498e5fcbd94d088de0f817c1b9d0fbd9a1c7d8f4ce56490bc" => :el_capitan end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "pkg-config" => :build depends_on "double-conversion" depends_on "glog" depends_on "gflags" depends_on "boost" depends_on "libevent" depends_on "xz" depends_on "snappy" depends_on "lz4" depends_on "openssl" # https://github.com/facebook/folly/issues/451 depends_on :macos => :el_capitan needs :cxx11 # Known issue upstream. They're working on it: # https://github.com/facebook/folly/pull/445 fails_with :gcc => "6" def install ENV.cxx11 cd "folly" do system "autoreconf", "-fvi" system "./configure", "--prefix=#{prefix}", "--disable-silent-rules", "--disable-dependency-tracking" system "make" system "make", "install" end end test do (testpath/"test.cc").write <<-EOS.undent #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++11", "test.cc", "-I#{include}", "-L#{lib}", "-lfolly", "-o", "test" system "./test" end end