compositor: Respect WESTON_BUILD_DIR env var in weston_load_module
We were loading modules out of the system dirs unconditionally, so tests that loaded modules would use the system ones, or fail if they weren't installed. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
committed by
Bryce Harrington
parent
d8156e22f6
commit
3f86e50be0
+8
-3
@@ -4680,16 +4680,21 @@ weston_version(int *major, int *minor, int *micro)
|
|||||||
WL_EXPORT void *
|
WL_EXPORT void *
|
||||||
weston_load_module(const char *name, const char *entrypoint)
|
weston_load_module(const char *name, const char *entrypoint)
|
||||||
{
|
{
|
||||||
|
const char *builddir = getenv("WESTON_BUILD_DIR");
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
void *module, *init;
|
void *module, *init;
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (name[0] != '/')
|
if (name[0] != '/') {
|
||||||
snprintf(path, sizeof path, "%s/%s", MODULEDIR, name);
|
if (builddir)
|
||||||
else
|
snprintf(path, sizeof path, "%s/.libs/%s", builddir, name);
|
||||||
|
else
|
||||||
|
snprintf(path, sizeof path, "%s/%s", MODULEDIR, name);
|
||||||
|
} else {
|
||||||
snprintf(path, sizeof path, "%s", name);
|
snprintf(path, sizeof path, "%s", name);
|
||||||
|
}
|
||||||
|
|
||||||
module = dlopen(path, RTLD_NOW | RTLD_NOLOAD);
|
module = dlopen(path, RTLD_NOW | RTLD_NOLOAD);
|
||||||
if (module) {
|
if (module) {
|
||||||
|
|||||||
Reference in New Issue
Block a user