diff options
author | Douglas Mencken <dougmencken@gmail.com> | 2015-12-11 13:18:00 -0500 |
---|---|---|
committer | Douglas Mencken <dougmencken@gmail.com> | 2017-01-12 06:35:54 -0500 |
commit | 5be2ab1002923ad162d42df18276b61a1a9c7d8d (patch) | |
tree | 3af712775d53ae6e28a1c3e18c785366e9e15f5d | |
parent | vcl/quartz/salgdicommon.cxx: minor edits (diff) | |
download | core-5be2ab1002923ad162d42df18276b61a1a9c7d8d.tar.gz core-5be2ab1002923ad162d42df18276b61a1a9c7d8d.zip |
make the jvmfwk library to be fully compatible with OS X below 10.8
Change-Id: I1f6ba607154d7250bbc8cc0bb85ff234909ad795
-rw-r--r-- | jvmfwk/Library_jvmfwk.mk | 4 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 14 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm | 60 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx | 3 |
4 files changed, 62 insertions, 19 deletions
diff --git a/jvmfwk/Library_jvmfwk.mk b/jvmfwk/Library_jvmfwk.mk index f3373b781b20..3a078fc31712 100644 --- a/jvmfwk/Library_jvmfwk.mk +++ b/jvmfwk/Library_jvmfwk.mk @@ -55,10 +55,6 @@ $(eval $(call gb_Library_use_externals,jvmfwk,\ )) ifeq ($(OS),MACOSX) -$(eval $(call gb_Library_add_cxxflags,jvmfwk,\ - $(gb_OBJCXXFLAGS) \ -)) - $(eval $(call gb_Library_add_objcxxobjects,jvmfwk,\ jvmfwk/plugins/sunmajor/pluginlib/util_cocoa \ )) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 65fe6424aa52..f7d417fbfd18 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -1190,10 +1190,16 @@ void addJavaInfosDirScan( std::vector<rtl::Reference<VendorBase>> & addedInfos) { #ifdef MACOSX +#if MACOSX_SDK_VERSION >= 1080 // Ignore all but Oracle's JDK as loading Apple's Java and Oracle's JRE // will cause OS X's JavaVM framework to display a dialog and invoke // exit() when loaded via JNI on OS X 10.10 Directory aDir("file:///Library/Java/JavaVirtualMachines"); +#else + // For Java versions 6 and below, Apple supplies their own version of Java, + // so it's under /System and not /Library + Directory aDir("file:///System/Library/Frameworks/JavaVM.framework/Versions"); +#endif if (aDir.open() == File::E_None) { DirectoryItem aItem; @@ -1205,9 +1211,15 @@ void addJavaInfosDirScan( OUString aItemURL( aStatus.getFileURL() ); if (aItemURL.getLength()) { + #if MACOSX_SDK_VERSION >= 1080 aItemURL += "/Contents/Home"; + #else + aItemURL += "/Home"; + #endif if (DirectoryItem::get(aItemURL, aItem) == File::E_None) - getAndAddJREInfoByPath(aItemURL, allInfos, addedInfos); + { + /* bool success = */ getAndAddJREInfoByPath(aItemURL, allInfos, addedInfos); + } } } } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm index 5755d4c44c50..02976d1df1d1 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm +++ b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm @@ -22,24 +22,54 @@ bool JvmfwkUtil_isLoadableJVM( OUString const & aURL ) if ( pString ) { NSURL *pURL = nil; - - // Ignore all but Oracle's JDK as loading Apple's Java and Oracle's - // JRE will cause OS X's JavaVM framework to display a dialog and - // invoke exit() when loaded via JNI on OS X 10.10 NSURL *pTmpURL = [NSURL URLWithString:pString]; if ( pTmpURL ) + { + #if MACOSX_SDK_VERSION >= 1060 pTmpURL = [pTmpURL filePathURL]; + #else + pTmpURL = [ NSURL URLWithString:(NSString*)( CFURLCopyFileSystemPath( (CFURLRef)pTmpURL, kCFURLPOSIXPathStyle ) ) ]; + #endif + } if ( pTmpURL ) + { + #if MACOSX_SDK_VERSION < 1060 + pTmpURL = [ NSURL URLWithString:[[pTmpURL path] stringByStandardizingPath] ]; + #else pTmpURL = [pTmpURL URLByStandardizingPath]; + #endif + } if ( pTmpURL ) + { + #if MACOSX_SDK_VERSION < 1060 + pTmpURL = [ NSURL URLWithString:[[pTmpURL path] stringByResolvingSymlinksInPath] ]; + #else pTmpURL = [pTmpURL URLByResolvingSymlinksInPath]; + #endif + } if ( pTmpURL ) { + #if MACOSX_SDK_VERSION >= 1080 NSURL *pJVMsDirURL = [NSURL URLWithString:@"file:///Library/Java/JavaVirtualMachines/"]; + #else + NSURL *pJVMsDirURL = [NSURL URLWithString:@"file:///System/Library/Frameworks/JavaVM.framework/Versions/"]; + #endif if ( pJVMsDirURL ) - pJVMsDirURL= [pJVMsDirURL filePathURL]; + { + #if MACOSX_SDK_VERSION >= 1060 + pJVMsDirURL = [pJVMsDirURL filePathURL]; + #else + pJVMsDirURL = [ NSURL URLWithString:(NSString*)( CFURLCopyFileSystemPath( (CFURLRef)pJVMsDirURL, kCFURLPOSIXPathStyle ) ) ]; + #endif + } if ( pJVMsDirURL ) + { + #if MACOSX_SDK_VERSION < 1060 + pJVMsDirURL = [ NSURL URLWithString:[[pJVMsDirURL path] stringByStandardizingPath] ]; + #else pJVMsDirURL = [pJVMsDirURL URLByStandardizingPath]; + #endif + } // The JVM directory must not contain softlinks or the JavaVM // framework bug will occur so don't resolve softlinks in the // JVM directory @@ -56,14 +86,16 @@ bool JvmfwkUtil_isLoadableJVM( OUString const & aURL ) } } +#if MACOSX_SDK_VERSION >= 1080 while ( pURL ) { // Check if this is a valid bundle - NSNumber *pDir = nil; - NSURL *pContentsURL = [pURL URLByAppendingPathComponent:@"Contents"]; - if ( pContentsURL && [pContentsURL getResourceValue:&pDir forKey:NSURLIsDirectoryKey error:nil] && pDir && [pDir boolValue] ) + NSURL *pContentsURL = nil; + pContentsURL = [pURL URLByAppendingPathComponent:@"Contents"]; //[NSURL URLWithString:[[pURL path] stringByAppendingPathComponent:@"Contents"]]; + BOOL isDir = NO; + if ( pContentsURL && [[NSFileManager defaultManager] fileExistsAtPath:[pContentsURL path] isDirectory:&isDir] && isDir ) { - NSBundle *pBundle = [NSBundle bundleWithURL:pURL]; + NSBundle *pBundle = [NSBundle bundleWithURL:pURL]; //[NSBundle bundleWithPath:[pURL path]]; if ( pBundle ) { // Make sure that this bundle's Info.plist has the @@ -110,18 +142,22 @@ bool JvmfwkUtil_isLoadableJVM( OUString const & aURL ) } NSURL *pOldURL = pURL; - pURL = [pURL URLByDeletingLastPathComponent]; + pURL = [pURL URLByDeletingLastPathComponent]; //[NSURL URLWithString:[[pURL path] stringByDeletingLastPathComponent]]; if ( pURL ) { - pURL = [pURL URLByStandardizingPath]; + pURL = [pURL URLByStandardizingPath]; //[NSURL URLWithString:[[pURL path] stringByStandardizingPath]]; if ( pURL ) { - pURL = [pURL URLByResolvingSymlinksInPath]; + pURL = [pURL URLByResolvingSymlinksInPath]; //[NSURL URLWithString:[[pURL path] stringByResolvingSymlinksInPath]]; if ( pURL && [pURL isEqual:pOldURL] ) pURL = nil; } } } +#else // i.e. MACOSX_SDK_VERSION < 1080 + if ( pURL ) + bRet = true; +#endif } [pPool release]; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx index a08b237b62cd..186fec98ab5a 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx @@ -34,14 +34,13 @@ namespace jfw_plugin by "\xXX\xXX" */ BEGIN_VENDOR_MAP() -// For OS X, don't bother with implementations that aren't relevant (or have never existed) #ifdef MACOSX VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo) VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo) #endif VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo) VENDOR_MAP_ENTRY("Oracle Corporation", SunInfo) -#ifndef MACOSX +#ifndef MACOSX // For OS X, don't bother with implementations that aren't relevant (or have never existed) VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo) VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo) VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo) |