100 lines
3.4 KiB
Ruby
100 lines
3.4 KiB
Ruby
class Tarantool < Formula
|
|
desc "In-memory database and Lua application server"
|
|
homepage "https://tarantool.org/"
|
|
url "https://download.tarantool.org/tarantool/src/tarantool-2.10.3.tar.gz"
|
|
sha256 "d1e38bfce10812593419979186497e7d7b59c5a233bab39353fcbf24b389f232"
|
|
license "BSD-2-Clause"
|
|
version_scheme 1
|
|
head "https://github.com/tarantool/tarantool.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :head
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "7eb5ca8958d366a65a26e352140b0c876711c094fc033299cf4b9705bb51fe05"
|
|
sha256 cellar: :any, arm64_big_sur: "ba22505fde23aa2537d70e69050ba8a18ed349efb0583aa7cb62dc53c23c07dc"
|
|
sha256 cellar: :any, monterey: "48ea8cc87409799063cf7e070ccd942c7e767b2addf098ac15a3dac85dffd304"
|
|
sha256 cellar: :any, big_sur: "36c8823fbbd93156235ff2a78e6ecf7808bd4cf3636a0cad4fc602c56b596ab7"
|
|
sha256 cellar: :any, catalina: "b085939cdd5f8dd93c18f31e15ad430c7af9c62cea4662f59acfb0486902215a"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "896cefa685bc01e4ffc96825de1b12f16ada0ae288d247bf77fee070db2cef69"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "icu4c"
|
|
depends_on "libyaml"
|
|
depends_on "openssl@3"
|
|
depends_on "readline"
|
|
depends_on "zstd"
|
|
|
|
uses_from_macos "curl"
|
|
uses_from_macos "ncurses"
|
|
|
|
def install
|
|
# Avoid keeping references to Homebrew's clang/clang++ shims
|
|
inreplace "src/trivia/config.h.cmake",
|
|
"#define COMPILER_INFO \"@CMAKE_C_COMPILER@ @CMAKE_CXX_COMPILER@\"",
|
|
"#define COMPILER_INFO \"/usr/bin/clang /usr/bin/clang++\""
|
|
|
|
args = std_cmake_args
|
|
args << "-DCMAKE_INSTALL_MANDIR=#{doc}"
|
|
args << "-DCMAKE_INSTALL_SYSCONFDIR=#{etc}"
|
|
args << "-DCMAKE_INSTALL_LOCALSTATEDIR=#{var}"
|
|
args << "-DENABLE_DIST=ON"
|
|
args << "-DOPENSSL_ROOT_DIR=#{Formula["openssl@1.1"].opt_prefix}"
|
|
args << "-DREADLINE_ROOT=#{Formula["readline"].opt_prefix}"
|
|
args << "-DENABLE_BUNDLED_LIBCURL=OFF"
|
|
args << "-DENABLE_BUNDLED_LIBYAML=OFF"
|
|
args << "-DENABLE_BUNDLED_ZSTD=OFF"
|
|
|
|
if OS.mac?
|
|
if MacOS.version >= :big_sur
|
|
sdk = MacOS.sdk_path_if_needed
|
|
lib_suffix = "tbd"
|
|
else
|
|
sdk = ""
|
|
lib_suffix = "dylib"
|
|
end
|
|
|
|
args << "-DCURL_INCLUDE_DIR=#{sdk}/usr/include"
|
|
args << "-DCURL_LIBRARY=#{sdk}/usr/lib/libcurl.#{lib_suffix}"
|
|
args << "-DCURSES_NEED_NCURSES=ON"
|
|
args << "-DCURSES_NCURSES_INCLUDE_PATH=#{sdk}/usr/include"
|
|
args << "-DCURSES_NCURSES_LIBRARY=#{sdk}/usr/lib/libncurses.#{lib_suffix}"
|
|
args << "-DICONV_INCLUDE_DIR=#{sdk}/usr/include"
|
|
else
|
|
args << "-DCURL_ROOT=#{Formula["curl"].opt_prefix}"
|
|
end
|
|
|
|
system "cmake", ".", *args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
local_user = ENV["USER"]
|
|
inreplace etc/"default/tarantool", /(username\s*=).*/, "\\1 '#{local_user}'"
|
|
|
|
(var/"lib/tarantool").mkpath
|
|
(var/"log/tarantool").mkpath
|
|
(var/"run/tarantool").mkpath
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.lua").write <<~EOS
|
|
box.cfg{}
|
|
local s = box.schema.create_space("test")
|
|
s:create_index("primary")
|
|
local tup = {1, 2, 3, 4}
|
|
s:insert(tup)
|
|
local ret = s:get(tup[1])
|
|
if (ret[3] ~= tup[3]) then
|
|
os.exit(-1)
|
|
end
|
|
os.exit(0)
|
|
EOS
|
|
system bin/"tarantool", "#{testpath}/test.lua"
|
|
end
|
|
end
|