92 lines
3.8 KiB
Ruby
92 lines
3.8 KiB
Ruby
class Vim < Formula
|
|
desc "Vi 'workalike' with many additional features"
|
|
homepage "https://www.vim.org/"
|
|
# vim should only be updated every 50 releases on multiples of 50
|
|
url "https://github.com/vim/vim/archive/v9.0.1050.tar.gz"
|
|
sha256 "5cc8b8f3272d3302384b6f3d52ef6302dbb53587f5d88e2a155767530c1f6c3f"
|
|
license "Vim"
|
|
head "https://github.com/vim/vim.git", branch: "master"
|
|
|
|
# The Vim repository contains thousands of tags and the `Git` strategy isn't
|
|
# ideal in this context. This is an exceptional situation, so this checks the
|
|
# first page of tags on GitHub (to minimize data transfer).
|
|
livecheck do
|
|
url "https://github.com/vim/vim/tags"
|
|
regex(%r{href=["']?[^"' >]*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
|
|
strategy :page_match
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "fad92a5d624c0a4abd6576be620737a7b70c4dbdae479b2fbee15b8021290028"
|
|
sha256 arm64_monterey: "1c3312164530b1220e6223249031e6874e771c7883132abfa7a452a6e32cff0a"
|
|
sha256 arm64_big_sur: "f988c971256fb6d96f0ebd0d38e7fd634089b02c8262b1eab7dbf2ef770ac850"
|
|
sha256 ventura: "a4664acc32946168c433989bb61a537c5b62330c6ab63bbb79ff32e56e0911bf"
|
|
sha256 monterey: "254e54542f9311dbf8e00ba8be8c1368b6708bd567854bfd8873ab3e3a4d2f6d"
|
|
sha256 big_sur: "269db9f59c9e06765b0973c514f258f8c9447713343b117daefe202902ddcb64"
|
|
sha256 x86_64_linux: "475fa59aa9633b69b2e18e59fa07d3c061c8ef956b7cf2bb7561f0913f0f0c6d"
|
|
end
|
|
|
|
depends_on "gettext"
|
|
depends_on "lua"
|
|
depends_on "ncurses"
|
|
depends_on "perl"
|
|
depends_on "python@3.10"
|
|
depends_on "ruby"
|
|
|
|
conflicts_with "ex-vi",
|
|
because: "vim and ex-vi both install bin/ex and bin/view"
|
|
|
|
conflicts_with "macvim",
|
|
because: "vim and macvim both install vi* binaries"
|
|
|
|
def install
|
|
ENV.prepend_path "PATH", Formula["python@3.10"].opt_libexec/"bin"
|
|
|
|
# https://github.com/Homebrew/homebrew-core/pull/1046
|
|
ENV.delete("SDKROOT")
|
|
|
|
# vim doesn't require any Python package, unset PYTHONPATH.
|
|
ENV.delete("PYTHONPATH")
|
|
|
|
# We specify HOMEBREW_PREFIX as the prefix to make vim look in the
|
|
# the right place (HOMEBREW_PREFIX/share/vim/{vimrc,vimfiles}) for
|
|
# system vimscript files. We specify the normal installation prefix
|
|
# when calling "make install".
|
|
# Homebrew will use the first suitable Perl & Ruby in your PATH if you
|
|
# build from source. Please don't attempt to hardcode either.
|
|
system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
|
|
"--mandir=#{man}",
|
|
"--enable-multibyte",
|
|
"--with-tlib=ncurses",
|
|
"--with-compiledby=Homebrew",
|
|
"--enable-cscope",
|
|
"--enable-terminal",
|
|
"--enable-perlinterp",
|
|
"--enable-rubyinterp",
|
|
"--enable-python3interp",
|
|
"--disable-gui",
|
|
"--without-x",
|
|
"--enable-luainterp",
|
|
"--with-lua-prefix=#{Formula["lua"].opt_prefix}"
|
|
system "make"
|
|
# Parallel install could miss some symlinks
|
|
# https://github.com/vim/vim/issues/1031
|
|
ENV.deparallelize
|
|
# If stripping the binaries is enabled, vim will segfault with
|
|
# statically-linked interpreters like ruby
|
|
# https://github.com/vim/vim/issues/114
|
|
system "make", "install", "prefix=#{prefix}", "STRIP=#{which "true"}"
|
|
bin.install_symlink "vim" => "vi"
|
|
end
|
|
|
|
test do
|
|
(testpath/"commands.vim").write <<~EOS
|
|
:python3 import vim; vim.current.buffer[0] = 'hello python3'
|
|
:wq
|
|
EOS
|
|
system bin/"vim", "-T", "dumb", "-s", "commands.vim", "test.txt"
|
|
assert_equal "hello python3", File.read("test.txt").chomp
|
|
assert_match "+gettext", shell_output("#{bin}/vim --version")
|
|
end
|
|
end
|