homebrew-core/Formula/vineyard.rb

105 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.4/v6d-0.11.4.tar.gz"
sha256 "cc807b991e5e35847783ee679ab14e75e23bbf04b309f2dd56ca37e3b6bc7ca8"
license "Apache-2.0"
bottle do
sha256 arm64_ventura: "55fc7bd17b65b1f9f698f9e7a4bb74cf6ee3c72997703e244ba4db0b3af31980"
sha256 arm64_monterey: "2ae7a4d3b7cb82344f62327002faedb847adde24f64fada28ea08ac8cae09744"
sha256 arm64_big_sur: "d145a60e491a46a01bdf405cc0b994eb39c86d382527a1e772fb87133296a045"
sha256 ventura: "7d6f21fe8e08cea320ba04236d687a0f11252dfd89d0588469d794c61ff1a8e4"
sha256 monterey: "48201513e14240d508fc3b9778bfb534026b05363b6e36c799d912e2309364cb"
sha256 big_sur: "ad9b4c24a62985b13d054d6c2944812f400bef1519d7dc5f0175cae059c6a786"
sha256 x86_64_linux: "38704fd432ba69c2a2a582498025757a48a334e02238d46bcd18e464668861f4"
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