77 lines
2.9 KiB
Ruby
77 lines
2.9 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-151.tar.gz"
|
|
version "8.1-151"
|
|
sha256 "4752e150ac509f19540c0f292eda9bf435b8986138514ad2e1970cc82a2ba4fc"
|
|
revision 2
|
|
head "https://github.com/macvim-dev/macvim.git"
|
|
|
|
bottle do
|
|
sha256 "3b588aec4106e79d6f9798ba8b140f640511f8b09af8592b2a96ff688b8cce84" => :mojave
|
|
sha256 "19301c8c932a612beb36f3c526bd0cd23d1063e999d38d0b9836d133ef843ab8" => :high_sierra
|
|
sha256 "2ae52bf5b7350a43411586394d393a6493325d1fb74f803c77e275554b2b317e" => :sierra
|
|
end
|
|
|
|
depends_on :xcode => :build
|
|
depends_on "cscope"
|
|
depends_on "lua"
|
|
depends_on "python"
|
|
|
|
conflicts_with "vim",
|
|
:because => "vim and macvim both install vi* binaries"
|
|
|
|
def install
|
|
# Avoid issues finding Ruby headers
|
|
if MacOS.version == :sierra || MacOS.version == :yosemite
|
|
ENV.delete("SDKROOT")
|
|
end
|
|
|
|
# MacVim doesn't have or require any Python package, so unset PYTHONPATH
|
|
ENV.delete("PYTHONPATH")
|
|
|
|
# If building for OS X 10.7 or up, make sure that CC is set to "clang"
|
|
ENV.clang if MacOS.version >= :lion
|
|
|
|
system "./configure", "--with-features=huge",
|
|
"--enable-multibyte",
|
|
"--with-macarchs=#{MacOS.preferred_arch}",
|
|
"--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"
|
|
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
|
|
|
|
# Simple test to check if MacVim was linked to Homebrew's Python 3
|
|
py3_exec_prefix = Utils.popen_read("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
|