From 61dd12c634559507627c7259ea7efef34bc7d9f5 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 23 May 2021 02:43:56 -0400
Subject: [PATCH] Restructure mac SLPlugin for cleaner functionality

---
 indra/llfilesystem/lldir_mac.cpp              |  2 +-
 indra/llplugin/slplugin/CMakeLists.txt        |  2 +-
 .../libvlc/media_plugin_libvlc.cpp            |  2 +-
 indra/newview/viewer_manifest.py              | 24 ++++++++-----------
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp
index cc430bb957b..07a1927550c 100644
--- a/indra/llfilesystem/lldir_mac.cpp
+++ b/indra/llfilesystem/lldir_mac.cpp
@@ -149,7 +149,7 @@ LLDir_Mac::LLDir_Mac()
 		
 		mWorkingDir = getCurPath();
 
-		mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin";
+		mLLPluginDir = mAppRODataDir + mDirDelimiter + "SLPlugin.app" + mDirDelimiter + "Contents" + mDirDelimiter + "Frameworks";
 	}
 }
 
diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt
index a4d7d36ca22..3a94173668b 100644
--- a/indra/llplugin/slplugin/CMakeLists.txt
+++ b/indra/llplugin/slplugin/CMakeLists.txt
@@ -59,7 +59,7 @@ elseif (DARWIN)
 set_target_properties(SLPlugin
   PROPERTIES
   BUILD_WITH_INSTALL_RPATH 1
-  INSTALL_RPATH "@executable_path/../../../../Frameworks"
+  INSTALL_RPATH "@executable_path/../../../../Frameworks;@executable_path/../Frameworks;@executable_path/../Frameworks/plugins"
   MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist
   )
 endif ()
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index adbebd1c059..ba1f483b30e 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -172,7 +172,7 @@ void MediaPluginLibVLC::initVLC()
 	};
 
 #if LL_DARWIN
-	setenv("VLC_PLUGIN_PATH", ".", 1);
+	setenv("VLC_PLUGIN_PATH", "./plugins", 1);
 #endif
 
 	int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 124e9f86957..f8ab38494ef 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1052,17 +1052,7 @@ def construct(self):
                             self.relsymlinkf(os.path.join(libfile_parent, libfile))
 
                 # Dullahan helper apps go inside SLPlugin.app
-                with self.prefix(src=os.path.join(pkgdir, 'bin', 'release'), dst=os.path.join(
-                    "SLPlugin.app", "Contents", "Frameworks")):
-                    self.path("Chromium Embedded Framework.framework")
-                    self.path("DullahanHost.app")
-                    self.path("DullahanHost (GPU).app")
-                    self.path("DullahanHost (Renderer).app")
-                    self.path("DullahanHost (Plugin).app")
-
-
-                # SLPlugin plugins
-                with self.prefix(dst="llplugin"):
+                with self.prefix(dst=os.path.join("SLPlugin.app", "Contents", "Frameworks")):
                     # copy CEF plugin
                     self.path2basename("../media_plugins/cef/" + self.args['configuration'],
                                        "media_plugin_cef.dylib")
@@ -1071,14 +1061,20 @@ def construct(self):
                     self.path2basename("../media_plugins/libvlc/" + self.args['configuration'],
                                        "media_plugin_libvlc.dylib")
 
-                    # copy LibVLC dynamic libraries
-                    with self.prefix(src=relpkgdir, dst="lib"):
+                    with self.prefix(src=os.path.join(pkgdir, 'bin', 'release')):
+                        self.path("Chromium Embedded Framework.framework")
+                        self.path("DullahanHost.app")
+                        self.path("DullahanHost (GPU).app")
+                        self.path("DullahanHost (Renderer).app")
+                        self.path("DullahanHost (Plugin).app")
+                    with self.prefix(src=os.path.join(pkgdir, 'lib', 'release')):
                         self.path( "libvlc*.dylib*" )
                         # copy LibVLC plugins folder
-                        with self.prefix(src='plugins', dst=""):
+                        with self.prefix(src='plugins', dst="plugins"):
                             self.path( "*.dylib" )
                             self.path( "plugins.dat" )
 
+
     def package_finish(self):
         import dmgbuild
 
-- 
GitLab