Mac: Fix build errors when building BOINC with wxWidgets 3.1.5

This commit is contained in:
Charlie Fenton 2021-09-30 23:36:32 -07:00
parent 7d881cb88c
commit c04357bc19
4 changed files with 138 additions and 204 deletions

View File

@ -14,11 +14,17 @@
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
// On Macintosh we use only native controls in Simple View so the macOS
// automatically provides accessibility support. Though wxBitmapComboBox
// does not use MacOS native controls, wxChoice uses NSPopUpButton, so
// we create our own BitmapComboBox on Macintosh based on wxChoice, which
// we have hacked to allow adding bitmaps.
//
#include "stdwx.h"
#include "MacBitmapComboBox.h"
#include "mac_util.h"
#define POPUPBUTTONCONTROLHEIGHT 40
// wxChoice uses CreatePopupButtonControl
@ -54,13 +60,9 @@ CBOINCBitmapChoice::~CBOINCBitmapChoice() {
}
void CBOINCBitmapChoice::SetItemBitmap(unsigned int n, const wxBitmap& bitmap) {
wxMenuItem *item = m_popUpMenu->FindItemByPosition(n);
if ( item && bitmap.Ok() )
{
item->SetBitmap(bitmap);
}
wxChoice::SetItemBitmap(n, bitmap);
}
void CBOINCBitmapChoice::OnMouseDown(wxMouseEvent& event) {
wxToolTip::Enable(false);
event.Skip();

View File

@ -178,6 +178,7 @@
DD407ABB07D2FC7D00163EF5 /* mem_usage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD407AB707D2FC7D00163EF5 /* mem_usage.cpp */; };
DD431FAA0A41660D0060585A /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20286C33FDCF999611CA2CEA /* Carbon.framework */; };
DD4329910BA63DEC007CDF2A /* str_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7BF7D70B8E7A9800A009F7 /* str_util.cpp */; };
DD43475826FB397A00B8880F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD43474F26FB378100B8880F /* QuartzCore.framework */; };
DD48091F081A66F100A174AA /* BOINCSaver.nib in Resources */ = {isa = PBXBuildFile; fileRef = DD48091E081A66F100A174AA /* BOINCSaver.nib */; };
DD4AE04D13652BD700285859 /* cc_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD4AE04B13652BD700285859 /* cc_config.cpp */; };
DD4AE05013652C1300285859 /* cc_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD4AE04B13652BD700285859 /* cc_config.cpp */; };
@ -216,6 +217,7 @@
DD5F656523606AED009ED2A2 /* hostinfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD344BB607C5AEEE0043025C /* hostinfo.cpp */; };
DD5F656623607472009ED2A2 /* gfx_cleanup in Resources */ = {isa = PBXBuildFile; fileRef = DD5F654123605B41009ED2A2 /* gfx_cleanup */; };
DD5FE1B517828887003339DF /* translate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDF9350F176B0D0C00A2793C /* translate.cpp */; };
DD64A7782703379F005FE681 /* MacBitmapComboBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD64A774270329AA005FE681 /* MacBitmapComboBox.cpp */; };
DD64D8011F6BE5BA00FEEAAA /* MultiGPUMig.defs in Sources */ = {isa = PBXBuildFile; fileRef = DD64D8001F6BE5BA00FEEAAA /* MultiGPUMig.defs */; settings = {ATTRIBUTES = (Client, Server, ); }; };
DD6617880A3FFD8C00FFEBEB /* check_security.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD6617870A3FFD8C00FFEBEB /* check_security.cpp */; };
DD67F8140ADB9DD000B0015E /* wxPieCtrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD40E75D0ADB87BC00214518 /* wxPieCtrl.cpp */; };
@ -243,7 +245,6 @@
DD76BF9A17CB46830075936D /* opencl_boinc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD76BF9117CB45870075936D /* opencl_boinc.cpp */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
DD7748B50A356D6C0025D05E /* SetupSecurity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7748B40A356D6C0025D05E /* SetupSecurity.cpp */; };
DD7749680A3596380025D05E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD1929D80918A2F100C31BCF /* Security.framework */; };
DD77A71812F2D1C9006B82E9 /* MacBitmapComboBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD77A71612F2D1C9006B82E9 /* MacBitmapComboBox.cpp */; };
DD7A5D8312EEBE5E0006268E /* sg_TaskCommandPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5D8212EEBE5E0006268E /* sg_TaskCommandPopup.cpp */; };
DD7A5D9F12EEBFC20006268E /* sg_ProjectWebSitesPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5D9E12EEBFC20006268E /* sg_ProjectWebSitesPopup.cpp */; };
DD7A5DAB12EEC37B0006268E /* sg_ProjectCommandPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5DAA12EEC37B0006268E /* sg_ProjectCommandPopup.cpp */; };
@ -1009,6 +1010,7 @@
DD40825907D3076400163EF5 /* reduce.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = reduce.h; path = ../api/reduce.h; sourceTree = SOURCE_ROOT; };
DD40E75D0ADB87BC00214518 /* wxPieCtrl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = wxPieCtrl.cpp; path = ../clientgui/common/wxPieCtrl.cpp; sourceTree = SOURCE_ROOT; };
DD40E75E0ADB87BC00214518 /* wxPieCtrl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = wxPieCtrl.h; path = ../clientgui/common/wxPieCtrl.h; sourceTree = SOURCE_ROOT; };
DD43474F26FB378100B8880F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
DD4688410C165F3C0089F500 /* Uninstall BOINC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Uninstall BOINC.app"; sourceTree = BUILT_PRODUCTS_DIR; };
DD4688430C165F3C0089F500 /* Uninstaller-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Uninstaller-Info.plist"; sourceTree = "<group>"; };
DD4688590C1661970089F500 /* uninstall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uninstall.cpp; path = ../mac_installer/uninstall.cpp; sourceTree = SOURCE_ROOT; };
@ -1062,6 +1064,8 @@
DD5F654A23605C87009ED2A2 /* gfx_cleanup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = gfx_cleanup.mm; path = ../clientscr/gfx_cleanup.mm; sourceTree = "<group>"; };
DD6381450870DB78007A2F8E /* mac_icon.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = mac_icon.cpp; sourceTree = "<group>"; };
DD6381F80870DD83007A2F8E /* make_app_icon_h.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = make_app_icon_h.cpp; sourceTree = "<group>"; };
DD64A774270329AA005FE681 /* MacBitmapComboBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MacBitmapComboBox.cpp; path = ../clientgui/mac/MacBitmapComboBox.cpp; sourceTree = "<group>"; };
DD64A775270329AA005FE681 /* MacBitmapComboBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MacBitmapComboBox.h; path = ../clientgui/mac/MacBitmapComboBox.h; sourceTree = "<group>"; };
DD64D8001F6BE5BA00FEEAAA /* MultiGPUMig.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = MultiGPUMig.defs; sourceTree = "<group>"; };
DD64DF0409DCC5E000668B3A /* gutil_text.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = gutil_text.cpp; sourceTree = "<group>"; };
DD64E7D507D89DB800B176C8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
@ -1085,8 +1089,6 @@
DD76BF9217CB45870075936D /* opencl_boinc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opencl_boinc.h; sourceTree = "<group>"; };
DD7748980A356C880025D05E /* SetUpSecurity */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SetUpSecurity; sourceTree = BUILT_PRODUCTS_DIR; };
DD7748B40A356D6C0025D05E /* SetupSecurity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SetupSecurity.cpp; path = ../clientgui/mac/SetupSecurity.cpp; sourceTree = SOURCE_ROOT; };
DD77A71612F2D1C9006B82E9 /* MacBitmapComboBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MacBitmapComboBox.cpp; path = ../clientgui/mac/MacBitmapComboBox.cpp; sourceTree = "<group>"; };
DD77A71712F2D1C9006B82E9 /* MacBitmapComboBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MacBitmapComboBox.h; path = ../clientgui/mac/MacBitmapComboBox.h; sourceTree = "<group>"; };
DD7A5D8112EEBDF30006268E /* sg_TaskCommandPopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sg_TaskCommandPopup.h; path = ../clientgui/sg_TaskCommandPopup.h; sourceTree = SOURCE_ROOT; };
DD7A5D8212EEBE5E0006268E /* sg_TaskCommandPopup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sg_TaskCommandPopup.cpp; path = ../clientgui/sg_TaskCommandPopup.cpp; sourceTree = SOURCE_ROOT; };
DD7A5D9D12EEBFC20006268E /* sg_ProjectWebSitesPopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sg_ProjectWebSitesPopup.h; path = ../clientgui/sg_ProjectWebSitesPopup.h; sourceTree = SOURCE_ROOT; };
@ -1434,6 +1436,7 @@
buildActionMask = 2147483647;
files = (
DD3E15310A774397007E0084 /* Carbon.framework in Frameworks */,
DD43475826FB397A00B8880F /* QuartzCore.framework in Frameworks */,
DD3E15320A774397007E0084 /* IOKit.framework in Frameworks */,
DD3E15330A774397007E0084 /* Security.framework in Frameworks */,
DD21B49D0D750FC600AFFEE5 /* AppKit.framework in Frameworks */,
@ -1675,6 +1678,7 @@
DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */,
DD0BB7A11F62B105000151B2 /* IOSurface.framework */,
DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */,
DD43474F26FB378100B8880F /* QuartzCore.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = SOURCE_ROOT;
@ -2203,9 +2207,9 @@
DD30446A0864332D00D73756 /* config.h */,
DD1F0ACD0822069E00AFC5FA /* MacGUI.pch */,
DD1907FA17D1A2F100596F03 /* MacAccessiblity.mm */,
DD77A71612F2D1C9006B82E9 /* MacBitmapComboBox.cpp */,
DD77A71712F2D1C9006B82E9 /* MacBitmapComboBox.h */,
DDA9D3BB09189A8C0060E7A7 /* Mac_GUI.cpp */,
DD64A774270329AA005FE681 /* MacBitmapComboBox.cpp */,
DD64A775270329AA005FE681 /* MacBitmapComboBox.h */,
DDB295C8185B0DBD00B9F842 /* MacNotification.mm */,
DDA12AAD0A369C5800FBDD12 /* SecurityUtility.cpp */,
DD7748B40A356D6C0025D05E /* SetupSecurity.cpp */,
@ -3179,7 +3183,7 @@
DDB295C9185B0DBD00B9F842 /* MacNotification.mm in Sources */,
DD7A5D9F12EEBFC20006268E /* sg_ProjectWebSitesPopup.cpp in Sources */,
DD7A5DAB12EEC37B0006268E /* sg_ProjectCommandPopup.cpp in Sources */,
DD77A71812F2D1C9006B82E9 /* MacBitmapComboBox.cpp in Sources */,
DD64A7782703379F005FE681 /* MacBitmapComboBox.cpp in Sources */,
DDAEB54012F8295800EDEDBE /* LogBOINC.cpp in Sources */,
DD2B6C8013149177005D6F3E /* procinfo.cpp in Sources */,
DD80632D131FAA4100DC8971 /* sg_BoincSimpleFrame.cpp in Sources */,
@ -3949,13 +3953,13 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ../clientgui/mac/MacGUI.pch;
HEADER_SEARCH_PATHS = (
"../../wxWidgets-3.1.0/include",
"../../wxWidgets-3.1.0/build/osx/setup/cocoa/include",
"../../wxWidgets-3.1.5/include",
"../../wxWidgets-3.1.5/build/osx/setup/cocoa/include",
../clientgui,
"../lib/**",
);
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.0/build/osx/build/Debug";
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.5/build/osx/build/Debug";
OTHER_CFLAGS = (
"-DHAVE_CONFIG_H",
"-D_FILE_OFFSET_BITS=64",
@ -4026,13 +4030,13 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ../clientgui/mac/MacGUI.pch;
HEADER_SEARCH_PATHS = (
"../../wxWidgets-3.1.0/include",
"../../wxWidgets-3.1.0/build/osx/setup/cocoa/include",
"../../wxWidgets-3.1.5/include",
"../../wxWidgets-3.1.5/build/osx/setup/cocoa/include",
../clientgui,
"../lib/**",
);
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.0/build/osx/build/Release";
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.5/build/osx/build/Release";
OTHER_CFLAGS = (
"-DHAVE_CONFIG_H",
"-D_FILE_OFFSET_BITS=64",

View File

@ -41,6 +41,7 @@
# Add patches to build with Xcode 11 and OS 10.15 sdk 3/1/20
# Updated 8/4/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 5/18/21 for compatibility with zsh
# Updated 9/30/21 for wxCocoa 3.1.5
#
## This script requires OS 10.6 or later
##
@ -71,196 +72,118 @@ fi
echo ""
# Patch wxWidgets-3.1.0/src/png/pngstruct.h
if [ ! -f src/png/pngstruct.h.orig ]; then
cat >> /tmp/pngstruct_h_diff << ENDOFFILE
--- pngstruct.h 2013-11-11 05:10:39.000000000 -0800
+++ pngstruct_patched.h 2014-02-18 01:31:53.000000000 -0800
@@ -33,6 +33,13 @@
# undef const
#endif
## Add our custom method SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
## to wxChoice. We use this to create our own custom CBOINCBitmapComboBox
## which uses native Mac controls instead of wxBitmapComboBox which does not.
## By using only native Mac controls in BOINC SImple View, MacOS will provide
## accessibility support automatically.
##
## We patch 4 files to accomplish this.
##
# Patch wxWidgets-3.1.5/include/wx/osx/choice.h
if [ ! -f include/wx/osx/choice.h.orig ]; then
cat >> /tmp/choice_h_diff << ENDOFFILE
--- include/wx/osx/choice.h 2021-04-12 15:23:58.000000000 -0700
+++ include/wx/osx/choice_patched.h 2021-09-29 23:47:19.000000000 -0700
@@ -73,6 +73,7 @@
virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE;
virtual wxString GetString(unsigned int n) const wxOVERRIDE;
virtual void SetString(unsigned int pos, const wxString& s) wxOVERRIDE;
+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
// osx specific event handling common for all osx-ports
virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE;
ENDOFFILE
patch -bfi /tmp/choice_h_diff include/wx/osx/choice.h
rm -f /tmp/choice_h_diff
else
echo "include/wx/osx/choice.h already patched"
fi
+/* BOINC workaround patch to fix crashes on OS 10.5 or 10.6 when
+ * built with OS 10.7 SDK or later.
+ */
+#undef ZLIB_VERNUM
+#define ZLIB_VERNUM 0x1230
+/* End of BOINC workaround patch */
echo ""
# Patch wxWidgets-3.1.5/src/osx/choice_osx.cpp
if [ ! -f src/osx/choice_osx.cpp.orig ]; then
cat >> /tmp/choice_osx_cpp_diff << ENDOFFILE
--- src/osx/choice_osx.cpp 2021-04-12 15:23:58.000000000 -0700
+++ src/osx/choice_osx_patched.cpp 2021-09-30 00:26:06.000000000 -0700
@@ -212,6 +212,13 @@
return m_strings[n] ;
}
+void wxChoice::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
+{
+ wxCHECK_RET( IsValid(n), wxT("wxChoice::SetItemBitmap(): invalid index") );
+
/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
* with older builds.
*/
ENDOFFILE
patch -bfi /tmp/pngstruct_h_diff src/png/pngstruct.h
rm -f /tmp/pngstruct_h_diff
else
echo "src/png/pngstruct.h already patched"
fi
echo ""
# Patch src/osx/webview_webkit.mm
if [ ! -f src/osx/webview_webkit.mm.orig ]; then
cat >> /tmp/webview_webkit_mm_diff << ENDOFFILE
--- webview_webkit.mm 2016-02-28 13:33:37.000000000 -0800
+++ webview_webkit_patched.mm 2020-02-29 03:04:08.000000000 -0800
@@ -32,8 +32,8 @@
#include <UIKit/UIWebView.h>
#else
#include <WebKit/WebKit.h>
-#include <WebKit/HIWebView.h>
-#include <WebKit/CarbonUtils.h>
+//#include <WebKit/HIWebView.h>
+//#include <WebKit/CarbonUtils.h>
#endif
#include <Foundation/NSURLError.h>
ENDOFFILE
patch -bfi /tmp/webview_webkit_mm_diff src/osx/webview_webkit.mm
rm -f /tmp/webview_webkit_mm_diff
else
echo "src/osx/webview_webkit.mm already patched"
fi
echo ""
# Patch src/html/htmlctrl/webkit/webkit.mm
if [ ! -f src/html/htmlctrl/webkit/webkit.mm.orig ]; then
cat >> /tmp/webkit_mm_diff << ENDOFFILE
--- /Volumes/Dev/BOINC_Dev/wxWidgets-3.1.0/src/html/htmlctrl/webkit/webkit.mm 2016-02-28 13:33:37.000000000 -0800
+++ /Volumes/Dev/BOINC_Dev/wxWidgets-3.1.0/src/html/htmlctrl/webkit/webkit_patched.mm 2020-02-29 03:04:07.000000000 -0800
@@ -21,8 +21,8 @@
#include "wx/osx/private.h"
#include <WebKit/WebKit.h>
-#include <WebKit/HIWebView.h>
-#include <WebKit/CarbonUtils.h>
+//#include <WebKit/HIWebView.h>
+//#include <WebKit/CarbonUtils.h>
#include "wx/html/webkit.h"
ENDOFFILE
patch -bfi /tmp/webkit_mm_diff src/html/htmlctrl/webkit/webkit.mm
rm -f /tmp/webkit_mm_diff
else
echo "src/html/htmlctrl/webkit/webkit.mm already patched"
fi
echo ""
# Patch build/osx/setup/cocoa/include/wx/setup.h
if [ ! -f build/osx/setup/cocoa/include/wx/setup.h.orig ]; then
# First run wxWidget's built-in script to copy setup.h into place
cd build/osx || return 1
../../distrib/mac/pbsetup-sh ../../src ../../build/osx/setup/cocoa
cd ../.. || return 1
cat >> /tmp/setup_h_diff << ENDOFFILE
--- setup.h 2017-10-25 02:22:00.000000000 -0700
+++ setup_patched.h 2017-10-25 02:32:21.000000000 -0700
@@ -343,7 +343,10 @@
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
-#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
+/* BOINC workaround patch to fix crashes on OS 10.5 when built
+ * with OS 10.7 SDK or later.
+ */
+#define wxUSE_STD_IOSTREAM 0 // wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
@@ -668,7 +671,7 @@
// Default is 1.
//
// Recommended setting: 1
-#define wxUSE_MEDIACTRL 1
+#define wxUSE_MEDIACTRL 0 // 1
// Use wxWidget's XRC XML-based resource system. Recommended.
//
ENDOFFILE
patch -bfi /tmp/setup_h_diff build/osx/setup/cocoa/include/wx/setup.h
rm -f /tmp/setup_h_diff
else
echo "build/osx/setup/cocoa/include/wx/setup.h already patched"
fi
# Patch src/osx/window_osx.cpp
if [ ! -f src/osx/window_osx.cpp.orig ]; then
cat >> /tmp/window_osx_cpp_diff << ENDOFFILE
--- window_osx.cpp 2016-02-28 13:33:37.000000000 -0800
+++ window_osx_patched.cpp 2018-03-20 01:17:35.000000000 -0700
@@ -353,7 +353,8 @@
if ( !m_hasFont )
DoSetWindowVariant( m_windowVariant );
- if ( !m_label.empty() )
+// Fix wxWidgets 3.1.0 bug drawing wxStaticBox with empty label (fixed in wxWidgets 3.1.1)
+// if ( !m_label.empty() )
GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ;
// for controls we want to use best size for wxDefaultSize params )
ENDOFFILE
patch -bfi /tmp/window_osx_cpp_diff src/osx/window_osx.cpp
rm -f /tmp/window_osx_cpp_diff
else
echo "src/osx/window_osx.cpp already patched"
fi
# Patch src/osx/carbon/utilscocoa.mm
if [ ! -f src/osx/carbon/utilscocoa.mm.orig ]; then
cat >> /tmp/utilscocoa_mm_diff << ENDOFFILE
--- utilscocoa.mm 2016-02-28 13:33:37.000000000 -0800
+++ utilscocoa-patched.mm 2018-06-03 01:31:43.000000000 -0700
@@ -476,7 +476,10 @@
double wxOSXGetMainScreenContentScaleFactor()
{
- return [[NSScreen mainScreen] backingScaleFactor];
+ if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
+ return [[NSScreen mainScreen] backingScaleFactor];
+ else
+ return 1.0;
}
CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
ENDOFFILE
patch -bfi /tmp/utilscocoa_mm_diff src/osx/carbon/utilscocoa.mm
rm -f /tmp/utilscocoa_mm_diff
else
echo "src/osx/carbon/utilscocoa.mm already patched"
fi
# Patch src/osx/cocoa/window.mm
if [ ! -f src/osx/cocoa/window.mm.orig ]; then
cat >> /tmp/window_mm_diff << ENDOFFILE
--- window.mm 2016-02-28 13:33:37.000000000 -0800
+++ window-patched.mm 2018-06-08 01:28:01.000000000 -0700
@@ -1869,7 +1869,10 @@
double wxWidgetCocoaImpl::GetContentScaleFactor() const
{
NSWindow* tlw = [m_osxView window];
- return [tlw backingScaleFactor];
+ if ([tlw respondsToSelector:@selector(backingScaleFactor)])
+ return [tlw backingScaleFactor];
+ else
+ return 1.0;
}
+ dynamic_cast<wxChoiceWidgetImpl*>(GetPeer())->SetItemBitmap(n, bitmap);
+}
+
// ----------------------------------------------------------------------------
// client data
// ----------------------------------------------------------------------------
ENDOFFILE
patch -bfi /tmp/window_mm_diff src/osx/cocoa/window.mm
rm -f /tmp/window_mm_diff
patch -bfi /tmp/choice_osx_cpp_diff src/osx/choice_osx.cpp
rm -f /tmp/choice_osx_cpp_diff
else
echo "src/osx/cocoa/window.mm already patched"
echo "src/osx/choice_osx.cpp already patched"
fi
echo ""
# Patch wxWidgets-3.1.5/include/wx/osx/core/private.h
if [ ! -f include/wx/osx/core/private.h.orig ]; then
cat >> /tmp/private_h_cpp_diff << ENDOFFILE
--- include/wx/osx/core/private.h 2021-04-12 15:23:58.000000000 -0700
+++ include/wx/osx/core/private_patched.h 2021-09-30 01:11:28.000000000 -0700
@@ -809,6 +809,8 @@
}
virtual void SetItem(int pos, const wxString& item) = 0;
+
+ virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
};
ENDOFFILE
patch -bfi /tmp/private_h_cpp_diff include/wx/osx/core/private.h
rm -f /tmp/private_h_cpp_diff
else
echo "include/wx/osx/core/private.h already patched"
fi
echo ""
# Patch wxWidgets-3.1.5/src/osx/cocoa/choice.mm
if [ ! -f src/osx/cocoa/choice.mm.orig ]; then
cat >> /tmp/choice_mm_diff << ENDOFFILE
--- src/osx/cocoa/choice.mm 2021-09-28 22:52:32.000000000 -0700
+++ src/osx/cocoa/choice_patched.mm 2021-09-30 01:08:32.000000000 -0700
@@ -130,6 +130,12 @@
m_popUpMenu->FindItemByPosition( pos )->SetItemLabel( s ) ;
}
+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
+ {
+ if ( bitmap.Ok() )
+ m_popUpMenu->FindItemByPosition( n )->SetBitmap( bitmap ); ;
+ }
+
private:
wxMenu* m_popUpMenu;
};
ENDOFFILE
patch -bfi /tmp/choice_mm_diff src/osx/cocoa/choice.mm
rm -f /tmp/choice_mm_diff
else
echo "src/osx/cocoa/choice.mm already patched"
fi
echo ""
##***********************************************************
##*************** End of patches section ********************
##***********************************************************
doclean=""
stdout_target="/dev/stdout"
lprefix=""
@ -298,6 +221,11 @@ fi
retval=0
alreadyBuilt=0
# First run wxWidget's built-in script to copy setup.h into place
cd build/osx || return 1
../../distrib/mac/pbsetup-sh ../../src ../../build/osx/setup/cocoa
cd ../.. || return 1
if [ "${doclean}" != "clean" ] && [ -f "${libPathRel}/libwx_osx_cocoa_static.a" ]; then
GCCPATH=`xcrun -find gcc`
if [ $? -ne 0 ]; then
@ -337,7 +265,7 @@ else
## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under
## Xcode versions that can, otherwise it builds only the X86_64 library.
set -o pipefail
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.9" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_SANDARD="c++0x" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER NO_CXX11_REGEX WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
if [ ${retval} -ne 0 ]; then return 1; fi
if [ "x${lprefix}" != "x" ]; then
# copy library and headers to $lprefix
@ -393,7 +321,7 @@ else
## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under
## Xcode versions that can, otherwise it builds only the X86_64 library.
set -o pipefail
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.9" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_SANDARD="c++0x" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER NO_CXX11_REGEX WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
if [ ${retval} -ne 0 ]; then return 1; fi
if [ "x${lprefix}" != "x" ]; then
# copy debug library to $PREFIX

View File

@ -49,9 +49,9 @@ curlDirName="curl-7.73.0"
curlFileName="curl-7.73.0.tar.gz"
curlURL="https://curl.haxx.se/download/curl-7.73.0.tar.gz"
wxWidgetsDirName="wxWidgets-3.1.0"
wxWidgetsFileName="wxWidgets-3.1.0.tar.bz2"
wxWidgetsURL="https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.tar.bz2"
wxWidgetsDirName="wxWidgets-3.1.5"
wxWidgetsFileName="wxWidgets-3.1.5.tar.bz2"
wxWidgetsURL="https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxWidgets-3.1.5.tar.bz2"
freetypeDirName="freetype-2.9"
freetypeFileName="freetype-2.9.tar.bz2"