[vlc-commits] contrib: bluray: Add patch to fix libbluray.jar loading on macOS

Marvin Scholz git at videolan.org
Sun Mar 18 21:09:47 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Sun Mar 18 21:02:02 2018 +0100| [774019955c8d44f6888fc1fce970e7f730e59594] | committer: Marvin Scholz

contrib: bluray: Add patch to fix libbluray.jar loading on macOS

This is already landed upstream but we need a new release, so for now
keep this local patch. When a release is done and the contrib is
updated, this should be removed.

Fix #19702

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=774019955c8d44f6888fc1fce970e7f730e59594
---

 ...01-Implement-dl_get_path-for-darwin-macOS.patch | 62 ++++++++++++++++++++++
 contrib/src/bluray/rules.mak                       |  1 +
 2 files changed, 63 insertions(+)

diff --git a/contrib/src/bluray/0001-Implement-dl_get_path-for-darwin-macOS.patch b/contrib/src/bluray/0001-Implement-dl_get_path-for-darwin-macOS.patch
new file mode 100644
index 0000000000..f70ad4ae03
--- /dev/null
+++ b/contrib/src/bluray/0001-Implement-dl_get_path-for-darwin-macOS.patch
@@ -0,0 +1,62 @@
+From 8c15fdad7797854bc4f98cdb339074a4f9f2dbb3 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07 at gmail.com>
+Date: Wed, 7 Mar 2018 10:24:41 +0100
+Subject: [PATCH] Implement dl_get_path for darwin (macOS)
+
+---
+ src/file/dl_posix.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/src/file/dl_posix.c b/src/file/dl_posix.c
+index f1852a43..b97f12fe 100644
+--- a/src/file/dl_posix.c
++++ b/src/file/dl_posix.c
+@@ -27,6 +27,11 @@
+ #include "util/logging.h"
+ #include "util/strutl.h"
+ 
++#ifdef __APPLE__
++// Required to make dladdr available
++#    define _DARWIN_C_SOURCE
++#endif
++
+ #if defined(HAVE_DLFCN_H)
+ #   include <dlfcn.h>
+ #elif defined(HAVE_SYS_DL_H)
+@@ -112,6 +117,7 @@ int dl_dlclose(void *handle)
+     return dlclose(handle);
+ }
+ 
++#define PATH_SEPARATOR '/'
+ const char *dl_get_path(void)
+ {
+     static char *lib_path    = NULL;
+@@ -120,7 +126,25 @@ const char *dl_get_path(void)
+     if (!initialized) {
+         initialized = 1;
+ 
++#ifdef __APPLE__
++        Dl_info dl_info;
++        int ret = dladdr((void *)dl_get_path, &dl_info);
++
++        if (ret != 0) {
++            lib_path = strdup(dl_info.dli_fname);
++
++            /* cut library name from path */
++            char *p = strrchr(lib_path, PATH_SEPARATOR);
++            if (p) {
++                *(p+1) = 0;
++            }
++            BD_DEBUG(DBG_FILE, "library file is %s\n", lib_path);
++        } else {
++            BD_DEBUG(DBG_FILE, "Can't determine libbluray.so install path\n");
++        }
++#else
+         BD_DEBUG(DBG_FILE, "Can't determine libbluray.so install path\n");
++#endif
+     }
+ 
+     return lib_path;
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/bluray/rules.mak b/contrib/src/bluray/rules.mak
index fb5b9252e1..f0fe41d341 100644
--- a/contrib/src/bluray/rules.mak
+++ b/contrib/src/bluray/rules.mak
@@ -48,6 +48,7 @@ $(TARBALLS)/libbluray-$(BLURAY_VERSION).tar.bz2:
 
 bluray: libbluray-$(BLURAY_VERSION).tar.bz2 .sum-bluray
 	$(UNPACK)
+	$(APPLY) $(SRC)/lua/0001-Implement-dl_get_path-for-darwin-macOS.patch
 	$(call pkg_static,"src/libbluray.pc.in")
 	$(MOVE)
 



More information about the vlc-commits mailing list