104 lines
3.7 KiB
Ruby
104 lines
3.7 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.1/v6d-0.11.1.tar.gz"
|
|
sha256 "50d5c0b72b90152e6d8eada9df0b0209579de8e2b8650ccc65620983446d8900"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "1954c031930a98caa0354c414ca6a5b5bb1441325563242f27a6076a68826725"
|
|
sha256 arm64_monterey: "a73971799be155d5400888b10672e513fc1c03a783f83d37b0269730772503fe"
|
|
sha256 arm64_big_sur: "fd5937620ef25e9a323da7459933c28ebdc9bc0e6f5c558c3266a161e585cdfd"
|
|
sha256 ventura: "95a5ab48d49030002b4a470c53769e8f6b17fa667aeb2a972b9e88d475cdcf4c"
|
|
sha256 monterey: "9396ba7a1b70ddeaa655f4b890c70a7224d6c03f9d6768df490b288abb905fc2"
|
|
sha256 big_sur: "f1965f16e74dd663bdfa72d9cc5c04fea9393b7783af2d7d2626c03ae3c4f8aa"
|
|
sha256 x86_64_linux: "2fe84754d55814ee8d1f4036a2c03ef94441f3cf053968bbd8edfbaf95b2d206"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "python@3.10" => :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 "llvm"
|
|
depends_on "nlohmann-json"
|
|
depends_on "open-mpi"
|
|
depends_on "openssl@1.1"
|
|
depends_on "tbb"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
python = "python3.10"
|
|
# 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",
|
|
"-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
|