Skip to content

Commit

Permalink
Merge pull request #1 from tamakiii/hello-vim
Browse files Browse the repository at this point in the history
copy vim.rb from homebrew/homebrew-core
  • Loading branch information
tamakiii authored Oct 28, 2020
2 parents 390ec63 + 8e4acd7 commit a21e47e
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions Formula/vim.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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.1900.tar.gz"
sha256 "28b734e9f6d4ed0eaf5b2a2c7528798e6b66243c9665253cd223c03572fde4bf"
license "Vim"
head "https://github.com/vim/vim.git"

bottle do
sha256 "9fee8d0c97fae8a67ed27636e687760e32b58dbecb658a138010ace28ff241a6" => :catalina
sha256 "8e0b7559bd093adf61a5b75a8ce61962976f9fe94af9a822c76d10d9768c8a47" => :mojave
sha256 "57f2fddfda635fafc3694e95147c3d31ee369add4bd26a0e0d66847d5aae8c7c" => :high_sierra
end

depends_on "gettext"
depends_on "lua"
depends_on "perl"
depends_on "python@3.9"
depends_on "ruby"

uses_from_macos "ncurses"

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}",
"--enable-fail-if-missing"
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

0 comments on commit a21e47e

Please sign in to comment.