diff --git a/make/common/Defs-macosx.gmk b/make/common/Defs-macosx.gmk index 1b7aaa8ae201f6896b2da8f1d12e5ea887ee740b..befd2cfed5b577d666829db518a3b036d6500e74 100644 --- a/make/common/Defs-macosx.gmk +++ b/make/common/Defs-macosx.gmk @@ -397,12 +397,10 @@ else INCLUDE_SA = true endif -ifdef CROSS_COMPILE_ARCH - # X11 headers are not under /usr/include - OTHER_CFLAGS += -I$(OPENWIN_HOME)/include - OTHER_CXXFLAGS += -I$(OPENWIN_HOME)/include - OTHER_CPPFLAGS += -I$(OPENWIN_HOME)/include -endif +# X11 headers are not under /usr/include +OTHER_CFLAGS += -I$(OPENWIN_HOME)/include +OTHER_CXXFLAGS += -I$(OPENWIN_HOME)/include +OTHER_CPPFLAGS += -I$(OPENWIN_HOME)/include LIB_LOCATION ?= $(LIBDIR) diff --git a/make/java/java/Makefile b/make/java/java/Makefile index 829cf93300133867d3b5065fe36609a9b8b4dd8d..d2a663f9ae0f5a9fb65799ac09e271cb7a30566d 100644 --- a/make/java/java/Makefile +++ b/make/java/java/Makefile @@ -105,6 +105,7 @@ FILES_java += java/util/prefs/MacOSXPreferences.java \ java/util/prefs/MacOSXPreferencesFactory.java CFLAGS_$(VARIANT)/java_props_md.o = -Os -x objective-c +CFLAGS_$(VARIANT)/java_props_macosx.o = -Os -x objective-c endif # diff --git a/makefiles/CompileNativeLibraries.gmk b/makefiles/CompileNativeLibraries.gmk index 656ee3c4841a09d1da3deee9aa64871f74ab2423..d507c92a594f40575823b7b2ac151543ea0bfbf4 100644 --- a/makefiles/CompileNativeLibraries.gmk +++ b/makefiles/CompileNativeLibraries.gmk @@ -211,6 +211,7 @@ ifneq ($(OPENJDK_TARGET_OS),macosx) LIBJAVA_EXCLUDE_FILES += java_props_macosx.c else BUILD_LIBJAVA_java_props_md.c_CFLAGS:=-x objective-c + BUILD_LIBJAVA_java_props_macosx.c_CFLAGS:=-x objective-c endif ifeq ($(OPENJDK_TARGET_OS),windows) @@ -252,6 +253,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\ LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\ LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \ -framework CoreFoundation \ + -framework Foundation \ -framework Security -framework SystemConfiguration, \ LDFLAGS_SUFFIX_windows:=-export:winFileHandleOpen -export:handleLseek \ jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \ diff --git a/src/solaris/native/java/lang/java_props_macosx.c b/src/solaris/native/java/lang/java_props_macosx.c index f9ad2e474b16c3221090bf6b3fddd0c957a99b05..13fc80d3052a8706a61d3ab3b0531b57816e561f 100644 --- a/src/solaris/native/java/lang/java_props_macosx.c +++ b/src/solaris/native/java/lang/java_props_macosx.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "java_props_macosx.h" @@ -271,9 +272,20 @@ static char * createConvertedException(CFStringRef cf_original) { return c_exception; } +/* + * Method for fetching the user.home path and storing it in the property list. + * For signed .apps running in the Mac App Sandbox, user.home is set to the + * app's sandbox container. + */ +void setUserHome(java_props_t *sprops) { + if (sprops == NULL) { return; } + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + sprops->user_home = createUTF8CString((CFStringRef)NSHomeDirectory()); + [pool drain]; +} /* - * Method for fetching proxy info and storing it in the propery list. + * Method for fetching proxy info and storing it in the property list. */ void setProxyProperties(java_props_t *sProps) { if (sProps == NULL) return; diff --git a/src/solaris/native/java/lang/java_props_macosx.h b/src/solaris/native/java/lang/java_props_macosx.h index b311804835d7be126bc38f70d2703b72c13ee495..19ec220ed4b8ef880fac79036ebad43f552c9027 100644 --- a/src/solaris/native/java/lang/java_props_macosx.h +++ b/src/solaris/native/java/lang/java_props_macosx.h @@ -27,6 +27,7 @@ char *setupMacOSXLocale(int cat); void setOSNameAndVersion(java_props_t *sprops); +void setUserHome(java_props_t *sprops); void setProxyProperties(java_props_t *sProps); enum PreferredToolkit_enum { diff --git a/src/solaris/native/java/lang/java_props_md.c b/src/solaris/native/java/lang/java_props_md.c index 58e5e4543d7c2abe22bd347bd94ad5ef68374eff..dba053e8f4aaeea092f696e0a7a73cd4201d2abd 100644 --- a/src/solaris/native/java/lang/java_props_md.c +++ b/src/solaris/native/java/lang/java_props_md.c @@ -591,7 +591,14 @@ GetJavaProperties(JNIEnv *env) { struct passwd *pwent = getpwuid(getuid()); sprops.user_name = pwent ? strdup(pwent->pw_name) : "?"; - sprops.user_home = pwent ? strdup(pwent->pw_dir) : "?"; +#ifdef MACOSX + setUserHome(&sprops); +#else + sprops.user_home = pwent ? strdup(pwent->pw_dir) : NULL; +#endif + if (sprops.user_home == NULL) { + sprops.user_home = "?"; + } } /* User TIMEZONE */