Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Barbero2015-03-27 13:08:03 +0000
committerMikael Barbero2015-03-30 06:26:08 +0000
commit463b445e5189bdb31ebc3e9fa1c8a347e23259d7 (patch)
tree2cb0bfc279ad873dea615e55d276a4cc90509d2e /bundles/org.eclipse.swt
parentedbb82693f3c8b5bbb22f50b299c3ef48ae9378f (diff)
downloadeclipse.platform.swt-463b445e5189bdb31ebc3e9fa1c8a347e23259d7.tar.gz
eclipse.platform.swt-463b445e5189bdb31ebc3e9fa1c8a347e23259d7.tar.xz
eclipse.platform.swt-463b445e5189bdb31ebc3e9fa1c8a347e23259d7.zip
Bug 462955 - Make SWT compile on OS X Yosemite.
- Create a JAWT_MacOSXDrawingSurfaceInfo struct as it does not exist anymore with JAWT 1.7 - Use Oracle's JDK location for headers instead of Apple's one when not available - Make #include path of mach-o/dyld.h relative rather than absolute to /usr/include as it does not exist anymore on Yosemite. Change-Id: I426552d641a715dd732c76b5939c2e887074fc3c Signed-off-by: Mikael Barbero <mikael@eclipse.org>
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/build.sh6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h2
4 files changed, 27 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c
index cca746c2ab..29a9899008 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c
@@ -13,8 +13,24 @@
#include "swt.h"
#include "jawt_md.h"
+#ifdef __OBJC__
+#import <AppKit/NSView.h>
+#endif
+
#define SWT_AWT_NATIVE(func) Java_org_eclipse_swt_awt_SWT_1AWT_##func
+/*
+ * JAWT version 1.7 does not define the type JAWT_MacOSXDrawingSurfaceInfo.
+ */
+#ifdef JAWT_VERSION_1_7
+// Legacy NSView-based rendering
+typedef struct JAWT_MacOSXDrawingSurfaceInfo {
+ NSView *cocoaViewRef; // the view is guaranteed to be valid only for the duration of Component.paint method
+}
+JAWT_MacOSXDrawingSurfaceInfo;
+#endif /* #ifdef JAWT_VERSION_1_7 */
+
+
#ifndef NO_getAWTHandle
JNIEXPORT jintLong JNICALL SWT_AWT_NATIVE(getAWTHandle)
(JNIEnv *env, jclass that, jobject canvas)
@@ -26,7 +42,7 @@ JNIEXPORT jintLong JNICALL SWT_AWT_NATIVE(getAWTHandle)
JAWT_MacOSXDrawingSurfaceInfo* dsi_cocoa;
jint lock;
- awt.version = JAWT_VERSION_1_4;
+ awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
if (JAWT_GetAWT(env, &awt) != 0) {
ds = awt.GetDrawingSurface(env, canvas);
if (ds != NULL) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/build.sh
index 912f67b064..ce8c99e75c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/build.sh
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/build.sh
@@ -12,6 +12,12 @@
cd `dirname $0`
+if [ -d /System/Library/Frameworks/JavaVM.framework/Headers ]; then
+ export CFLAGS_JAVA_VM="-I /System/Library/Frameworks/JavaVM.framework/Headers"
+else
+ export CFLAGS_JAVA_VM="-I $(/usr/libexec/java_home)/include -I $(/usr/libexec/java_home)/include/darwin"
+fi
+
if [ "x${MODEL}" = "xx86_64" ]; then
export ARCHS="-arch x86_64"
export XULRUNNER24_ARCHS="-arch x86_64"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak
index 86f1f231e2..20519fec68 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak
@@ -26,7 +26,6 @@ XULRUNNER24_LIB=lib$(SWTXULRUNNER24_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
AWT_PREFIX = swt-awt
AWT_LIB = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
-AWT_LIBS = /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries/libjawt.dylib"
AWT_OBJECTS = swt_awt.o
# Uncomment for Native Stats tool
@@ -34,7 +33,7 @@ AWT_OBJECTS = swt_awt.o
#SWT_DEBUG = -g
CFLAGS = -c -xobjective-c -Wall $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DUSE_ASSEMBLER -DCOCOA -DATOMIC \
- -I /System/Library/Frameworks/JavaVM.framework/Headers \
+ $(CFLAGS_JAVA_VM) \
-I /System/Library/Frameworks/Cocoa.framework/Headers \
-I /System/Library/Frameworks/JavaScriptCore.framework/Headers
LFLAGS = -bundle $(ARCHS) -framework JavaVM -framework Cocoa -framework WebKit -framework CoreServices -framework JavaScriptCore -framework Security -framework SecurityInterface
@@ -43,9 +42,9 @@ SWTPI_OBJECTS = swt.o os.o os_structs.o os_stats.o os_custom.o
XULRUNNER_OBJECTS = swt.o xpcom.o xpcom_custom.o xpcom_structs.o xpcom_stats.o xpcominit.o xpcominit_structs.o xpcominit_stats.o
XULRUNNER24_OBJECTS = xpcom24_custom.o
-XULRUNNERCFLAGS = -c -Wall $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DUSE_ASSEMBLER -DCOCOA -I /System/Library/Frameworks/JavaVM.framework/Headers \
+XULRUNNERCFLAGS = -c -Wall $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DUSE_ASSEMBLER -DCOCOA $(CFLAGS_JAVA_VM) \
-Wno-non-virtual-dtor -include ${XULRUNNER_SDK}/include/mozilla-config.h -I${XULRUNNER_SDK}/include
-XULRUNNER24CFLAGS = -c -Wall $(XULRUNNER24_ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DUSE_ASSEMBLER -DCOCOA -I /System/Library/Frameworks/JavaVM.framework/Headers -Wno-non-virtual-dtor
+XULRUNNER24CFLAGS = -c -Wall $(XULRUNNER24_ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DUSE_ASSEMBLER -DCOCOA $(CFLAGS_JAVA_VM) -Wno-non-virtual-dtor
XULRUNNERLFLAGS = $(LFLAGS)
XULRUNNER24LFLAGS = -bundle $(XULRUNNER24_ARCHS) -framework JavaVM
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
index f97b317ca8..0f3d29b96b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
@@ -20,7 +20,7 @@
#include <Carbon/Carbon.h>
#include <WebKit/WebKit.h>
#include <JavaScriptCore/JavaScriptCore.h>
-#include "/usr/include/mach-o/dyld.h"
+#include "mach-o/dyld.h"
#include "os_custom.h"

Back to the top