diff --git a/README.md b/README.md index 182ed18..23ae77a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ Woah, lots of attention! Thanks! +## Updates + +- **11 June 2014**
**I have decided to remove Mac OS X 10.6 support** because it's only causing problems for building (and everyone else says I should anyway, including Mac developers!). This does break my original goal, but I'm going to have to break things sooner or later. Please let me know if any of you actually use this package on 10.6. (I personally don't like it when programs require 10.7 (or iOS 7, for that matter), but what are you gonna do?) + +## README + This is a placeholder README; the previous file (olddocs/oldREADME.md) was rather long and confusing. I'll be rewriting it properly soon. Until then, here's the important things you need to know: @@ -9,10 +15,10 @@ Until then, here's the important things you need to know: - Unix builds need 1.3 to fix some type-checker bugs in cgo - Mac OS X builds need 1.3 because Go 1.3 adds Objective-C support to cgo - the Windows build does not need cgo unless you want to regenerate the `zconstants_windows_*.go` files; the other targets **do** -- my plan is to target all versions of OSs that Go itself supports; that means: +- my plan is to target all versions of OSs that Go itself supports. I will, however, make concessions where appropriate. This means: - Windows: Windows XP or newer - Unix: this is trickier; I decided to settle on GTK+ 3.4 or newer as Ubuntu 12.04 LTS ships with it - - Mac OS X: Mac OS X 10.6 or newer + - Mac OS X: Mac OS X 10.7 or newer (Go supports 10.6 but this is a pain to compile Cocoa programs for due to flaws in the later header files) - for the Windows build, you won't need to provide a comctl32.dll version 6 manifest, as the package produces its own - comctl32.dll version 6 *is* required for proper functioning! diff --git a/combobox_darwin.m b/combobox_darwin.m index b84b948..8d337b9 100644 --- a/combobox_darwin.m +++ b/combobox_darwin.m @@ -1,23 +1,6 @@ // 17 may 2014 #include "objc_darwin.h" - -// see delegateuitask_darwin.m -// in this case, NSPopUpButton.h and NSComboBox.h includes NSApplication.h -#import - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import #import #import diff --git a/delegateuitask_darwin.m b/delegateuitask_darwin.m index 6cf886d..ed912eb 100644 --- a/delegateuitask_darwin.m +++ b/delegateuitask_darwin.m @@ -5,32 +5,7 @@ #import #import #import - -// see the hack below; we'll include everything first just in case some other headers get included below; if the hack ever gets resolved, we can use the ones below instead -#import -#import -#import - -// HACK. -// Apple's header files are bugged: there's an enum that was introduced in 10.7 with new values added in 10.8, but instead of wrapping the whole enum in a version check, they wrap just the fields. This means that on 10.6 that enum will be empty, which is illegal. -// As only one other person on the entire internet has had this problem (TODO get link) and no one ever replied to his report, we're on our own here. This is dumb and will break compile-time availability and deprecation checks, but we don't have many other options. -// I could use SDKs here, but on 10.6 itself Xcode 4.3, which changed the location of SDKs, is only available to people with a paid Apple developer account, and Beelsebob on irc.freenode.net/#macdev told me that any other configuration is likely to have a differnet directory entirely, so... -// Of course, if Go were ever to drop 10.6 support, this problem would go away (hopefully). -// Oh, and Xcode 4.2 for Snow Leopard comes with headers that don't include MAC_OS_X_VERSION_10_7 and thus won't have this problem, so we need to watch for that too... -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif #import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - -// NSWindow.h is below because it includes NSApplication.h -// we'll use the other headers's include guards so if the above is resolved and I forget to uncomment anything below it won't matter #import #import #import diff --git a/dialog_darwin.m b/dialog_darwin.m index d37956f..d38e7af 100644 --- a/dialog_darwin.m +++ b/dialog_darwin.m @@ -3,23 +3,8 @@ #include "objc_darwin.h" #include "_cgo_export.h" #import - -// see delegateuitask_darwin.m -// in this case, NSWindow.h includes NSApplication.h - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import +#import #define to(T, x) ((T *) (x)) #define toNSWindow(x) to(NSWindow, (x)) diff --git a/listbox_darwin.m b/listbox_darwin.m index 18a9649..f6f2838 100644 --- a/listbox_darwin.m +++ b/listbox_darwin.m @@ -4,23 +4,6 @@ #import #import #import - -// see delegateuitask_darwin.m -// in this case, NSTableView.h includes NSApplication.h -#import - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import #import diff --git a/objc_darwin.h b/objc_darwin.h index c62e2ab..03dafdf 100644 --- a/objc_darwin.h +++ b/objc_darwin.h @@ -5,8 +5,8 @@ #ifndef __GO_UI_OBJC_DARWIN_H__ #define __GO_UI_OBJC_DARWIN_H__ -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 +#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 /* the Objective-C runtime headers, for id */ #include diff --git a/objc_darwin.m b/objc_darwin.m index a5181e8..c2d3d6f 100644 --- a/objc_darwin.m +++ b/objc_darwin.m @@ -2,23 +2,6 @@ #include "objc_darwin.h" #import - -// see delegateuitask_darwin.m -// in this case, NSScrollView.h includes NSApplication.h -#import - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import #import diff --git a/prefsize_darwin.m b/prefsize_darwin.m index 2f3dd7a..1d97d01 100644 --- a/prefsize_darwin.m +++ b/prefsize_darwin.m @@ -2,22 +2,6 @@ #include "objc_darwin.h" #import - -// see delegateuitask_darwin.m -// in this case, NSScrollView.h, NSTableView.h, AND NSProgressIndicator.h all include NSApplication.h - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import #import #import diff --git a/sysdata_darwin.m b/sysdata_darwin.m index 6a6a999..bdcf725 100644 --- a/sysdata_darwin.m +++ b/sysdata_darwin.m @@ -2,24 +2,6 @@ #include "objc_darwin.h" #import - -// see delegateuitask_darwin.m -// in this case, lots of headers include NSApplication.h -#import -#import - -#ifdef MAC_OS_X_VERSION_10_7 -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_7 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_7 -#endif -#import -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#undef MAC_OS_X_VERSION_MAX_ALLOWED -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_6 - #import #import #import diff --git a/uitask_darwin.go b/uitask_darwin.go index 70cbee6..754418c 100644 --- a/uitask_darwin.go +++ b/uitask_darwin.go @@ -8,8 +8,8 @@ import ( "unsafe" ) -// #cgo CFLAGS: -mmacosx-version-min=10.6 -DMACOSX_DEPLOYMENT_TARGET=10.6 -// #cgo LDFLAGS: -mmacosx-version-min=10.6 -lobjc -framework Foundation -framework AppKit +// #cgo CFLAGS: -mmacosx-version-min=10.7 -DMACOSX_DEPLOYMENT_TARGET=10.7 +// #cgo LDFLAGS: -mmacosx-version-min=10.7 -lobjc -framework Foundation -framework AppKit // /* application compatibilty stuff via https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html, http://www.cocoawithlove.com/2009/09/building-for-earlier-os-versions-in.html, http://opensource.apple.com/source/xnu/xnu-2422.1.72/EXTERNAL_HEADERS/AvailabilityMacros.h (via http://stackoverflow.com/questions/20485797/what-macro-to-use-to-identify-mavericks-osx-10-9-in-c-c-code), and Beelsebob and LookyLuke_ICBM on irc.freenode.net/#macdev */ // #include "objc_darwin.h" import "C"