aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/macvim.rb
blob: 6bf5f78ff4df7cf03b9aa30b207216de3024eadd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'formula'

class Macvim <Formula
  head 'git://github.com/b4winckler/macvim.git'
  homepage 'http://code.google.com/p/macvim/'

  def options
    # Occassional reports of this brew failing during the icon step
    [["--no-icons", "Don't generate custom document icons."]]
  end

  def install
    # MacVim's Xcode project gets confused by $CC
    # Disable it until someone figures out why it fails.
    ENV['CC'] = nil
    ENV['CFLAGS'] = nil
    ENV['CXX'] = nil
    ENV['CXXFLAGS'] = nil

    system "./configure",
           "--with-macsdk=#{MACOS_VERSION}",
           # Add some features
           "--with-features=huge",
           "--enable-perlinterp",
           "--enable-pythoninterp",
           "--enable-rubyinterp",
           "--enable-tclinterp"

    if ARGV.include? "--no-icons"
      inreplace "src/MacVim/icons/Makefile", "$(MAKE) -C makeicns", ""
      inreplace "src/MacVim/icons/make_icons.py", "dont_create = False", "dont_create = True"
    end

    system "make"

    prefix.install "src/MacVim/build/Release/MacVim.app"
    inreplace "src/MacVim/mvim", /^# VIM_APP_DIR=\/Applications$/,
              "VIM_APP_DIR=#{prefix}"
    bin.install "src/MacVim/mvim"

    # Create MacVim vimdiff, view, ex equivalents
    %w[mvimdiff mview mvimex].each {|f| ln_s bin+'mvim', bin+f}
  end

  def caveats
    "MacVim.app installed to #{prefix}."
  end
end