83 lines
3.1 KiB
Ruby
83 lines
3.1 KiB
Ruby
# Reference: https://github.com/macvim-dev/macvim/wiki/building
|
|
class Macvim < Formula
|
|
desc "GUI for vim, made for macOS"
|
|
homepage "https://github.com/macvim-dev/macvim"
|
|
url "https://github.com/macvim-dev/macvim/archive/snapshot-171.tar.gz"
|
|
version "8.2-171"
|
|
sha256 "1ef6766abefc6d67dd717f1a92aa294304817a462a98153f2696e83340ffce25"
|
|
license "Vim"
|
|
revision 1
|
|
head "https://github.com/macvim-dev/macvim.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "87e1904216e8f0131e055f5a44b2c863b812ed855c53f377ec1d0afe81c30230"
|
|
sha256 big_sur: "607b58cfc70e02d68aa491f8c968f11341386c6f0972d2a113d41c69658c51a7"
|
|
sha256 catalina: "eba980cb563fb4766e330e45d0bb7fa3f1f1be020b3490d0421e0816c266ea19"
|
|
sha256 mojave: "a13d4c099c2f0769bfb31fdbafcf9c3a6dd53e583b82d0f2076f39310118ac8b"
|
|
end
|
|
|
|
depends_on xcode: :build
|
|
depends_on "cscope"
|
|
depends_on "gettext"
|
|
depends_on "lua"
|
|
depends_on :macos
|
|
depends_on "python@3.9"
|
|
depends_on "ruby"
|
|
|
|
conflicts_with "vim",
|
|
because: "vim and macvim both install vi* binaries"
|
|
|
|
def install
|
|
# Avoid issues finding Ruby headers
|
|
ENV.delete("SDKROOT")
|
|
|
|
# MacVim doesn't have or require any Python package, so unset PYTHONPATH
|
|
ENV.delete("PYTHONPATH")
|
|
|
|
# make sure that CC is set to "clang"
|
|
ENV.clang
|
|
|
|
system "./configure", "--with-features=huge",
|
|
"--enable-multibyte",
|
|
"--enable-perlinterp",
|
|
"--enable-rubyinterp",
|
|
"--enable-tclinterp",
|
|
"--enable-terminal",
|
|
"--with-tlib=ncurses",
|
|
"--with-compiledby=Homebrew",
|
|
"--with-local-dir=#{HOMEBREW_PREFIX}",
|
|
"--enable-cscope",
|
|
"--enable-luainterp",
|
|
"--with-lua-prefix=#{Formula["lua"].opt_prefix}",
|
|
"--enable-luainterp",
|
|
"--enable-python3interp",
|
|
"--disable-sparkle",
|
|
"--with-macarchs=#{Hardware::CPU.arch}"
|
|
system "make"
|
|
|
|
prefix.install "src/MacVim/build/Release/MacVim.app"
|
|
bin.install_symlink prefix/"MacVim.app/Contents/bin/mvim"
|
|
|
|
# Create MacVim vimdiff, view, ex equivalents
|
|
executables = %w[mvimdiff mview mvimex gvim gvimdiff gview gvimex]
|
|
executables += %w[vi vim vimdiff view vimex]
|
|
executables.each { |e| bin.install_symlink "mvim" => e }
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/mvim --version")
|
|
assert_match "+ruby", output
|
|
assert_match "+gettext", output
|
|
|
|
# Simple test to check if MacVim was linked to Homebrew's Python 3
|
|
py3_exec_prefix = shell_output(Formula["python@3.9"].opt_bin/"python3-config --exec-prefix")
|
|
assert_match py3_exec_prefix.chomp, output
|
|
(testpath/"commands.vim").write <<~EOS
|
|
:python3 import vim; vim.current.buffer[0] = 'hello python3'
|
|
:wq
|
|
EOS
|
|
system bin/"mvim", "-v", "-T", "dumb", "-s", "commands.vim", "test.txt"
|
|
assert_equal "hello python3", (testpath/"test.txt").read.chomp
|
|
end
|
|
end
|