jvmfwk/Library_jvmfwk.mk                            |    2 ++
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |    4 ++--
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx          |    4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 0a1c83f330205439a42a8c02880ee44e0b9ae3d4
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Oct 18 17:01:06 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Oct 25 15:58:24 2022 +0200

    tdf#151545: Restrict JvmfwkUtil_isLoadableJVM to macOS x86-64
    
    That check had been added with 32bc8ddbf335dd26019edcf12758643b4cff9913
    "tdf#94716 allow Oracle's JDK to be used on OS X 10.10 and 10.11", back at a
    time when there was substantial trouble with installations of Apple's own 
Java
    and Oracle JREs.  One consequence of that commit and its
    JvmfwkUtil_isLoadableJVM check was that on macOS we only supported JDKs 
(with a
    surrounding Contents directory containing an appropriate Info.plist files), 
not
    plain JREs (cf. <https://wiki.documentfoundation.org/ReleaseNotes/5.1#macOS>
    "Prior work arounds of having both an Apple JRE 6 and an Oracle JRE 8 are no
    longer sufficient.  Use of the JDK is now hard coded, see tdf#74877, 
tdf#94716
    and core commit 32bc8ddbf335dd26019edcf12758643b4cff9913.")
    
    However, Apple's own Java is long since deprecated (cf.
    <https://support.apple.com/en-us/HT204036> "You can also download legacy 
Java SE
    6 from Apple if you’re using an app that specifically requires this 
unsupported,
    out-of-date version."), and presumably of no practical concern at least on
    contemporary Aarch64-based macOS.
    
    And there is e.g. SDKMAN! (<https://sdkman.io/>), which installs JDKs in a 
way
    that they are not surrounded by Contents directories containing appropriate
    Info.plist files, so JvmfwkUtil_isLoadableJVM returned false for them and 
you
    couldn't add them on the LibreOffice Advanced Options tab.
    
    So at least for Aarch64-based macOS, drop that presumably-legacy
    JvmfwkUtil_isLoadableJVM check (but keep it for x86-64--based macOS at 
least for
    now, just to be safe).  (That implies that for Aarch64-based macOS, it 
should
    now work again to also use plain JREs.)
    
    Change-Id: I3bcbb3c14e3a9e9dde39fd6f4572b632e05df9e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141508
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    (cherry picked from commit c74133420f6f9b4bc6b414b9c91d54cf8eb3f5af)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141410
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/jvmfwk/Library_jvmfwk.mk b/jvmfwk/Library_jvmfwk.mk
index 9928b0db7c1b..64a6b9d8e396 100644
--- a/jvmfwk/Library_jvmfwk.mk
+++ b/jvmfwk/Library_jvmfwk.mk
@@ -58,9 +58,11 @@ $(eval $(call gb_Library_add_cxxflags,jvmfwk,\
     $(gb_OBJCXXFLAGS) \
 ))
 
+ifeq ($(CPUNAME),X86_64)
 $(eval $(call gb_Library_add_objcxxobjects,jvmfwk,\
     jvmfwk/plugins/sunmajor/pluginlib/util_cocoa \
 ))
+endif
 
 $(eval $(call gb_Library_add_libs,jvmfwk,\
     -framework Foundation \
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx 
b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 72c3a2424f63..03c38c1dea76 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -72,7 +72,7 @@
 #include "sunversion.hxx"
 #include "diagnostics.h"
 
-#ifdef MACOSX
+#if defined MACOSX && defined __x86_64__
 #include "util_cocoa.hxx"
 #endif
 
@@ -625,7 +625,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         return javaPluginError::VmCreationFailed;
 #endif
     OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
-#ifdef MACOSX
+#if defined MACOSX && defined __x86_64__
     if ( !JvmfwkUtil_isLoadableJVM( sRuntimeLib ) )
         return javaPluginError::VmCreationFailed;
 #endif
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx 
b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index ce297512482c..6eb96d731c8f 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -47,7 +47,7 @@
 #include "sunjre.hxx"
 #include "vendorlist.hxx"
 #include "diagnostics.h"
-#ifdef MACOSX
+#if defined MACOSX && defined __x86_64__
 #include "util_cocoa.hxx"
 #endif
 
@@ -376,8 +376,10 @@ bool getJavaProps(const OUString & exePath,
     }
 
 #ifdef MACOSX
+#if defined __x86_64__
     if (!JvmfwkUtil_isLoadableJVM(exePath))
         return false;
+#endif
     if (sClassPath.endsWith("/"))
         sClassPath += "../Resources/java/";
     else

Reply via email to