homebrew-core/Formula/vineyard.rb

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.0/v6d-0.11.0.tar.gz"
sha256 "dff25d65dbcc2764dc53b7b0102005d046d3adeb06b0c32a0122e75ffdb7e589"
license "Apache-2.0"
bottle do
sha256 arm64_ventura: "981374025579cd12f81b753708c394c17998c1c80ffed8b027f80d93ec8b2c63"
sha256 arm64_monterey: "46ab382f6e0bafab8f624a116d1fc0919adb70eb2b54a718cc2636ff839c9707"
sha256 arm64_big_sur: "dad41a3f178de3a92736c27bd3d1f3bc632ced93468928bc9297f55c17b07d7b"
sha256 ventura: "14bbbdf0811968c5bf8038440c3b2781479bd007e9db3cb73d052cd7cc17df84"
sha256 monterey: "bc04d7a53c3c5d5e5ec211e8164df7a8d01d608d42ef9a7fae363ec6f9dd2046"
sha256 big_sur: "3b887d79fb1769a50ef8c4eab8ca6a1c59e939c88e644db15a87be2e94076fe1"
sha256 x86_64_linux: "dcf1c7c38f083df8e3d7ed91340d7373cd3b0b5605d4164ffda4e1127e61abb6"
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