2009-11-02 02:57:04 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Wxmac < Formula
|
2012-02-26 22:04:37 +00:00
|
|
|
# wxPython 2.9 with 64bit and cocoa support ships a (patched) wxmac:
|
|
|
|
url 'http://sourceforge.net/projects/wxpython/files/wxPython/2.9.3.1/wxPython-src-2.9.3.1.tar.bz2'
|
|
|
|
md5 '11f5a423c05c43b4ff8c9f11f1986f04'
|
2012-02-15 23:23:55 +00:00
|
|
|
homepage 'http://www.wxwidgets.org'
|
|
|
|
|
2011-03-30 04:29:41 +00:00
|
|
|
def options
|
|
|
|
[
|
2012-02-26 22:04:37 +00:00
|
|
|
['--no-python', 'Do not build Python bindings']
|
2011-03-30 04:29:41 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2012-02-26 22:04:37 +00:00
|
|
|
def check_framework_python
|
|
|
|
# Check if python is built as a framework
|
|
|
|
q = `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`
|
|
|
|
if q.chomp.empty?
|
|
|
|
onoe "Python needs to be built as a framework. `brew python`."
|
|
|
|
exit 98
|
2012-02-15 23:23:55 +00:00
|
|
|
end
|
2011-03-30 04:29:41 +00:00
|
|
|
end
|
|
|
|
|
2012-02-15 23:23:55 +00:00
|
|
|
def install_wx_python
|
2012-02-26 22:04:37 +00:00
|
|
|
args = [
|
2011-03-30 04:29:41 +00:00
|
|
|
# Reference our wx-config
|
|
|
|
"WX_CONFIG=#{bin}/wx-config",
|
2012-01-01 03:01:35 +00:00
|
|
|
# At this time Wxmac is installed Unicode only
|
|
|
|
"UNICODE=1",
|
2011-03-30 04:29:41 +00:00
|
|
|
# And thus we have no need for multiversion support
|
|
|
|
"INSTALL_MULTIVERSION=0",
|
2012-02-15 23:23:55 +00:00
|
|
|
# OpenGL and stuff
|
2012-01-01 03:01:35 +00:00
|
|
|
"BUILD_GLCANVAS=1",
|
2012-02-15 23:23:55 +00:00
|
|
|
"BUILD_GIZMOS=1",
|
|
|
|
"BUILD_STC=1"
|
2011-03-30 04:29:41 +00:00
|
|
|
]
|
2012-02-21 06:04:21 +00:00
|
|
|
cd "wxPython" do
|
2012-02-26 22:04:37 +00:00
|
|
|
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
|
2012-02-15 23:23:55 +00:00
|
|
|
|
2012-02-26 22:04:37 +00:00
|
|
|
def patches
|
|
|
|
# webkit and clang 3.x needs fix for wx(Python) 2.9.3.1: http://trac.wxwidgets.org/ticket/13565
|
|
|
|
if MacOS.clang_version.to_f >= 3.0
|
|
|
|
{ :p0 => "http://trac.wxwidgets.org/raw-attachment/ticket/13565/ClangCompat.diff" }
|
2011-03-30 04:29:41 +00:00
|
|
|
end
|
2010-04-26 18:21:54 +00:00
|
|
|
end
|
2009-11-02 02:57:04 +00:00
|
|
|
|
|
|
|
def install
|
2012-02-26 22:04:37 +00:00
|
|
|
check_framework_python unless ARGV.include? "--no-python"
|
2009-11-02 02:57:04 +00:00
|
|
|
|
2011-10-30 23:47:24 +00:00
|
|
|
args = [
|
2012-02-26 22:04:37 +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",
|
|
|
|
"--with-macosx-version-min=#{MacOS.version}" # need to set this, to avoid configure defaulting to 10.5
|
|
|
|
]
|
2011-10-30 23:47:24 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2009-11-02 02:57:04 +00:00
|
|
|
system "make install"
|
2011-03-30 04:29:41 +00:00
|
|
|
|
2012-02-26 22:04:37 +00:00
|
|
|
unless ARGV.include? "--no-python"
|
2011-03-30 04:29:41 +00:00
|
|
|
ENV['WXWIN'] = Dir.getwd
|
2012-02-26 22:04:37 +00:00
|
|
|
# We have already downloaded wxPython in a bundle with wxWidgets
|
|
|
|
install_wx_python
|
2011-03-30 04:29:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
2012-02-15 23:23:55 +00:00
|
|
|
s = ''
|
2012-02-26 22:04:37 +00:00
|
|
|
unless ARGV.include? '--no-python'
|
|
|
|
q = `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`
|
|
|
|
if q.chomp.empty?
|
2012-02-15 23:23:55 +00:00
|
|
|
s += <<-EOS.undent
|
2012-02-26 22:04:37 +00:00
|
|
|
Python bindings require that Python be built as a Framework.
|
2012-02-15 23:23:55 +00:00
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|
2011-03-30 04:29:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return s
|
2009-11-02 02:57:04 +00:00
|
|
|
end
|
|
|
|
end
|