82 lines
3.3 KiB
Ruby
82 lines
3.3 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.4300.tar.gz"
|
|
sha256 "00e95d6bda783c2119a10cb25ba50d44a1378d372d7b8546de8b5746ac89db5a"
|
|
license "Vim"
|
|
head "https://github.com/vim/vim.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "f94b07bf0bdbc8b2fc129b8517d73985762e7e42f20342d8c06b6180d6a5b2ec"
|
|
sha256 arm64_big_sur: "1c14d15abe32159c2b18d675dfd6266df2ca638cf712fed69a9125540fac275c"
|
|
sha256 monterey: "257e91de533e2d5fb1828b81e5c38d7caf31253ccc3815ca4f35495f685f3920"
|
|
sha256 big_sur: "cd7fabf1f84692d05242aa2a12b903da1439ead49a24ec8ea4b7266c62fbfe03"
|
|
sha256 catalina: "50724d4dda8d7f040652288f41df2e933cc18536ac143d7a4738430927d64288"
|
|
sha256 x86_64_linux: "42922788ba2a9f714749dba55e863e7227e40b77ec9d6ce9670c3642ff55d59d"
|
|
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",
|
|
"--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
|