summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/require/install.lua2
-rw-r--r--xmake/core/package/package.lua5
-rw-r--r--xmake/core/platform/environment.lua11
-rw-r--r--xmake/modules/private/action/require/packagenv.lua2
-rw-r--r--xmake/modules/private/xrepo/action/env.lua2
5 files changed, 14 insertions, 8 deletions
diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua
index 607f91fbc..0367132a8 100644
--- a/xmake/actions/require/install.lua
+++ b/xmake/actions/require/install.lua
@@ -32,7 +32,7 @@ import("impl.utils.get_requires")
-- envs: bin path for *.dll, program ..
function _register_required_package_envs(instance, envs)
for name, values in pairs(instance:envs()) do
- if name == "PATH" or name == "LD_LIBRARY_PATH" then
+ if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
for _, value in ipairs(values) do
envs[name] = envs[name] or {}
if path.is_absolute(value) then
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index b46077f08..4361cb29d 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -434,6 +434,9 @@ function _instance:envs()
-- add LD_LIBRARY_PATH to load *.so directory
if os.host() ~= "windows" and self:is_plat(os.host()) and self:is_arch(os.arch()) then
envs.LD_LIBRARY_PATH = {"lib"}
+ if os.host() == "macosx" then
+ envs.DYLD_LIBRARY_PATH = {"lib"}
+ end
end
self._ENVS = envs
end
@@ -465,7 +468,7 @@ function _instance:envs_enter()
local installdir = self:installdir()
for name, values in pairs(self:envs()) do
oldenvs[name] = oldenvs[name] or os.getenv(name)
- if name == "PATH" or name == "LD_LIBRARY_PATH" then
+ if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
for _, value in ipairs(values) do
if path.is_absolute(value) then
os.addenv(name, value)
diff --git a/xmake/core/platform/environment.lua b/xmake/core/platform/environment.lua
index d82b4b297..91491ca0a 100644
--- a/xmake/core/platform/environment.lua
+++ b/xmake/core/platform/environment.lua
@@ -60,10 +60,13 @@ end
-- enter the running environment
function environment._enter_run()
- local oldenvs = {}
- oldenvs.PATH = os.getenv("PATH")
- oldenvs.LD_LIBRARY_PATH = os.getenv("LD_LIBRARY_PATH")
- environment._OLDENVS_RUN = oldenvs
+ local oldenvs = {}
+ oldenvs.PATH = os.getenv("PATH")
+ oldenvs.LD_LIBRARY_PATH = os.getenv("LD_LIBRARY_PATH")
+ if os.host() == "macosx" then
+ oldenvs.DYLD_LIBRARY_PATH = os.getenv("DYLD_LIBRARY_PATH")
+ end
+ environment._OLDENVS_RUN = oldenvs
return true
end
diff --git a/xmake/modules/private/action/require/packagenv.lua b/xmake/modules/private/action/require/packagenv.lua
index 44382e15c..6eb4862b9 100644
--- a/xmake/modules/private/action/require/packagenv.lua
+++ b/xmake/modules/private/action/require/packagenv.lua
@@ -35,7 +35,7 @@ function _enter_package(package_name, envs, installdir)
-- add the new environments
for name, values in pairs(envs) do
oldenvs[name] = oldenvs[name] or os.getenv(name)
- if name == "PATH" or name == "LD_LIBRARY_PATH" then
+ if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
for _, value in ipairs(values) do
if path.is_absolute(value) then
os.addenv(name, value)
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua
index ecdacad8f..2dfede2ce 100644
--- a/xmake/modules/private/xrepo/action/env.lua
+++ b/xmake/modules/private/xrepo/action/env.lua
@@ -171,7 +171,7 @@ function _package_addenvs(envs, instance)
-- add run envs, e.g. PATH, LD_LIBRARY_PATH, ..
local installdir = instance:installdir()
for name, values in pairs(instance:envs()) do
- if name == "PATH" or name == "LD_LIBRARY_PATH" then
+ if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then
for _, value in ipairs(values) do
if path.is_absolute(value) then
_package_addenv(envs, name, value)