Skip to content

Instantly share code, notes, and snippets.

@realmyst
Created March 1, 2012 09:44
Show Gist options
  • Save realmyst/1948595 to your computer and use it in GitHub Desktop.
Save realmyst/1948595 to your computer and use it in GitHub Desktop.
require 'formula'
class Vim <Formula
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
homepage 'http://www.vim.org/'
md5 '5b9510a17074e2b37d8bb38ae09edbf2'
version '7.3.135'
def patchlevel; 135 end
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
def options
features.map {|f| ["--#{f}", "Configure with --with-feature-#{f}"] } \
| interp.map {|i| ["--#{i}", "Configure with --enable-#{i}interp"] }
end
def patches
patches = (1..patchlevel).map {|i| sprintf('ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.%03d', i) }
{:p0 => patches}
end
def install
feature = features.find {|f| ARGV.include? "--#{f}" } || "normal"
opts = []
interp.each do |i|
if ARGV.include? "--#{i}"
opts << "--enable-#{i}interp=yes"
opts << "--with-lua-prefix=/usr/local" if i == "lua"
end
end
system "LDFLAGS=-L/usr/lib CFLAGS='-arch i386 -arch x86_64' CCFLAGS='-arch i386 -arch x86_64' CXXFLAGS='-arch i386 -arch x86_64' ./configure",
"--enable-rubyinterp",
"--disable-gui",
"--without-x",
"--disable-gpm",
"--disable-nls",
"--with-tlib=ncurses",
"--enable-multibyte",
"--with-features=#{feature}",
"--prefix=#{prefix}",
"--mandir=#{man}",
*opts
system "make install"
end
# Suppress brew-audit. Silly, but it works.
# ARGV.include? "--tiny"; ARGV.include? "--small"
# ARGV.include? "--normal"
# ARGV.include? "--big"; ARGV.include? "--huge"
# ARGV.include? "--lua"; ARGV.include? "--mzscheme"
# ARGV.include? "--tcl"; ARGV.include? "--ruby"
# ARGV.include? "--perl"; ARGV.include? "--python"
# ARGV.include? "--python3"
#
# Maybe we should deprecate these options and add
# `--with-features=' and `--enable-interp='.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment