178 lines
7.0 KiB
Ruby
178 lines
7.0 KiB
Ruby
# frozen_string_literal: true
|
|
# Generated by generate_tap.py for local/mirror
|
|
|
|
class Neovim < Formula
|
|
desc "Ambitious Vim-fork focused on extensibility and agility"
|
|
homepage "https://neovim.io/"
|
|
license "Apache-2.0"
|
|
compatibility_version 1
|
|
head "https://github.com/neovim/neovim.git", branch: "master"
|
|
|
|
stable do
|
|
url "https://homebrew.hyprnet/sources/d6e52c537914b924519eb5d74ded1ab922378c2efb1147037e6300dabbdfe5a9--neovim--0.12.4.x86_64_linux.bottle.tar.gz"
|
|
sha256 "2727da95d2b8b809bc7c71e085452e47dfe1d8aa7cfaa15c68004e23f6f0a6dd"
|
|
|
|
# Keep resources updated according to:
|
|
# https://github.com/neovim/neovim/blob/v#{version}/cmake.deps/deps.txt
|
|
|
|
# TODO: Consider shipping these as separate formulae instead. See discussion at
|
|
# https://github.com/orgs/Homebrew/discussions/3611
|
|
# NOTE: The `install` method assumes that the parser name follows the final `-`.
|
|
# Please name the resources accordingly.
|
|
resource "tree-sitter-c" do
|
|
url "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.24.1.tar.gz"
|
|
sha256 "25dd4bb3dec770769a407e0fc803f424ce02c494a56ce95fedc525316dcf9b48"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/tree-sitter/tree-sitter-c/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
|
|
resource "tree-sitter-lua" do
|
|
url "https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/refs/tags/v0.5.0.tar.gz"
|
|
sha256 "cf01b93f4b61b96a6d27942cf28eeda4cbce7d503c3bef773a8930b3d778a2d9"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-lua/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
|
|
resource "tree-sitter-vim" do
|
|
url "https://github.com/tree-sitter-grammars/tree-sitter-vim/archive/refs/tags/v0.8.1.tar.gz"
|
|
sha256 "93cafb9a0269420362454ace725a118ff1c3e08dcdfdc228aa86334b54d53c2a"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-vim/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
|
|
resource "tree-sitter-vimdoc" do
|
|
url "https://github.com/neovim/tree-sitter-vimdoc/archive/refs/tags/v4.1.0.tar.gz"
|
|
sha256 "020e8f117f648c8697fca967995c342e92dbd81dab137a115cc7555207fbc84f"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/neovim/tree-sitter-vimdoc/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
|
|
resource "tree-sitter-query" do
|
|
url "https://github.com/tree-sitter-grammars/tree-sitter-query/archive/refs/tags/v0.8.0.tar.gz"
|
|
sha256 "c2b23b9a54cffcc999ded4a5d3949daf338bebb7945dece229f832332e6e6a7d"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-query/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
|
|
resource "tree-sitter-markdown" do
|
|
url "https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/refs/tags/v0.5.3.tar.gz"
|
|
sha256 "df845b1ab7c7c163ec57d7fa17170c92b04be199bddab02523636efec5224ab6"
|
|
|
|
livecheck do
|
|
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
|
|
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-markdown/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
|
|
end
|
|
end
|
|
end
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
root_url "https://homebrew.hyprnet/bottles"
|
|
sha256 arm64_tahoe: "c481e54d74d8e258e00448d44bc25ffc76ff4a982dcde22e8eb0c4ffc30a66b5"
|
|
sha256 arm64_sequoia: "0f9d1ace756e7a05ecd2544a4efa7056a2a2faf4f50aad393815d2edb5b39ded"
|
|
sha256 arm64_sonoma: "634a72f6b29708b658c3fdeeea4560cd17460244076beee5f38550c10057b02f"
|
|
sha256 sonoma: "c36007e42477e4e50c05f43e416052263442bc2ffad5458867b445d2ad33aadf"
|
|
sha256 arm64_linux: "c78c28cd3186bd0f415fdba66de7cf795e309ef6dd95e12f79dccb75e7fb1606"
|
|
sha256 x86_64_linux: "7027be32c4847a23775a92c23e5bdcebf1a76ea1d8a8697b2659f46c0f4fd4c1"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "gettext" => :build
|
|
depends_on "libuv"
|
|
depends_on "lpeg"
|
|
depends_on "luajit"
|
|
depends_on "luv"
|
|
depends_on "tree-sitter"
|
|
depends_on "unibilium"
|
|
depends_on "utf8proc"
|
|
|
|
on_macos do
|
|
depends_on "gettext"
|
|
end
|
|
|
|
def install
|
|
if build.head?
|
|
cmake_deps = (buildpath/"cmake.deps/deps.txt").read.lines
|
|
cmake_deps.each do |line|
|
|
next unless line.match?(/TREESITTER_[^_]+_URL/)
|
|
|
|
parser, parser_url = line.split
|
|
parser_name = parser.delete_suffix("_URL")
|
|
parser_sha256 = cmake_deps.find { |l| l.include?("#{parser_name}_SHA256") }.split.last
|
|
parser_name = parser_name.downcase.tr("_", "-")
|
|
|
|
resource parser_name do
|
|
url parser_url
|
|
sha256 parser_sha256
|
|
end
|
|
end
|
|
end
|
|
|
|
resources.each do |r|
|
|
source_directory = buildpath/"deps-build/build/src"/r.name
|
|
build_directory = buildpath/"deps-build/build"/r.name
|
|
|
|
parser_name = r.name.split("-").last
|
|
cmakelists = case parser_name
|
|
when "markdown" then "MarkdownParserCMakeLists.txt"
|
|
else "TreesitterParserCMakeLists.txt"
|
|
end
|
|
|
|
r.stage(source_directory)
|
|
cp buildpath/"cmake.deps/cmake"/cmakelists, source_directory/"CMakeLists.txt"
|
|
|
|
system "cmake", "-S", source_directory, "-B", build_directory, "-DPARSERLANG=#{parser_name}", *std_cmake_args
|
|
system "cmake", "--build", build_directory
|
|
system "cmake", "--install", build_directory
|
|
end
|
|
|
|
# Point system locations inside `HOMEBREW_PREFIX`.
|
|
inreplace "src/nvim/os/stdpaths.c" do |s|
|
|
s.gsub! "/etc/xdg/", "#{etc}/xdg/:\\0"
|
|
|
|
if HOMEBREW_PREFIX.to_s != HOMEBREW_DEFAULT_PREFIX
|
|
s.gsub! "/usr/local/share/:/usr/share/", "#{HOMEBREW_PREFIX}/share/:\\0"
|
|
end
|
|
end
|
|
|
|
# Replace `-dirty` suffix in `--version` output with `-Homebrew`.
|
|
inreplace "cmake/GenerateVersion.cmake", "--dirty", "--dirty=-Homebrew"
|
|
|
|
args = [
|
|
"-DLUV_LIBRARY=#{formula_opt_lib("luv")/shared_library("libluv")}",
|
|
"-DLIBUV_LIBRARY=#{formula_opt_lib("libuv")/shared_library("libuv")}",
|
|
"-DLPEG_LIBRARY=#{formula_opt_lib("lpeg")/shared_library("liblpeg")}",
|
|
]
|
|
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
end
|
|
|
|
test do
|
|
refute_match "dirty", shell_output("#{bin}/nvim --version")
|
|
(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
|