llvm: fix python binding

This commit fixes three things:
* Python 2.7 is required, so using brew python for old Mac OS X.
* Install python bindings no matter which python we build aginst
  system or brew
* Clarify `with-python` option

Closes Homebrew/homebrew#36229.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Xu Cheng 2015-01-27 13:05:49 +08:00 committed by Mike McQuaid
parent c9554ec185
commit eae9d81868

View file

@ -70,6 +70,7 @@ class Llvm < Formula
option "with-lldb", "Build LLDB debugger"
option "with-rtti", "Build with C++ RTTI"
option "with-all-targets", "Build all target backends"
option "with-python", "Build Python bindings against Homebrew Python"
option "without-shared", "Don't build LLVM as a shared library"
option "without-assertions", "Speeds up LLVM, but provides less debug information"
@ -78,7 +79,11 @@ class Llvm < Formula
deprecated_option "disable-shared" => "without-shared"
deprecated_option "disable-assertions" => "without-assertions"
depends_on :python => :optional
if MacOS.version <= :snow_leopard
depends_on :python
else
depends_on :python => :optional
end
depends_on "swig" if build.with? "lldb"
keg_only :provided_by_osx
@ -91,10 +96,6 @@ class Llvm < Formula
# Apple's libstdc++ is too old to build LLVM
ENV.libcxx if ENV.compiler == :clang
if build.with?("python") && build.without?("shared")
fail "The Python bindings need the shared library."
end
if build.with?("lldb") && build.without?("clang")
fail "Building LLDB needs Clang support library."
end
@ -148,10 +149,8 @@ class Llvm < Formula
end
# install llvm python bindings
if build.with? "python"
(lib+"python2.7/site-packages").install buildpath/"bindings/python/llvm"
(lib+"python2.7/site-packages").install buildpath/"tools/clang/bindings/python/clang" if build.with? "clang"
end
(lib+"python2.7/site-packages").install buildpath/"bindings/python/llvm"
(lib+"python2.7/site-packages").install buildpath/"tools/clang/bindings/python/clang" if build.with? "clang"
end
test do