68 lines
2.1 KiB
Ruby
68 lines
2.1 KiB
Ruby
class Tarantool < Formula
|
|
desc "In-memory database and Lua application server"
|
|
homepage "https://tarantool.org/"
|
|
url "https://download.tarantool.org/tarantool/2.2/src/tarantool-2.2.1.1.tar.gz"
|
|
sha256 "42c6c61b7d9a2444afd96e4f5e1828da18ea2637d1e9d61dc543436ae48dd87f"
|
|
revision 1
|
|
head "https://github.com/tarantool/tarantool.git", :branch => "2.1", :shallow => false
|
|
|
|
bottle do
|
|
cellar :any
|
|
rebuild 1
|
|
sha256 "3cfec8cfab6720c57e72a3a11e924f169a710d3f5e91b6cf4e94afccd07ff8e8" => :catalina
|
|
sha256 "bb69d7f27b59778d5f4f71b2b64cbfeb52503dba3970af26e649bfab3dfc09d6" => :mojave
|
|
sha256 "9011b28c8ad82a31bb5e48405c7e4637998b4608cb336245b494312014362a47" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "icu4c"
|
|
depends_on "openssl@1.1"
|
|
depends_on "readline"
|
|
|
|
def install
|
|
sdk = MacOS::CLT.installed? ? "" : MacOS.sdk_path
|
|
|
|
# Necessary for luajit to build on macOS Mojave (see luajit formula)
|
|
ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version
|
|
|
|
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 << "-DCURL_INCLUDE_DIR=#{sdk}/usr/include"
|
|
args << "-DCURL_LIBRARY=/usr/lib/libcurl.dylib"
|
|
|
|
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
|