homebrew-core/Formula/wxmac.rb

96 lines
2.4 KiB
Ruby
Raw Normal View History

require 'formula'
2012-07-22 22:03:46 +00:00
class FrameworkPython < Requirement
2013-01-19 01:30:43 +00:00
fatal true
2012-07-22 22:03:46 +00:00
def message; <<-EOS.undent
Python needs to be built as a framework.
EOS
end
def satisfied?
q = `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`
not q.chomp.empty?
end
end
2011-03-10 05:11:03 +00:00
class Wxmac < Formula
homepage 'http://www.wxwidgets.org'
url 'http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2'
sha1 'c292cd45b51e29c558c4d9cacf93c4616ed738b9'
2012-08-23 22:14:08 +00:00
option 'no-python', 'Do not build Python bindings'
2012-08-23 22:14:08 +00:00
depends_on FrameworkPython.new unless build.include? "no-python"
2012-07-22 22:03:46 +00:00
def install_wx_python
args = [
# Reference our wx-config
"WX_CONFIG=#{bin}/wx-config",
# At this time Wxmac is installed Unicode only
"UNICODE=1",
# Some scripts (e.g. matplotlib) expect to `import wxversion`, which is
# only available on a multiversion build. Besides that `import wx` still works.
"INSTALL_MULTIVERSION=1",
# OpenGL and stuff
"BUILD_GLCANVAS=1",
"BUILD_GIZMOS=1",
"BUILD_STC=1"
]
cd "wxPython" do
ENV.append_to_cflags '-arch x86_64' if MacOS.prefer_64_bit?
system "python", "setup.py",
"build_ext",
"WXPORT=osx_cocoa",
*args
system "python", "setup.py",
"install",
"--prefix=#{prefix}",
"WXPORT=osx_cocoa",
*args
end
end
def install
2012-08-23 22:14:08 +00:00
# need to set with-macosx-version-min to avoid configure defaulting to 10.5
args = [
2012-07-22 22:03:46 +00:00
"--disable-debug",
"--prefix=#{prefix}",
"--enable-unicode",
"--enable-std_string",
"--enable-display",
"--with-opengl",
"--with-osx_cocoa",
"--with-libjpeg",
"--with-libtiff",
"--with-libpng",
"--with-zlib",
"--enable-dnd",
"--enable-clipboard",
"--enable-webkit",
"--enable-svg",
"--with-expat",
2012-08-23 22:14:08 +00:00
"--with-macosx-version-min=#{MacOS.version}"
2012-07-22 22:03:46 +00:00
]
system "./configure", *args
system "make install"
2012-08-23 22:14:08 +00:00
unless build.include? "no-python"
ENV['WXWIN'] = Dir.getwd
# We have already downloaded wxPython in a bundle with wxWidgets
install_wx_python
end
end
def caveats
s = ''
fp = FrameworkPython.new
2012-08-23 22:14:08 +00:00
unless build.include? 'no-python' or fp.satisfied?
s += fp.message
end
return s
end
end