103 lines
3.6 KiB
Ruby
103 lines
3.6 KiB
Ruby
class Tarantool < Formula
|
|
desc "In-memory database and Lua application server"
|
|
homepage "https://tarantool.org/"
|
|
url "https://download.tarantool.org/tarantool/2.8/src/tarantool-2.8.2.0.tar.gz"
|
|
sha256 "f2e966fc6b644254270fd84f78ccc4dd1434500a6986fe9361b34804acae7e10"
|
|
license "BSD-2-Clause"
|
|
revision 1
|
|
version_scheme 1
|
|
head "https://github.com/tarantool/tarantool.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "de7b4c495bff9624a7dbf7cc37a7620258a268a74dfcbfc1f156c44532a8d5e1"
|
|
sha256 cellar: :any, arm64_big_sur: "baade3b1eb4ce24bd5d93faae9c2b349205c8354bb33797f0d3dc3af5f9d8d01"
|
|
sha256 monterey: "c0d05dd63bca5a14ec2571f03c1e9b89db486abd8331c7ccd2eea36b81eb2cb6"
|
|
sha256 big_sur: "10cee819c78efa179feee44d3edf4cb11f665f610ce60fc95cb0816c86d6b07b"
|
|
sha256 catalina: "ad6831afd452a2724c7df1ab9acf56e6e6e3582bdf9868864dcba7ecd1d1d9e9"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "f319e0625842b831deb7d0ed2ac1402b9301e5663ec94101becd6b59719b7f06"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "icu4c"
|
|
depends_on "libyaml"
|
|
depends_on "openssl@1.1"
|
|
depends_on "readline"
|
|
depends_on "zstd"
|
|
|
|
uses_from_macos "curl"
|
|
uses_from_macos "ncurses"
|
|
|
|
# Fix build on Monterey.
|
|
# Remove with 2.9.
|
|
patch do
|
|
url "https://github.com/tarantool/tarantool/commit/11e87877df9001a4972019328592d79d55d1bb01.patch?full_index=1"
|
|
sha256 "af867163bc78a14498959a755d9e8733e4ae13d30dd51a69f7e9fdc46a46137a"
|
|
end
|
|
|
|
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
|