diff options
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/wxmac.rb | 201 |
1 files changed, 129 insertions, 72 deletions
diff --git a/Library/Formula/wxmac.rb b/Library/Formula/wxmac.rb index f4642cdf2..a1c172480 100644 --- a/Library/Formula/wxmac.rb +++ b/Library/Formula/wxmac.rb @@ -1,48 +1,53 @@ require 'formula' -def build_python?; ARGV.include? "--python"; end - -def which_python - if ARGV.include? '--system-python' - '/usr/bin/python' - else - 'python' - end -end - class Wxpython < Formula + # For 2.8, we use this separate formula for wxPython. For 2.9 we use the combined one. url 'http://downloads.sourceforge.net/wxpython/wxPython-src-2.8.12.1.tar.bz2' md5 '8c06c5941477beee213b4f2fa78be620' + head 'http://svn.wxwidgets.org/svn/wx/wxPython/trunk/', :using => StrictSubversionDownloadStrategy + homepage 'http://www.wxpython.org' end class Wxmac < Formula url 'http://downloads.sourceforge.net/project/wxwindows/2.8.12/wxMac-2.8.12.tar.bz2' - homepage 'http://www.wxwidgets.org' md5 '876000a9a9742c3c75a2597afbcb8856' + devel do + # 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' + end + + homepage 'http://www.wxwidgets.org' + def options [ ['--python', 'Build Python bindings'], - ['--system-python', 'Build against the OS X Python instead of whatever is in the path.'] + ['--devel', 'Using unstable 2.9.x series (But 64-bit & cocoa support!)'] ] end def test_python_arch - system "arch -i386 #{which_python} --version" - rescue - onoe "No python on path or default python does not support 32-bit." - puts <<-EOS.undent - Your default python (if any) does not support 32-bit execution, which is - required for the wxmac python bindings. You can install the Homebrew - python with 32-bit support by running: - - brew install python --universal --framework - - EOS - exit 99 + # wxPython 2.8 does not yet support 64bit. But 2.9 with (--devel) does! + unless ARGV.build_devel? + begin + system "arch -i386 python --version" + rescue + onoe "No python on path or default python does not support 32-bit." + puts <<-EOS.undent + Your default python (if any) does not support 32-bit execution, which is + required for the wxmac python bindings. You can install the Homebrew + python with 32-bit support by running: + + brew install python --universal --framework + + EOS + exit 99 + end + end end - def install_wx_python +def install_wx_python opts = [ # Reference our wx-config "WX_CONFIG=#{bin}/wx-config", @@ -50,37 +55,47 @@ class Wxmac < Formula "UNICODE=1", # And thus we have no need for multiversion support "INSTALL_MULTIVERSION=0", - # TODO: see if --with-opengl can work on the wxmac build + # OpenGL and stuff "BUILD_GLCANVAS=1", - # Contribs that I'm not sure anyone cares about, but - # wxPython tries to build them by default - "BUILD_STC=1", - "BUILD_GIZMOS=1" + "BUILD_GIZMOS=1", + "BUILD_STC=1" ] Dir.chdir "wxPython" do - system "arch", "-i386", - which_python, - "setup.py", - "build_ext", - *opts - - system "arch", "-i386", - which_python, - "setup.py", - "install", - "--prefix=#{prefix}", - *opts + if ARGV.build_devel? + system "python", "setup.py", + "build_ext", + "WXPORT=osx_cocoa", + *opts + system "python", "setup.py", + "install", + "--prefix=#{prefix}", + "WXPORT=osx_cocoa", + *opts + else # for wx 2.8 force 32-bit install with the 10.6 sdk: + %w{ CFLAGS CXXFLAGS LDFLAGS }.each do |compiler_flag| + ENV.remove compiler_flag, "-arch x86_64" + ENV.append compiler_flag, "-arch i386" + # The python extension for wx2.8 has to be built with the 10.6 sdk, but we have no configure step, so: + ENV.append compiler_flag, "-isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" + end + system "arch", "-i386", + "python", + "setup.py", + "build_ext", + *opts + + system "arch", "-i386", + "python", + "setup.py", + "install", + "--prefix=#{prefix}", + *opts + end end end def install - test_python_arch if build_python? - - # Force i386 - %w{ CFLAGS CXXFLAGS LDFLAGS OBJCFLAGS OBJCXXFLAGS }.each do |compiler_flag| - ENV.remove compiler_flag, "-arch x86_64" - ENV.append compiler_flag, "-arch i386" - end + test_python_arch if ARGV.include? "--python" args = [ "--disable-debug", @@ -90,46 +105,88 @@ class Wxmac < Formula "--with-opengl" ] - # build will fail on Lion unless we use the 10.6 sdk - if MacOS.lion? - args << "--with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk" - args << "--with-macosx-version-min=10.6" + if ARGV.build_devel? + args += [ + "--with-osx_cocoa", + "--with-libjpeg", + "--with-libtiff", + "--with-libpng", + "--with-zlib", + "--enable-dnd", + "--enable-clipboard", + "--enable-webkit", + "--enable-svg", + "--with-expat" + ] + end + + unless ARGV.build_devel? + # Force i386 wor wx 2.8 + %w{ CFLAGS CXXFLAGS LDFLAGS OBJCFLAGS OBJCXXFLAGS }.each do |compiler_flag| + ENV.remove compiler_flag, "-arch x86_64" + ENV.append compiler_flag, "-arch i386" + end + # build will fail on Lion unless we use the 10.6 sdk (note wx 2.9 does fine) + if MacOS.lion? + args << "--with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk" + args << "--with-macosx-version-min=10.6" + end end system "./configure", *args system "make install" - # erlang needs contrib/stc during configure phase. - %w{ gizmos stc ogl }.each do |c| - system "make -C contrib/src/$c install" + unless ARGV.build_devel? + # erlang needs contrib/stc during configure phase. + %w{ gizmos stc ogl }.each do |c| + system "make -C contrib/src/#{c} install" + end end - if build_python? + if ARGV.include? "--python" ENV['WXWIN'] = Dir.getwd - Wxpython.new.brew { install_wx_python } + if ARGV.build_devel? + # We have already downloaded wxPython in a bundle with wxWidgets + install_wx_python + else + # We need to download wxPython separately (see formula at top) + Wxpython.new.brew { install_wx_python } + end end end def caveats - s = <<-EOS.undent - wxWidgets 2.8.x builds 32-bit only, so you probably won't be able to use it - for other Homebrew-installed softare on Snow Leopard. - - EOS - - if build_python? + s = '' + unless ARGV.build_devel? s += <<-EOS.undent - Python bindings require that Python be built as a Framework; this is the - default for Mac OS provided Python but not for Homebrew python (compile - using the --framework option). + wxWidgets 2.8.x builds 32-bit only, so you probably won't be able to use it + for other Homebrew-installed software. You can try to build with --devel to + get the wxWidgets 2.9.x (unstable) for 64-bit and cocoa support. - You will also need 32-bit support for Python. If you are on a 64-bit - platform, you will need to run Python in 32-bit mode: + EOS + if ARGV.include? '--python' + s += <<-EOS.undent + You will also need run python in 32-bit mode for wx. If you are on a 64-bit + platform, you will need to run Python in 32-bit mode: arch -i386 python [args] - Homebrew Python does not support this by default (compile using the - --universal option) + Homebrew Python does not support this by default. So, homebrew Python must + be built with --universal --framework. + Alternative, you can try brew wxmac --python --devel for wx 2.9 in 64-bit. + + EOS + end + else + s += "wx 2.9.x is the unstable (--devel) release. Some things *may* be broken.\n\n" + end + + if ARGV.include? '--python' + s += <<-EOS.undent + Python bindings require that Python be built as a Framework; this is the + default for Mac OS provided Python but not (yet) for Homebrew Python. + Build python with `--framework`. + EOS end |
