Skip to content

Instantly share code, notes, and snippets.

@evadne
Created July 14, 2017 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evadne/fffc6f08180b1f0cf191242de08008c3 to your computer and use it in GitHub Desktop.
Save evadne/fffc6f08180b1f0cf191242de08008c3 to your computer and use it in GitHub Desktop.
wxmac for Homebrew on macOS 10.13 Beta (17A306f)
class Wxmac < Formula
desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
homepage "https://www.wxwidgets.org"
url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.3.1/wxWidgets-3.0.3.1.tar.bz2"
sha256 "3164ad6bc5f61c48d2185b39065ddbe44283eb834a5f62beb13f1d0923e366e4"
head "https://github.com/wxWidgets/wxWidgets.git"
bottle do
cellar :any
sha256 "9766307eb821a254c81002e7318aa89dc2f4cd7a5a09515fce54eb96ae70f898" => :sierra
sha256 "2e1552eb9bd91dec735b107686b0dfa501e6bc37997d8e1b1faea930783b63ae" => :el_capitan
sha256 "0a159643c82f3d57e5c10e3755b1e085bbf92cf5fdd1f87e26e8757faa4b40bf" => :yosemite
end
devel do
url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.tar.bz2"
sha256 "e082460fb6bf14b7dd6e8ac142598d1d3d0b08a7b5ba402fdbf8711da7e66da8"
# Fix Issue: Creating wxComboCtrl without wxTE_PROCESS_ENTER style results in an assert.
patch do
url "https://github.com/wxWidgets/wxWidgets/commit/cee3188c1abaa5b222c57b87cc94064e56921db8.patch?full_index=1"
sha256 "c2389fcb565ec4d488aed2586da15ec72d7fdb8c614f266f8f936d6e4ea10210"
end
# Fix Issue: Building under macOS in C++11 mode for i386 architecture (but not amd64) results in an error about narrowing conversion.
patch do
url "https://github.com/wxWidgets/wxWidgets/commit/ee486dba32d02c744ae4007940f41a5b24b8c574.patch?full_index=1"
sha256 "dd73556b7a91cbfa63e2eafa8bab48ce5308b382d8e26e60b79f61d0520871e3"
end
# Fix Issue: Building under macOS in C++11 results in several -Winconsistent-missing-override warnings.
patch do
url "https://github.com/wxWidgets/wxWidgets/commit/173ecd77c4280e48541c33bdfe499985852935ba.patch?full_index=1"
sha256 "200c4fc3e103c7c9aa36ff35335af1a05494bf00a7181b6d6a11f0ffb2e4dc5d"
end
patch <<~EOF
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 6da74a7ea4..62c6fb0f29 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -866,7 +866,7 @@ void wxMacFilename2FSSpec( const wxString& path , FSSpec *spec )
FSRef fsRef;
wxMacPathToFSRef( path , &fsRef );
err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, spec, NULL);
- verify_noerr( err );
+ wxASSERT( 0 == err );
}
#endif
diff --git a/src/osx/carbon/icon.cpp b/src/osx/carbon/icon.cpp
index d441c432cb..57e3659fc6 100644
--- a/src/osx/carbon/icon.cpp
+++ b/src/osx/carbon/icon.cpp
@@ -328,7 +328,7 @@ bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desire
if ( theId != 0 )
{
IconRef iconRef = NULL ;
- verify_noerr( GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef ) ) ;
+ wxASSERT( 0 == GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef ) ) ;
if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
diff --git a/src/osx/carbon/region.cpp b/src/osx/carbon/region.cpp
index 6d4a38ad40..9245e00750 100644
--- a/src/osx/carbon/region.cpp
+++ b/src/osx/carbon/region.cpp
@@ -1021,7 +1021,7 @@ bool wxRegion::DoOffset(wxCoord x, wxCoord y)
AllocExclusive();
- verify_noerr( HIShapeOffset( M_REGION , x , y ) ) ;
+ wxASSERT( 0 == HIShapeOffset( M_REGION , x , y ) ) ;
return true ;
}
@@ -1076,11 +1076,11 @@ bool wxRegion::DoCombine(const wxRegion& region, wxRegionOp op)
switch (op)
{
case wxRGN_AND:
- verify_noerr( HIShapeIntersect( M_REGION , OTHER_M_REGION(region) , M_REGION ) );
+ wxASSERT( 0 == HIShapeIntersect( M_REGION , OTHER_M_REGION(region) , M_REGION ) );
break ;
case wxRGN_OR:
- verify_noerr( HIShapeUnion( M_REGION , OTHER_M_REGION(region) , M_REGION ) );
+ wxASSERT( 0 == HIShapeUnion( M_REGION , OTHER_M_REGION(region) , M_REGION ) );
break ;
case wxRGN_XOR:
@@ -1088,12 +1088,12 @@ bool wxRegion::DoCombine(const wxRegion& region, wxRegionOp op)
// XOR is defined as the difference between union and intersection
wxCFRef< HIShapeRef > unionshape( HIShapeCreateUnion( M_REGION , OTHER_M_REGION(region) ) );
wxCFRef< HIShapeRef > intersectionshape( HIShapeCreateIntersection( M_REGION , OTHER_M_REGION(region) ) );
- verify_noerr( HIShapeDifference( unionshape, intersectionshape, M_REGION ) );
+ wxASSERT( 0 == HIShapeDifference( unionshape, intersectionshape, M_REGION ) );
}
break ;
case wxRGN_DIFF:
- verify_noerr( HIShapeDifference( M_REGION , OTHER_M_REGION(region) , M_REGION ) ) ;
+ wxASSERT( 0 == HIShapeDifference( M_REGION , OTHER_M_REGION(region) , M_REGION ) ) ;
break ;
case wxRGN_COPY:
diff --git a/src/osx/carbon/thread.cpp b/src/osx/carbon/thread.cpp
index f62bd70f4e..bfff9eea9e 100644
--- a/src/osx/carbon/thread.cpp
+++ b/src/osx/carbon/thread.cpp
@@ -163,7 +163,7 @@ wxMutexInternal::wxMutexInternal( wxMutexType WXUNUSED(mutexType) )
m_isOk = false;
m_critRegion = kInvalidID;
- verify_noerr( MPCreateCriticalRegion( &m_critRegion ) );
+ wxASSERT( 0 == MPCreateCriticalRegion( &m_critRegion ) );
m_isOk = ( m_critRegion != kInvalidID );
if ( !IsOk() )
{
@@ -278,7 +278,7 @@ wxSemaphoreInternal::wxSemaphoreInternal( int initialcount, int maxcount)
// make it practically infinite
maxcount = INT_MAX;
- verify_noerr( MPCreateSemaphore( maxcount, initialcount, &m_semaphore ) );
+ wxASSERT( 0 == MPCreateSemaphore( maxcount, initialcount, &m_semaphore ) );
m_isOk = ( m_semaphore != kInvalidID );
if ( !IsOk() )
@@ -603,7 +603,7 @@ OSStatus wxThreadInternal::MacThreadStart(void *parameter)
wxThreadInternal *pthread = thread->m_internal;
// add to TLS so that This() will work
- verify_noerr( MPSetTaskStorageValue( gs_tlsForWXThread , (TaskStorageValue) thread ) ) ;
+ wxASSERT( 0 == MPSetTaskStorageValue( gs_tlsForWXThread , (TaskStorageValue) thread ) ) ;
// have to declare this before pthread_cleanup_push() which defines a
// block!
@@ -1219,8 +1219,8 @@ bool wxThreadModule::OnInit()
}
// main thread's This() is NULL
- verify_noerr( MPAllocateTaskStorageIndex( &gs_tlsForWXThread ) ) ;
- verify_noerr( MPSetTaskStorageValue( gs_tlsForWXThread, 0 ) ) ;
+ wxASSERT( 0 == MPAllocateTaskStorageIndex( &gs_tlsForWXThread ) ) ;
+ wxASSERT( 0 == MPSetTaskStorageValue( gs_tlsForWXThread, 0 ) ) ;
wxThread::ms_idMainThread = wxThread::GetCurrentId();
gs_critsectWaitingForGui = new wxCriticalSection();
diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm
index 0a3862ac24..27118540de 100644
--- a/src/osx/cocoa/notebook.mm
+++ b/src/osx/cocoa/notebook.mm
@@ -319,7 +319,7 @@ public:
OSStatus err = CreateTabsControl(
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
tabsize, tabstyle, 0, NULL, GetPeer()->GetControlRefAddr() );
- verify_noerr( err );
+ wxASSERT( 0 == err );
#endif
*/
wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp
index bd97d66fc8..c0a3188b24 100644
--- a/src/osx/core/bitmap.cpp
+++ b/src/osx/core/bitmap.cpp
@@ -973,7 +973,7 @@ IconRef wxBitmap::GetIconRef() const
IconRef wxBitmap::CreateIconRef() const
{
IconRef icon = GetIconRef();
- verify_noerr( AcquireIconRef(icon) );
+ wxASSERT( 0 == AcquireIconRef(icon) );
return icon;
}
#endif
EOF
end
option "with-stl", "use standard C++ classes for everything"
option "with-static", "build static libraries"
depends_on "jpeg"
depends_on "libpng"
depends_on "libtiff"
def install
args = [
"--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",
# On 64-bit, enabling mediactrl leads to wxconfig trying to pull
# in a non-existent 64 bit QuickTime framework. This is submitted
# upstream and will eventually be fixed, but for now...
MacOS.prefer_64_bit? ? "--disable-mediactrl" : "--enable-mediactrl",
"--enable-graphics_ctx",
"--enable-controls",
"--enable-dataviewctrl",
"--with-expat",
"--disable-precomp-headers",
# need to set with-macosx-version-min to avoid configure defaulting to 10.5
"--with-macosx-version-min=#{MacOS.version}",
# This is the default option, but be explicit
"--disable-monolithic",
]
args << "--enable-stl" if build.with? "stl"
if build.with? "static"
args << "--disable-shared"
else
args << "--enable-shared"
end
system "./configure", *args
system "make", "install"
# wx-config should reference the public prefix, not wxmac's keg
# this ensures that Python software trying to locate wxpython headers
# using wx-config can find both wxmac and wxpython headers,
# which are linked to the same place
inreplace "#{bin}/wx-config", prefix, HOMEBREW_PREFIX
end
test do
system bin/"wx-config", "--libs"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment