homebrew-core/Formula/vim.rb

81 lines
3.2 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/v8.2.3450.tar.gz"
sha256 "bf9f41f8804addf7c875fba32f68ad1588f8f9697fc9b8d51857b6b22f87f570"
license "Vim"
head "https://github.com/vim/vim.git", branch: "master"
bottle do
sha256 arm64_big_sur: "ddfb7de3a00ad813a69f613843ff2e46623f3cba8e16e4698786bf102ccefef5"
sha256 big_sur: "475fd204203a78163ef3fe5b5a381d3a023a91d8902d7a446825ae99c9c01ecd"
sha256 catalina: "c61cc2c8adf80ea90f602f876219d8ed057f5946bd3012656dbc912aa630aeb1"
sha256 mojave: "52ef9231a4d7bfc5c488ea6506052fba7dce6daf8c15c7e2d48e825a32288806"
sha256 x86_64_linux: "cf63056e17d39c3991bf9e5a1434f33e19f297759d586c3091ecde0e6636452b"
end
depends_on "gettext"
depends_on "lua"
depends_on "ncurses"
depends_on "perl"
depends_on "python@3.9"
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.9"].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",
"--enable-gui=no",
"--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