Ticket #54661: patch-bdj-mac.diff

File patch-bdj-mac.diff, 2.3 KB (added by RJVB (René Bertin), 5 years ago)
  • src/libbluray/bdj/

    old new  
    221221}
    222222#endif
    223223
     224#ifdef __APPLE__
     225#define MACOS_JRE_HOME "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
     226static const char *jre_plugin_path = MACOS_JRE_HOME;
     227#endif
     228
    224229#if defined(__APPLE__) && !defined(HAVE_BDJ_J2ME)
    225230
    226231#define MACOS_JAVA_HOME "/usr/libexec/java_home"
     
    324329    const char *java_home = NULL;
    325330    static const char jli_dir[] = "jre/lib/jli";
    326331    static const char jli_lib[] = "libjli";
     332    void *handle;
    327333
    328334    /* JAVA_HOME set, use it */
    329335    java_home = getenv("JAVA_HOME");
     
    333339
    334340    java_home = _java_home_macos();
    335341    if (java_home) {
    336         return _jvm_dlopen(java_home, jli_dir, jli_lib);
     342        handle = _jvm_dlopen(java_home, jli_dir, jli_lib);
     343           if (handle) {
     344                   return handle;
     345           }
    337346    }
    338     return NULL;
     347    // check if the JRE is installed; it ends up in the internet plugins repository:
     348    return _jvm_dlopen(jre_plugin_path, "lib/jli", jli_lib);
    339349}
    340350#endif
    341351
     
    362372    static const char         jvm_lib[]  = "jvm";
    363373# else
    364374#  ifdef __APPLE__
    365     static const char * const jvm_path[] = {NULL, JDK_HOME};
    366     static const char * const jvm_dir[]  = {"jre/lib/server"};
     375    static const char * const jvm_path[] = {NULL, JDK_HOME, MACOS_JRE_HOME};
     376    static const char * const jvm_dir[]  = {"jre/lib/server",
     377                                            "lib/server"};
    367378#  else
    368379    static const char * const jvm_path[] = {NULL,
    369380                                            JDK_HOME,
     
    404415#if defined(__APPLE__) && !defined(HAVE_BDJ_J2ME)
    405416    java_home = _java_home_macos();
    406417    if (java_home) {
    407         *p_java_home = java_home;
    408         return _jvm_dlopen_a(java_home, jvm_dir, num_jvm_dir, jvm_lib);
     418        handle = _jvm_dlopen_a(java_home, jvm_dir, num_jvm_dir, jvm_lib);
     419           if (handle) {
     420            *p_java_home = java_home;
     421            return handle;
     422           }
     423    }
     424    // check if the JRE is installed; it ends up in the internet plugins repository:
     425    handle = _jvm_dlopen(jre_plugin_path, "lib/server", jvm_lib);
     426    if (handle) {
     427        *p_java_home = jre_plugin_path;
     428        return handle;
    409429    }
    410430#endif
    411431