Skip to content

Instantly share code, notes, and snippets.

@evidens
Created Apr 16, 2012
Embed
What would you like to do?
Vim formula for Homebrew
require 'formula'
class VimHg < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '2cfb68fa26cd'
version '7.3.487'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
def options
[
["--with-features=TYPE", "tiny, small, normal, big or huge (default: normal)"],
["--enable-interp=NAME,...", "lua, mzscheme, perl, python, python3, tcl and/or ruby"],
["--use-brew-python", "Uses the Homebrew version of python"]
]
end
def install
def opt_val(opt)
opt.sub(/.*?=(.*)$/, "\\1") rescue nil
end
opts = []
feature = opt_val(ARGV.find {|s| s =~ /^--with-features=/ }) || "normal"
# For compatibility and convenience {{{
feature_shorthand = features.find {|f| ARGV.include? "--#{f}" }
feature = feature_shorthand if feature_shorthand
# }}}
opts << "--with-features=#{feature}"
interps = opt_val(ARGV.find {|s| s =~ /^--enable-interp=/ }) || ""
interps = interps.split(/,/)
# For compatibility and convenience {{{
interp.each do |i|
if ARGV.include? "--#{i}"
interps << i
end
end
# }}}
interps.uniq!
interps.each do |i|
opts << "--enable-#{i}interp=yes"
opts << "--with-lua-prefix=/usr/local" if i == "lua"
end
if ARGV.include? '--use-brew-python'
opts << "--with-python-config-dir=/usr/local/lib/python2.7/config"
end
system "./configure",
"--disable-gui",
"--without-x",
"--disable-gpm",
"--disable-nls",
"--disable-netbeans",
"--disable-arabic",
"--disable-farsi",
"--disable-cscope",
"--disable-emacs_tags",
"--disable-keymap",
"--disable-langmap",
"--disable-rightleft",
"--disable-signs",
"--disable-mouse_dec",
"--disable-mouse_netterm",
"--disable-mouse_gpm",
"--disable-mouse_xterm",
"--enable-feature=browse",
"--with-tlib=ncurses",
"--enable-multibyte",
"--prefix=#{prefix}",
"--mandir=#{man}",
*opts
system "make install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment