This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmacvim.rb
88 lines (74 loc) · 2.99 KB
/
macvim.rb
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
require 'formula'
class Macvim < Formula
desc 'GUI for vim, made for OS X'
homepage 'https://github.com/macvim-dev/macvim'
head 'https://github.com/macvim-dev/macvim.git'
option 'with-properly-linked-python2-python3', 'Link with properly linked Python 2 and Python 3. You will get deadly signal SEGV if you don\'t have properly linked Python 2 and Python 3.'
depends_on 'gettext' => :build
depends_on 'lua' => :build
depends_on 'python3' => :build
def get_path(name)
f = Formulary.factory(name)
if f.rack.directory?
kegs = f.rack.subdirs.map { |keg| Keg.new(keg) }.sort_by(&:version)
return kegs.last.to_s unless kegs.empty?
end
nil
end
def install
perl_version = '5.16'
ENV.append 'VERSIONER_PERL_VERSION', perl_version
ENV.append 'VERSIONER_PYTHON_VERSION', '2.7'
ENV.append 'vi_cv_path_python3', "#{HOMEBREW_PREFIX}/bin/python3"
ENV.append 'vi_cv_path_plain_lua', "#{HOMEBREW_PREFIX}/bin/lua"
ENV.append 'vi_cv_dll_name_perl', "/System/Library/Perl/#{perl_version}/darwin-thread-multi-2level/CORE/libperl.dylib"
ENV.append 'vi_cv_dll_name_python3', "#{HOMEBREW_PREFIX}/Frameworks/Python.framework/Versions/3.7/Python"
opts = []
if build.with? 'properly-linked-python2-python3'
opts << '--with-properly-linked-python2-python3'
end
system './configure', "--prefix=#{prefix}",
'--with-features=huge',
'--enable-multibyte',
'--enable-terminal',
'--enable-netbeans',
'--with-tlib=ncurses',
'--enable-cscope',
'--enable-termtruecolor',
'--enable-perlinterp=dynamic',
'--enable-pythoninterp=dynamic',
'--enable-python3interp=dynamic',
'--enable-rubyinterp=dynamic',
'--enable-luainterp=dynamic',
"--with-lua-prefix=#{HOMEBREW_PREFIX}",
*opts
system 'make'
apppath = 'src/MacVim/build/Release/MacVim.app'
instance_variable_set("@gettext", get_path("gettext"))
system "PATH=#{@gettext}/bin:$PATH " +
"MSGFMT=#{@gettext}/bin/msgfmt " +
'INSTALL_DATA=install ' +
'FILEMOD=644 ' +
"LOCALEDIR=../../#{apppath}/Contents/Resources/vim/runtime/lang " +
'make -C src/po install'
prefix.install apppath
appbin = prefix + "MacVim.app/Contents/bin"
bin = prefix + 'bin'
mkdir_p bin
[
'vim', 'vimdiff', 'view',
'gvim', 'gvimdiff', 'gview',
'mvim', 'mvimdiff', 'mview'
].each do |t|
ln_s '../MacVim.app/Contents/bin/mvim', bin + t
end
end
test do
(testpath/'a').write 'hai'
(testpath/'b').write 'bai'
system bin/'vimdiff', 'a', 'b',
'-c', 'FormatCommand diffformat',
'-c', 'w! diff.html', '-c', 'qa!'
File.exist? 'diff.html'
end
end