aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/wxmac.rb
blob: a5853ebd2db94f510bba7d2a9d3cd1654ae73e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
require 'formula'

class Wxmac < Formula
  homepage "http://www.wxwidgets.org"
  url "https://downloads.sourceforge.net/project/wxwindows/3.0.1/wxWidgets-3.0.1.tar.bz2"
  sha1 "73e58521d6871c9f4d1e7974c6e3a81629fddcf8"

  bottle do
    revision 5
    sha1 "a7494585eb251713ff556a017487f89e430245a2" => :mavericks
    sha1 "bb2879ebb28bbb4915908c82e300da1f4700b5d2" => :mountain_lion
    sha1 "df8910df63ef0ef5d5938d4f09487dbefa14455b" => :lion
  end

  depends_on "jpeg"
  depends_on "libpng"
  depends_on "libtiff"


  # Patches for 3.0.1 source release to reference the correct dispatch types
  # regardless of whether built for OS X 10.10 or 10.9 (and earlier...)
  #
  # Patch derived from ticket comments and final changesets below:
  #
  #  http://trac.wxwidgets.org/ticket/16329
  #  http://trac.wxwidgets.org/changeset/76744
  #  http://trac.wxwidgets.org/changeset/76743
  #
  # NOTE: Revisit with next upstream release; changes already in upstream trunk

  # Patch Changeset 76744
  # http://trac.wxwidgets.org/changeset/76744
  patch :p3 do
    url "http://trac.wxwidgets.org/changeset/76744?format=diff&new=7674"
    sha1 "5cd1536d2494ef0b4d21f03799b0ac024572ae31"
  end

  # Patch Changeset 76743
  #
  # This is embedded because all but the last file is patchable with the changeset
  # checked into the upstream trunk (webview_webkit.mm). The version of that file
  # in trunk had changed enough that the patch cannot match any of the hunks to
  # their corresponding line numbers in the 3.0.2 release train source distribution.
  def patches
    patches = {
      :p1 => DATA,
    }
  end

  def install
    # need to set with-macosx-version-min to avoid configure defaulting to 10.5
    # need to enable universal binary build in order to build all x86_64
    # FIXME I don't believe this is the whole story, surely this can be fixed
    # without building universal for users who don't need it. - Jack
    # headers need to specify x86_64 and i386 or will try to build for ppc arch
    # and fail on newer OSes
    # https://trac.macports.org/browser/trunk/dports/graphics/wxWidgets30/Portfile#L80
    ENV.universal_binary
    args = [
      "--disable-debug",
      "--prefix=#{prefix}",
      "--enable-shared",
      "--enable-unicode",
      "--enable-std_string",
      "--enable-display",
      "--with-opengl",
      "--with-osx_cocoa",
      "--with-libjpeg",
      "--with-libtiff",
      # Otherwise, even in superenv, the internal libtiff can pick
      # up on a nonuniversal xz and fail
      # https://github.com/Homebrew/homebrew/issues/22732
      "--without-liblzma",
      "--with-libpng",
      "--with-zlib",
      "--enable-dnd",
      "--enable-clipboard",
      "--enable-webkit",
      "--enable-svg",
      "--enable-mediactrl",
      "--enable-graphics_ctx",
      "--enable-controls",
      "--enable-dataviewctrl",
      "--with-expat",
      "--with-macosx-version-min=#{MacOS.version}",
      "--enable-universal_binary=#{Hardware::CPU.universal_archs.join(',')}",
      "--disable-precomp-headers",
      # This is the default option, but be explicit
      "--disable-monolithic"
    ]

    system "./configure", *args
    system "make install"
  end
end

__END__

diff -ur a/include/wx/defs.h b/include/wx/defs.h
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -3169,13 +3169,20 @@
 DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
 DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
 DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
+DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);

 typedef WX_UIWindow WXWindow;
 typedef WX_UIView WXWidget;
 typedef WX_EAGLContext WXGLContext;
 typedef WX_NSString* WXGLPixelFormat;
+typedef WX_UIWebView OSXWebViewPtr;

-#endif
+#endif
+
+#if wxOSX_USE_COCOA_OR_CARBON
+DECLARE_WXCOCOA_OBJC_CLASS(WebView);
+typedef WX_WebView OSXWebViewPtr;
+#endif

 #endif /* __WXMAC__ */

diff -ur a/include/wx/html/webkit.h b/include/wx/html/webkit.h
--- a/include/wx/html/webkit.h
+++ b/include/wx/html/webkit.h
@@ -18,7 +18,6 @@
 #endif

 #include "wx/control.h"
-DECLARE_WXCOCOA_OBJC_CLASS(WebView);

 // ----------------------------------------------------------------------------
 // Web Kit Control
@@ -107,7 +106,7 @@
     wxString m_currentURL;
     wxString m_pageTitle;

-    WX_WebView m_webView;
+    OSXWebViewPtr m_webView;

     // we may use this later to setup our own mouse events,
     // so leave it in for now.
diff -ur a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h
--- a/include/wx/osx/webview_webkit.h
+++ b/include/wx/osx/webview_webkit.h
@@ -158,7 +158,7 @@
     wxWindowID m_windowID;
     wxString m_pageTitle;

-    wxObjCID m_webView;
+    OSXWebViewPtr m_webView;

     // we may use this later to setup our own mouse events,
     // so leave it in for now.
diff -ur a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm
--- a/src/osx/webview_webkit.mm
+++ b/src/osx/webview_webkit.mm
@@ -442,7 +442,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView goBack];
+    [m_webView goBack];
 }

 void wxWebViewWebKit::GoForward()
@@ -450,7 +450,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView goForward];
+    [m_webView goForward];
 }

 void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
@@ -849,7 +849,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView cut:m_webView];
+    [m_webView cut:m_webView];
 }

 void wxWebViewWebKit::Copy()
@@ -857,7 +857,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView copy:m_webView];
+    [m_webView copy:m_webView];
 }

 void wxWebViewWebKit::Paste()
@@ -865,7 +865,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView paste:m_webView];
+    [m_webView paste:m_webView];
 }

 void wxWebViewWebKit::DeleteSelection()
@@ -873,7 +873,7 @@
     if ( !m_webView )
         return;

-    [(WebView*)m_webView deleteSelection];
+    [m_webView deleteSelection];
 }

 bool wxWebViewWebKit::HasSelection() const