Skip to content

Commit

Permalink
Removed Mac OS X 10.6 support. Quite a hassle that version was...
Browse files Browse the repository at this point in the history
  • Loading branch information
andlabs committed Jun 11, 2014
1 parent 2703345 commit d289fce
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 132 deletions.
10 changes: 8 additions & 2 deletions README.md
@@ -1,5 +1,11 @@
Woah, lots of attention! Thanks!

## Updates

- **11 June 2014**<br>**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:
Expand All @@ -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!

Expand Down
17 changes: 0 additions & 17 deletions 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 <AppKit/NSArrayController.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 <AppKit/NSApplication.h>
#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 <AppKit/NSPopUpButton.h>
#import <AppKit/NSComboBox.h>
#import <AppKit/NSArrayController.h>
Expand Down
25 changes: 0 additions & 25 deletions delegateuitask_darwin.m
Expand Up @@ -5,32 +5,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSNotification.h>

// 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 <Foundation/NSAutoreleasePool.h>
#import <AppKit/NSEvent.h>
#import <AppKit/NSAlert.h>

// 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 <AppKit/NSApplication.h>
#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 <AppKit/NSWindow.h>
#import <Foundation/NSAutoreleasePool.h>
#import <AppKit/NSEvent.h>
Expand Down
17 changes: 1 addition & 16 deletions dialog_darwin.m
Expand Up @@ -3,23 +3,8 @@
#include "objc_darwin.h"
#include "_cgo_export.h"
#import <AppKit/NSAlert.h>

// 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 <AppKit/NSApplication.h>
#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 <AppKit/NSWindow.h>
#import <AppKit/NSApplication.h>

#define to(T, x) ((T *) (x))
#define toNSWindow(x) to(NSWindow, (x))
Expand Down
17 changes: 0 additions & 17 deletions listbox_darwin.m
Expand Up @@ -4,23 +4,6 @@
#import <Foundation/NSDictionary.h>
#import <AppKit/NSArrayController.h>
#import <AppKit/NSTableColumn.h>

// see delegateuitask_darwin.m
// in this case, NSTableView.h includes NSApplication.h
#import <Foundation/NSIndexSet.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 <AppKit/NSApplication.h>
#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 <AppKit/NSTableView.h>
#import <Foundation/NSIndexSet.h>

Expand Down
4 changes: 2 additions & 2 deletions objc_darwin.h
Expand Up @@ -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 <objc/message.h>
Expand Down
17 changes: 0 additions & 17 deletions objc_darwin.m
Expand Up @@ -2,23 +2,6 @@

#include "objc_darwin.h"
#import <Foundation/NSString.h>

// see delegateuitask_darwin.m
// in this case, NSScrollView.h includes NSApplication.h
#import <AppKit/NSView.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 <AppKit/NSApplication.h>
#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 <AppKit/NSView.h>
#import <AppKit/NSScrollView.h>

Expand Down
16 changes: 0 additions & 16 deletions prefsize_darwin.m
Expand Up @@ -2,22 +2,6 @@

#include "objc_darwin.h"
#import <AppKit/NSControl.h>

// 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 <AppKit/NSApplication.h>
#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 <AppKit/NSScrollView.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSProgressIndicator.h>
Expand Down
18 changes: 0 additions & 18 deletions sysdata_darwin.m
Expand Up @@ -2,24 +2,6 @@

#include "objc_darwin.h"
#import <Foundation/NSGeometry.h>

// see delegateuitask_darwin.m
// in this case, lots of headers include NSApplication.h
#import <AppKit/NSView.h>
#import <AppKit/NSControl.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 <AppKit/NSApplication.h>
#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 <AppKit/NSWindow.h>
#import <AppKit/NSView.h>
#import <AppKit/NSFont.h>
Expand Down
4 changes: 2 additions & 2 deletions uitask_darwin.go
Expand Up @@ -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"
Expand Down

7 comments on commit d289fce

@rdp
Copy link

@rdp rdp commented on d289fce Jun 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes, my only mac is stuck on snow leopard...would love to see it still supported...

@andlabs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for what it's worth I tried to see if there was a compiler option that could disable enum{}; being illegal; the only thing I can do is switch to Objective-C++, which cases cgo to complain that it couldn't figure out struct field offsets; sorry...

@rdp
Copy link

@rdp rdp commented on d289fce Jun 12, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andlabs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/baselineOffsetFromBottom

I am going to commit a change later that uses this, which will be important for making nicer-looking GUIs (see #19). Since there does not seem to be any equivalent in earlier versions of OS X, this pretty much kills 10.6 support dead. Sorry.

@andlabs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second thought disregard that; using a different appraoch because that one simply isn't going to happen in a quadrant 4 coordinate system

@andlabs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retracting the previous retraction: I am now using the 10.7-only stuff. Sorry. :(

@rdp
Copy link

@rdp rdp commented on d289fce Jun 29, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.