76 lines
3 KiB
Ruby
76 lines
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.1.2100.tar.gz"
|
|
sha256 "ef89982b9a0f2c6d0c59a3e845c622a38ddd23588772d1f722f2c8e7c209b503"
|
|
head "https://github.com/vim/vim.git"
|
|
|
|
bottle do
|
|
sha256 "8d9a8cea220bc0a94b8817d7c51458fe466eb00dc1c4023c25b04c9ec5f708ce" => :catalina
|
|
sha256 "60d203f2ba9e6820618f1fe2c05a37c9ab29a9959937dcc4a6e3b9fa484d1703" => :mojave
|
|
sha256 "512333cb6980b3d527d4d75975ff98c3fef0420fe29ef2513e3011a4e7f04abc" => :high_sierra
|
|
end
|
|
|
|
depends_on "gettext"
|
|
depends_on "lua"
|
|
depends_on "perl"
|
|
depends_on "python"
|
|
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"].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",
|
|
"--enable-cscope",
|
|
"--enable-terminal",
|
|
"--with-compiledby=Homebrew",
|
|
"--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
|