90 lines
3.1 KiB
Ruby
90 lines
3.1 KiB
Ruby
class Neovim < Formula
|
|
desc "Ambitious Vim-fork focused on extensibility and agility"
|
|
homepage "https://neovim.io/"
|
|
url "https://github.com/neovim/neovim/archive/v0.5.0.tar.gz"
|
|
sha256 "2294caa9d2011996499fbd70e4006e4ef55db75b99b6719154c09262e23764ef"
|
|
license "Apache-2.0"
|
|
head "https://github.com/neovim/neovim.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "8c2031ed12ca5a2af5d317f74a3878b2acdfc8b8bd61f8c58ca99b52bfc2f29a"
|
|
sha256 big_sur: "c5e9addc65899936e06676db8a4c0239ca6e6c44936b21df1ade343dfe860995"
|
|
sha256 catalina: "13d31cb537237f3b9245c6c2de0e55ae4d7730d06742aec5a3e98a5365934eae"
|
|
sha256 mojave: "8f7a519050bf438143c4f7933f63d6aa1ccb1c062f4ae76ccaa7bf22d35f2f6e"
|
|
sha256 x86_64_linux: "31f3eed841555c4d2027bc9dd9b7aefde33708231fa6166e0cdb5ab215960767"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "luarocks" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "gettext"
|
|
depends_on "libtermkey"
|
|
depends_on "libuv"
|
|
depends_on "libvterm"
|
|
depends_on "luajit-openresty"
|
|
depends_on "luv"
|
|
depends_on "msgpack"
|
|
depends_on "tree-sitter"
|
|
depends_on "unibilium"
|
|
|
|
uses_from_macos "gperf" => :build
|
|
uses_from_macos "unzip" => :build
|
|
|
|
on_linux do
|
|
depends_on "libnsl"
|
|
end
|
|
|
|
# Keep resources updated according to:
|
|
# https://github.com/neovim/neovim/blob/v#{version}/third-party/CMakeLists.txt
|
|
|
|
resource "mpack" do
|
|
url "https://github.com/libmpack/libmpack-lua/releases/download/1.0.8/libmpack-lua-1.0.8.tar.gz"
|
|
sha256 "ed6b1b4bbdb56f26241397c1e168a6b1672f284989303b150f7ea8d39d1bc9e9"
|
|
end
|
|
|
|
resource "lpeg" do
|
|
url "https://luarocks.org/manifests/gvvaughan/lpeg-1.0.2-1.src.rock"
|
|
sha256 "e0d0d687897f06588558168eeb1902ac41a11edd1b58f1aa61b99d0ea0abbfbc"
|
|
end
|
|
|
|
def install
|
|
resources.each do |r|
|
|
r.stage(buildpath/"deps-build/build/src/#{r.name}")
|
|
end
|
|
|
|
ENV.prepend_path "LUA_PATH", "#{buildpath}/deps-build/share/lua/5.1/?.lua"
|
|
ENV.prepend_path "LUA_CPATH", "#{buildpath}/deps-build/lib/lua/5.1/?.so"
|
|
lua_path = "--lua-dir=#{Formula["luajit-openresty"].opt_prefix}"
|
|
|
|
cd "deps-build" do
|
|
%w[
|
|
mpack/mpack-1.0.8-0.rockspec
|
|
lpeg/lpeg-1.0.2-1.src.rock
|
|
].each do |rock|
|
|
dir, rock = rock.split("/")
|
|
cd "build/src/#{dir}" do
|
|
output = Utils.safe_popen_read("luarocks", "unpack", lua_path, rock, "--tree=#{buildpath}/deps-build")
|
|
unpack_dir = output.split("\n")[-2]
|
|
cd unpack_dir do
|
|
system "luarocks", "make", lua_path, "--tree=#{buildpath}/deps-build"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *std_cmake_args, "-DLIBLUV_LIBRARY=#{Formula["luv"].opt_lib/shared_library("libluv")}"
|
|
# Patch out references to Homebrew shims
|
|
inreplace "config/auto/versiondef.h", /#{HOMEBREW_LIBRARY}[^ ]+/o, ENV.cc
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.txt").write("Hello World from Vim!!")
|
|
system bin/"nvim", "--headless", "-i", "NONE", "-u", "NONE",
|
|
"+s/Vim/Neovim/g", "+wq", "test.txt"
|
|
assert_equal "Hello World from Neovim!!", (testpath/"test.txt").read.chomp
|
|
end
|
|
end
|