106 lines
3.8 KiB
Ruby
106 lines
3.8 KiB
Ruby
class Vineyard < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "In-memory immutable data manager. (Project under CNCF)"
|
|
homepage "https://v6d.io"
|
|
url "https://github.com/v6d-io/v6d/releases/download/v0.11.3/v6d-0.11.3.tar.gz"
|
|
sha256 "18befb052270d5cfd1280db571b9dbdeb876d988d308d7cee1deb5ddde0121a0"
|
|
license "Apache-2.0"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "418b82028a5d3369b8bfea1118b1203e1a698282a62dbb4c70a4ddfaba330f7e"
|
|
sha256 arm64_monterey: "bbd17052c24f28493da7f544cebae96bd12b3df938d88ed9b6ee657d1c82effc"
|
|
sha256 arm64_big_sur: "fac1ee318bb72b55b9d13190e1903c59df9b1ab546813f0794dc96549f754956"
|
|
sha256 ventura: "c404d8d305026696c0182a2851835245107327a006fa986d8bfb5796739b3567"
|
|
sha256 monterey: "cd55294f558ce58ac9bdcfc89723c56ff65b94cb97fb6376a7141f7c06795567"
|
|
sha256 big_sur: "6e70c0a4b658ed4eabaeb15a1b1e4105526f465771e5c6c6de035ff59b3929b7"
|
|
sha256 x86_64_linux: "75a3047157b6360901c3ddde7d130525738225bc967036b94b36f55be5dcb9f8"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "llvm" => :build
|
|
depends_on "python@3.11" => :build
|
|
depends_on "apache-arrow"
|
|
depends_on "boost"
|
|
depends_on "etcd"
|
|
depends_on "etcd-cpp-apiv3"
|
|
depends_on "gflags"
|
|
depends_on "glog"
|
|
depends_on "libgrape-lite"
|
|
depends_on "nlohmann-json"
|
|
depends_on "open-mpi"
|
|
depends_on "openssl@1.1"
|
|
depends_on "tbb"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
python = "python3.11"
|
|
# LLVM is keg-only.
|
|
ENV.prepend_path "PYTHONPATH", Formula["llvm"].opt_prefix/Language::Python.site_packages(python)
|
|
|
|
system "cmake", "-S", ".", "-B", "build",
|
|
"-DCMAKE_CXX_STANDARD=14",
|
|
"-DCMAKE_CXX_STANDARD_REQUIRED=TRUE",
|
|
"-DPYTHON_EXECUTABLE=#{which(python)}",
|
|
"-DUSE_EXTERNAL_ETCD_LIBS=ON",
|
|
"-DUSE_EXTERNAL_TBB_LIBS=ON",
|
|
"-DUSE_EXTERNAL_NLOHMANN_JSON_LIBS=ON",
|
|
"-DBUILD_VINEYARD_TESTS=OFF",
|
|
"-DUSE_LIBUNWIND=OFF",
|
|
"-DOPENSSL_ROOT_DIR=#{Formula["openssl@1.1"].opt_prefix}",
|
|
*std_cmake_args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cc").write <<~EOS
|
|
#include <iostream>
|
|
#include <memory>
|
|
|
|
#include <vineyard/client/client.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
vineyard::Client client;
|
|
VINEYARD_CHECK_OK(client.Connect(argv[1]));
|
|
|
|
std::shared_ptr<vineyard::InstanceStatus> status;
|
|
VINEYARD_CHECK_OK(client.InstanceStatus(status));
|
|
std::cout << "vineyard instance is: " << status->instance_id << std::endl;
|
|
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
system ENV.cxx, "test.cc", "-std=c++17",
|
|
"-I#{Formula["apache-arrow"].include}",
|
|
"-I#{Formula["boost"].include}",
|
|
"-I#{include}",
|
|
"-I#{include}/vineyard",
|
|
"-I#{include}/vineyard/contrib",
|
|
"-L#{Formula["apache-arrow"].lib}",
|
|
"-L#{Formula["boost"].lib}",
|
|
"-L#{lib}",
|
|
"-larrow",
|
|
"-lboost_thread-mt",
|
|
"-lboost_system-mt",
|
|
"-lvineyard_client",
|
|
"-o", "test_vineyard_client"
|
|
|
|
# prepare vineyardd
|
|
vineyardd_pid = spawn bin/"vineyardd", "--norpc",
|
|
"--meta=local",
|
|
"--socket=#{testpath}/vineyard.sock"
|
|
|
|
# sleep to let vineyardd get its wits about it
|
|
sleep 10
|
|
|
|
assert_equal("vineyard instance is: 0\n", shell_output("./test_vineyard_client #{testpath}/vineyard.sock"))
|
|
ensure
|
|
# clean up the vineyardd process before we leave
|
|
Process.kill("HUP", vineyardd_pid)
|
|
end
|
|
end
|