macvim: add python framework to (c|ld)flags
MacVim assumes that it's building against a framework python and that the framework is in the compiler's and linker's framework search paths. This change means that #include <Python/Python.h> (which only works against a framework) and -framework Python can find a python other than the system python, avoiding header mixing-and-matching and avoiding the confusing double linkage in otool output. Leaving the existing python-config calls in place means that the python linkage will probably continue to work if macvim is built against a non-framework Python, though it will continue to pull in parts from the system framework. Only add the framework search path explicitly if our target Python isn't system Python, to avoid trouble on Xcode-only systems. Closes Homebrew/homebrew#37509.
This commit is contained in:
parent
89d11b4574
commit
a88eba1c45
1 changed files with 10 additions and 3 deletions
|
@ -1,8 +1,6 @@
|
|||
require 'formula'
|
||||
|
||||
# Reference: https://github.com/b4winckler/macvim/wiki/building
|
||||
class Macvim < Formula
|
||||
homepage 'http://code.google.com/p/macvim/'
|
||||
homepage 'https://code.google.com/p/macvim/'
|
||||
url 'https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz'
|
||||
version '7.4-73'
|
||||
sha1 'b87e37fecb305a99bc268becca39f8854e3ff9f0'
|
||||
|
@ -67,6 +65,15 @@ class Macvim < Formula
|
|||
elsif build.with? "python"
|
||||
ENV.prepend "LDFLAGS", `python-config --ldflags`.chomp
|
||||
ENV.prepend "CFLAGS", `python-config --cflags`.chomp
|
||||
framework_script = <<-EOS.undent
|
||||
import distutils.sysconfig
|
||||
print distutils.sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX")
|
||||
EOS
|
||||
framework_prefix = `python -c '#{framework_script}'`.chuzzle
|
||||
if framework_prefix && framework_prefix != "/System/Library/Frameworks"
|
||||
ENV.prepend "LDFLAGS", "-F#{framework_prefix}"
|
||||
ENV.prepend "CFLAGS", "-F#{framework_prefix}"
|
||||
end
|
||||
args << "--enable-pythoninterp"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue