[Libreoffice-commits] .: jvmfwk/plugins

Hanno Meyer-Thurow hmth at kemper.freedesktop.org
Mon Mar 14 11:07:42 PDT 2011


 jvmfwk/plugins/sunmajor/pluginlib/makefile.mk    |    4 ++
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx       |   40 +++++++++++++++++++++--
 jvmfwk/plugins/sunmajor/pluginlib/util.hxx       |    3 +
 jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx |    5 ++
 4 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 65e7074902c78ccb6592fa9fe61b8960b4a43bcb
Author: Hanno Meyer-Thurow <h.mth at web.de>
Date:   Sun Mar 13 16:15:57 2011 +0100

    Merge Gentoo patches from old build and downstream repositories.
    
    1. Do not add compiler default include and library path: potentially build
       against different version of system library than requested by the user.
    2. Add a configure option to disable Python2 (PyUNO) bindings. Python3 is
       available for more than two years. Noone cares, therefore rest in peace.
       Python2 is going to be ditched at some point. Simply do not fail then.
       Windows builds need to be updated for BUILD_TYPE: "PYUNO". Or how is it
       handled nowadays?
    3. Fix sandbox violation in officecfg module: rm /bin/<language>.zip
    4. Add a configure option to search only in one place for JVMs, which is quite
       interesting for Linux Distributions. Enforce the user to place JVMs in one
       base directory.
    5. Fix build for libxml-2.7.8 with ICU support.
    
    * config_office-XINC-XLIB-defaults.diff: (1)
    * disable-python.diff: (2)
    * gentoo-sandbox.diff: (3)
    * jvm-search-path.diff: (4)
    * libxmlsec_fix_extern_c.diff: (5)

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
index 4fdb1ba..76fd7c9 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
+++ b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
@@ -73,6 +73,10 @@ SHL1STDLIBS += -luwinapi -ladvapi32
 .ENDIF # GCC
 .ENDIF #WNT
 
+.IF "$(JVM_ONE_PATH_CHECK)" != ""
+CFLAGS += -DJVM_ONE_PATH_CHECK=\"$(JVM_ONE_PATH_CHECK)\"
+.ENDIF
+
 SHL1VERSIONMAP = sunjavaplugin.map
 SHL1DEPN=
 SHL1IMPLIB=	i$(UNOCOMPONENT1)
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index b8eb60b..4cf5244 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -92,12 +92,14 @@ char const *g_arJavaNames[] = {
  */
 char const *g_arCollectDirs[] = {
     "",
+#ifndef JVM_ONE_PATH_CHECK
     "j2re/", 
     "j2se/", 
     "j2sdk/",
     "jdk/",
     "jre/", 
     "java/",
+#endif
     "jvm/"
 };
 
@@ -109,6 +111,7 @@ char const *g_arSearchPaths[] = {
     "",
     "System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/"
 #else
+#ifndef JVM_ONE_PATH_CHECK
     "",
     "usr/",
     "usr/local/",
@@ -119,6 +122,9 @@ char const *g_arSearchPaths[] = {
 #endif
     "usr/lib/",
     "usr/bin/"
+#else
+    JVM_ONE_PATH_CHECK
+#endif
 #endif
 };
 }
@@ -368,6 +374,9 @@ void AsynchReader::run()
 
 
 bool getJavaProps(const OUString & exePath,
+#ifdef JVM_ONE_PATH_CHECK
+                  const OUString & homePath,
+#endif
                   std::vector<std::pair<rtl::OUString, rtl::OUString> >& props,
                   bool * bProcessRun)
 {
@@ -469,6 +478,15 @@ bool getJavaProps(const OUString & exePath,
         OUString sKey = sLine.copy(0, index);
         OUString sVal = sLine.copy(index + 1);
 
+#ifdef JVM_ONE_PATH_CHECK
+        //replace absolute path by linux distro link
+        OUString sHomeProperty(RTL_CONSTASCII_USTRINGPARAM("java.home"));
+        if(sHomeProperty.equals(sKey))
+        {
+            sVal = homePath + OUString::createFromAscii("/jre");
+        }
+#endif
+
         props.push_back(std::make_pair(sKey, sVal));
     }
 
@@ -751,10 +769,12 @@ vector<Reference<VendorBase> > getAllJREInfos()
     createJavaInfoFromWinReg(vecInfos);
 #endif // WNT
 
+#ifndef JVM_ONE_PATH_CHECK
     createJavaInfoFromJavaHome(vecInfos);
     //this function should be called after createJavaInfoDirScan.
     //Otherwise in SDKs Java may be started twice
      createJavaInfoFromPath(vecInfos);
+#endif
 
 #ifdef UNX
     createJavaInfoDirScan(vecInfos);
@@ -818,7 +838,11 @@ OUString resolveDirPath(const OUString & path)
         if (item.getFileStatus(status) == File::E_None
             && status.getFileType() == FileStatus::Directory)
         {
+#ifndef JVM_ONE_PATH_CHECK
             ret = sResolved;
+#else
+            ret = path;
+#endif
         }
     }
     else
@@ -847,7 +871,11 @@ OUString resolveFilePath(const OUString & path)
         if (item.getFileStatus(status) == File::E_None
             && status.getFileType() == FileStatus::Regular)
         {
+#ifndef JVM_ONE_PATH_CHECK
             ret = sResolved;
+#else
+            ret = path;
+#endif
         }                    
     }
     else
@@ -942,7 +970,11 @@ rtl::Reference<VendorBase> getJREInfoByPath(
             }
 
             bool bProcessRun= false;
-            if (getJavaProps(sFilePath, props, & bProcessRun) == false)
+            if (getJavaProps(sFilePath,
+#ifdef JVM_ONE_PATH_CHECK
+                             sResolvedDir,
+#endif
+                             props, & bProcessRun) == false)
             {
                 //The java executable could not be run or the system properties
                 //could not be retrieved. We can assume that this java is corrupt.
@@ -961,7 +993,11 @@ rtl::Reference<VendorBase> getJREInfoByPath(
                     //invoked to build the path to the executable. It we start the script directy as .java_wrapper
                     //then it tries to start a jdk/.../native_threads/.java_wrapper. Therefore the link, which
                     //is named java, must be used to start the script.
-                    getJavaProps(sFullPath, props, & bProcessRun);
+                    getJavaProps(sFullPath,
+#ifdef JVM_ONE_PATH_CHECK
+                                 sResolvedDir,
+#endif
+                                 props, & bProcessRun);
                     // Either we found a working 1.3.1                    
                     //Or the java is broken. In both cases we stop searchin under this "root" directory
                     bBreak = true;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
index ff54c00..c9e5319 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
@@ -118,6 +118,9 @@ std::vector<rtl::Reference<VendorBase> > getAllJREInfos();
 
 bool getJavaProps(
     const rtl::OUString & exePath,
+#ifdef JVM_ONE_PATH_CHECK
+    const rtl::OUString & homePath,
+#endif
     std::vector<std::pair<rtl::OUString, rtl::OUString> >& props,
     bool * bProcessRun);
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
index add08b5..a0c7ced 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
@@ -131,6 +131,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
         }
         else if (!bHome && sHomeProperty.equals(i->first))
         {
+#ifndef JVM_ONE_PATH_CHECK
            OUString fileURL;
            if (osl_getFileURLFromSystemPath(i->second.pData,& fileURL.pData) ==
                osl_File_E_None)
@@ -144,6 +145,10 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
                    bHome = true;
                }
            }
+#else
+           m_sHome = i->second;
+           bHome = true;
+#endif
         }
         else if (!bAccess && sAccessProperty.equals(i->first))
         {


More information about the Libreoffice-commits mailing list