2016-08-04 00:52:27 +00:00
|
|
|
class Folly < Formula
|
|
|
|
desc "Collection of reusable C++ library artifacts developed at Facebook"
|
|
|
|
homepage "https://github.com/facebook/folly"
|
2016-12-20 22:08:05 +00:00
|
|
|
url "https://github.com/facebook/folly/archive/v2016.12.19.00.tar.gz"
|
|
|
|
sha256 "471050ccd2a32f551eb11f43170d3f9cdd39d363ec026ca922b872d1c03831c1"
|
2017-01-27 19:09:33 +00:00
|
|
|
revision 3
|
2016-08-04 00:52:27 +00:00
|
|
|
head "https://github.com/facebook/folly.git"
|
|
|
|
|
2016-09-03 18:41:46 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2017-01-29 20:05:59 +00:00
|
|
|
sha256 "3244a681eba41c71c305c52917e10b01570b52a676c35170ce985de5372e7380" => :sierra
|
|
|
|
sha256 "54e2925474c7eae238431543e7f5039d24d0f06b54a96e96268cfcdc620a5c4e" => :el_capitan
|
2016-09-03 18:41:46 +00:00
|
|
|
end
|
|
|
|
|
2016-08-04 00:52:27 +00:00
|
|
|
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"
|
|
|
|
|
2016-09-03 18:22:28 +00:00
|
|
|
# https://github.com/facebook/folly/issues/451
|
2016-09-24 15:45:48 +00:00
|
|
|
depends_on :macos => :el_capitan
|
2016-09-03 18:22:28 +00:00
|
|
|
|
2016-08-04 00:52:27 +00:00
|
|
|
needs :cxx11
|
|
|
|
|
|
|
|
# Known issue upstream. They're working on it:
|
|
|
|
# https://github.com/facebook/folly/pull/445
|
2016-09-24 15:45:48 +00:00
|
|
|
fails_with :gcc => "6"
|
2016-08-04 00:52:27 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.cxx11
|
|
|
|
|
|
|
|
cd "folly" do
|
2016-10-17 21:04:53 +00:00
|
|
|
if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
|
|
|
|
# Workaround for "no matching function for call to 'clock_gettime'"
|
|
|
|
# See upstream PR from 2 Oct 2016 facebook/folly#488
|
2016-10-03 21:06:08 +00:00
|
|
|
inreplace ["Benchmark.cpp", "Benchmark.h"] do |s|
|
|
|
|
s.gsub! "clock_gettime(CLOCK_REALTIME",
|
2016-10-17 21:04:53 +00:00
|
|
|
"clock_gettime((clockid_t)CLOCK_REALTIME"
|
|
|
|
s.gsub! "clock_getres(CLOCK_REALTIME",
|
|
|
|
"clock_getres((clockid_t)CLOCK_REALTIME", false
|
2016-10-03 21:06:08 +00:00
|
|
|
end
|
|
|
|
|
2016-10-17 21:04:53 +00:00
|
|
|
# Fix "candidate function not viable: no known conversion from
|
|
|
|
# 'folly::detail::Clock' to 'clockid_t' for 1st argument"
|
|
|
|
# See upstream PR mentioned above
|
2016-10-03 21:06:08 +00:00
|
|
|
inreplace "portability/Time.h", "typedef uint8_t clockid_t;", ""
|
|
|
|
end
|
|
|
|
|
2016-12-18 17:48:25 +00:00
|
|
|
# Fixes the .pc file, which references the gflags .pc under the wrong name.
|
|
|
|
# Applied upstream: https://github.com/facebook/folly/pull/531
|
|
|
|
inreplace "configure.ac", "[libgflags]", "[gflags]"
|
2016-08-04 00:52:27 +00:00
|
|
|
|
|
|
|
system "autoreconf", "-fvi"
|
|
|
|
system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
|
2016-12-21 01:47:28 +00:00
|
|
|
"--disable-dependency-tracking"
|
2016-08-04 00:52:27 +00:00
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.cc").write <<-EOS.undent
|
|
|
|
#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
|