diff options
| author | ruki <[email protected]> | 2024-05-28 00:52:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-05-28 00:52:09 +0800 |
| commit | be0f7c374de2f7a30bf951560bf37b9be38afe85 (patch) | |
| tree | 8252e3d852caeaccea370a58f35147cd36cc8219 | |
| parent | 70f4e6c342796fa77d4d3c129942ae3a7c12013c (diff) | |
fix pathenvs
| -rw-r--r-- | xmake/core/package/package.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/packagenv.lua | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 00c89f241..c65f72afe 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -889,6 +889,7 @@ function _instance:manifest_save() manifest.mode = self:mode() manifest.configs = self:configs() manifest.envs = self:_rawenvs() + manifest.pathenvs = self:_pathenvs():to_array() -- save enabled library deps if self:librarydeps() then diff --git a/xmake/modules/private/action/require/impl/packagenv.lua b/xmake/modules/private/action/require/impl/packagenv.lua index 06a70df91..8da69d914 100644 --- a/xmake/modules/private/action/require/impl/packagenv.lua +++ b/xmake/modules/private/action/require/impl/packagenv.lua @@ -19,17 +19,21 @@ -- -- imports +imports("core.base.hashset") import("core.package.package", {alias = "core_package"}) -- enter the package environments -function _enter_package(package_name, envs, installdir) +function _enter_package(package_name, envs, pathenvs, installdir) + if pathenvs then + pathenvs = hashset.from(pathenvs) + end for name, values in pairs(envs) do - if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then + if pathenvs and pathenvs:has(name) then for _, value in ipairs(values) do if path.is_absolute(value) then os.addenv(name, value) else - os.addenv(name, path.join(installdir, value)) + os.addenv(name, path.normalize(path.join(installdir, value))) end end else @@ -45,7 +49,7 @@ function enter(...) for _, manifest_file in ipairs(os.files(path.join(core_package.installdir(), name:sub(1, 1), name, "*", "*", "manifest.txt"))) do local manifest = io.load(manifest_file) if manifest and manifest.plat == os.host() and manifest.arch == os.arch() then - _enter_package(name, manifest.envs, path.directory(manifest_file)) + _enter_package(name, manifest.envs, manifest.pathenvs, path.directory(manifest_file)) end end end |
