8012629: java.lang.UnsatisfiedLinkError exception throw by getAllFonts() on MacOSX
authorjchen
Thu, 23 May 2013 12:16:17 -0700
changeset 17673 33e311ad099a
parent 17672 d1c8ac4c7a7b
child 17674 46246fbf98d4
8012629: java.lang.UnsatisfiedLinkError exception throw by getAllFonts() on MacOSX Reviewed-by: bae, prr
jdk/make/sun/awt/FILES_c_unix.gmk
jdk/make/sun/awt/FILES_export_unix.gmk
jdk/make/sun/awt/mawt.gmk
jdk/makefiles/CompileNativeLibraries.gmk
jdk/src/macosx/native/sun/font/AWTFont.m
--- a/jdk/make/sun/awt/FILES_c_unix.gmk	Wed May 22 19:35:51 2013 -0700
+++ b/jdk/make/sun/awt/FILES_c_unix.gmk	Thu May 23 12:16:17 2013 -0700
@@ -171,3 +171,13 @@
         GLXSurfaceData.c \
         AccelGlyphCache.c \
 	CUPSfuncs.c
+
+ifeq ($(PLATFORM), macosx)
+FILES_NO_MOTIF_objc = \
+		AWTFont.m \
+		AWTStrike.m \
+		CCharToGlyphMapper.m \
+		CGGlyphImages.m \
+		CGGlyphOutlines.m \
+		CoreTextSupport.m
+endif # PLATFORM
--- a/jdk/make/sun/awt/FILES_export_unix.gmk	Wed May 22 19:35:51 2013 -0700
+++ b/jdk/make/sun/awt/FILES_export_unix.gmk	Thu May 23 12:16:17 2013 -0700
@@ -187,3 +187,14 @@
 	java/awt/dnd/DnDConstants.java \
 	sun/awt/CausedFocusEvent.java
 
+ifeq ($(PLATFORM), macosx)
+ifeq ($(HEADLESS), true)
+FILES_export += \
+	sun/awt/SunHints.java \
+	sun/font/CCharToGlyphMapper.java \
+	sun/font/CFont.java \
+	sun/font/CFontManager.java \
+	sun/font/CStrike.java \
+	sun/font/CStrikeDisposer.java
+endif # HEADLESS
+endif # PLATFORM
--- a/jdk/make/sun/awt/mawt.gmk	Wed May 22 19:35:51 2013 -0700
+++ b/jdk/make/sun/awt/mawt.gmk	Thu May 23 12:16:17 2013 -0700
@@ -43,6 +43,10 @@
 # compiled based on the motif version.
 FILES_c = $(FILES_NO_MOTIF_c)
 
+ifeq ($(PLATFORM), macosx)
+FILES_objc = $(FILES_NO_MOTIF_objc)
+endif # PLATFORM
+
 ifeq ($(PLATFORM), solaris)
   ifneq ($(ARCH), amd64)
     FILES_reorder += reorder-$(ARCH)
@@ -97,6 +101,10 @@
 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)/image
 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)/robot_child
 
+ifeq ($(PLATFORM), macosx)
+vpath %.m   $(call NativeSrcDirList,,native/sun/font)
+endif # PLATFORM
+
 #
 # Libraries to link in.
 #
@@ -192,13 +200,21 @@
         $(EVENT_MODEL)
 
 ifeq ($(PLATFORM), macosx)
-CPPFLAGS += -I$(CUPS_HEADERS_PATH)
+CPPFLAGS += -I$(CUPS_HEADERS_PATH) \
+			$(call NativeSrcDirList,-I,native/sun/awt) \
+			$(call NativeSrcDirList,-I,native/sun/font)
 
 ifndef HEADLESS
 CPPFLAGS += -I$(MOTIF_DIR)/include \
             -I$(OPENWIN_HOME)/include 
 LDFLAGS  += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
-
+else
+LDFLAGS  += -framework Accelerate \
+			-framework ApplicationServices \
+			-framework Cocoa \
+			-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+			-framework JavaNativeFoundation \
+			-framework JavaRuntimeSupport
 endif # !HEADLESS
 endif # PLATFORM
 
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Wed May 22 19:35:51 2013 -0700
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Thu May 23 12:16:17 2013 -0700
@@ -2314,6 +2314,10 @@
 			$(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
 			$(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
 
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+	LIBAWT_HEADLESS_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/font
+endif
+
 LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
                           -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 			  $(CUPS_CFLAGS) \
@@ -2328,6 +2332,12 @@
 			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
                           $(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
 
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+	LIBAWT_HEADLESS_CFLAGS+=\
+		-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+		-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
+endif
+
 LIBAWT_HEADLESS_FILES:=\
 	awt_Font.c \
 	HeadlessToolkit.c \
@@ -2356,6 +2366,16 @@
         AccelGlyphCache.c \
 	CUPSfuncs.c
 
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+	LIBAWT_HEADLESS_FILES+=\
+		AWTFont.m \
+		AWTStrike.m \
+		CCharToGlyphMapper.m \
+		CGGlyphImages.m \
+		CGGlyphOutlines.m \
+		CoreTextSupport.m
+endif
+
 LIBAWT_HEADLESS_REORDER:=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
@@ -2382,7 +2402,13 @@
 		REORDER:=$(LIBAWT_HEADLESS_REORDER), \
 		LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
 		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
-		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
+		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
+				 -framework Accelerate \
+				 -framework ApplicationServices \
+				 -framework Cocoa \
+				 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+				 -framework JavaNativeFoundation \
+				 -framework JavaRuntimeSupport,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
 		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
--- a/jdk/src/macosx/native/sun/font/AWTFont.m	Wed May 22 19:35:51 2013 -0700
+++ b/jdk/src/macosx/native/sun/font/AWTFont.m	Thu May 23 12:16:17 2013 -0700
@@ -395,6 +395,7 @@
 
 #pragma mark --- Miscellaneous JNI ---
 
+#ifndef HEADLESS
 /*
  * Class:     sun_awt_PlatformFont
  * Method:    initIDs
@@ -416,3 +417,4 @@
     (JNIEnv *env, jclass cls)
 {
 }
+#endif