darwin: redirect VLC_PKG_LIB_DIR/plugins on iOS

On iOS and tvOS, dylibs must be wrapped into a framework and frameworks
must be flattened into the frameworks/ application directory (or global
to the system which is not possible in the general case), so dylibs
can't be in the VLC_PKG_LIB_DIR/plugins folder. Redirect
VLC_PKG_LIB_DIR/plugins toward VLC_PKG_LIB_DIR/ on those platforms.

Manual cherry-pick from commit 89e90672db.
The code is written directly in the src/modules/bank.c code given that
config_GetSysPath doesn't exist in 3.0.
This commit is contained in:
Alexandre Janniaux 2022-07-29 10:39:16 +02:00
parent cf1baa09fa
commit 370b1ae837
2 changed files with 10 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include <mach-o/dyld.h>
#include <CoreFoundation/CoreFoundation.h>
#include <TargetConditionals.h>
char *config_GetLibDir (void)
{

View File

@ -49,6 +49,10 @@
#include "config/configuration.h"
#include "modules/modules.h"
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
typedef struct vlc_modcap
{
char *name;
@ -525,6 +529,11 @@ static void AllocateAllPlugins (vlc_object_t *p_this)
#if VLC_WINSTORE_APP
/* Windows Store Apps can not load external plugins with absolute paths. */
AllocatePluginPath (p_this, "plugins", mode);
#elif defined(__APPLE__) && defined(HAVE_DYNAMIC_PLUGINS) && TARGET_OS_IPHONE
/* Redirect to the application folder, plugins/ is flattened. */
char *vlcpath = config_GetLibDir ();
AllocatePluginPath (p_this, vlcpath, mode);
free(vlcpath);
#else
/* Contruct the special search path for system that have a relocatable
* executable. Set it to <vlc path>/plugins. */