homebrew-core/Formula/folly.rb
2018-09-11 17:37:12 -04:00

77 lines
2.3 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/v2018.09.10.01.tar.gz"
sha256 "388965c12e5ce56f9e6b9de7627660f468e6728a4b98f1d800a4dd8d1098f60f"
head "https://github.com/facebook/folly.git"
bottle do
cellar :any
sha256 "41e37bee2259d1b50b5bf94d5e2209c864fb85ae4e5467e5fad0bd30c156371d" => :mojave
sha256 "9a3536c18d58dba20636a8662e370b328eeeb4af5dd37f9a5faca9a09b65e8da" => :high_sierra
sha256 "d45f31e4c77dc6f3266a6eeae6ed953c8efecf156fb06451f5a49b099efb2de2" => :sierra
sha256 "93bf6bc4483e1f21e631a966706f504dd1b97094f15559a4784b3ddc9dfb06dd" => :el_capitan
end
depends_on "cmake" => :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
mkdir "_build" do
args = std_cmake_args + %w[
-DFOLLY_USE_JEMALLOC=OFF
]
# Upstream issue 10 Jun 2018 "Build fails on macOS Sierra"
# See https://github.com/facebook/folly/issues/864
args << "-DCOMPILER_HAS_F_ALIGNED_NEW=OFF" if MacOS.version == :sierra
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++11", "test.cc", "-I#{include}", "-L#{lib}",
"-lfolly", "-o", "test"
system "./test"
end
end