vim: fix dynamic linking to Homebrew's python

Closes Homebrew/homebrew#26695.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
mbcoguno 2014-05-10 12:20:31 +08:00 committed by Jack Nagel
parent 9b8d5fb684
commit 6eae2f82dc

View file

@ -27,7 +27,7 @@ class Vim < Formula
end
depends_on :python => :recommended
depends_on 'python3' => :optional
depends_on :python3 => :optional
depends_on 'lua' => :optional
depends_on 'luajit' => :optional
depends_on 'gtk+' if build.with? 'client-server'
@ -81,6 +81,17 @@ class Vim < Formula
"--with-compiledby=Homebrew",
*opts
# Require Python's dynamic library, and needs to be built as a framework.
if build.with? "python" and build.with? "python3"
py_prefix = `python -c "import sys; print(sys.prefix)"`.chomp
py3_prefix = `python3 -c "import sys; print(sys.prefix)"`.chomp
# Help vim find Python's dynamic library as absolute path.
inreplace "src/auto/config.mk", /-DDYNAMIC_PYTHON_DLL=\\".*\\"/,
%(-DDYNAMIC_PYTHON_DLL=\'\"#{py_prefix}/Python\"\')
inreplace "src/auto/config.mk", /-DDYNAMIC_PYTHON3_DLL=\\".*\\"/,
%(-DDYNAMIC_PYTHON3_DLL=\'\"#{py3_prefix}/Python\"\')
end
system "make"
# If stripping the binaries is not enabled, vim will segfault with
# statically-linked interpreters like ruby
@ -90,13 +101,12 @@ class Vim < Formula
end
def caveats
s = ''
if build.with? "python" and build.with? "python3"
s += <<-EOS.undent
<<-EOS.undent
Vim has been built with dynamic loading of Python 2 and Python 3.
Note: if Vim dynamically loads both Python 2 and Python 3, it may
crash. For more information, see:
Note: For more information about Vim dynamically loads both
Python 2 and Python 3, see:
http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python3
EOS
end