diff options
| author | ruki <[email protected]> | 2022-09-07 22:45:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-07 22:45:55 +0800 |
| commit | 421cdb9f4b8b8a7be5e29b53065cf3f2e07231ae (patch) | |
| tree | dac5a56537b9e1e87da6768bdaa7fdf9323b5d4c | |
| parent | a1ebebeee928b74508a4bfbd3edb993eb39fc0c2 (diff) | |
mark as pathenv
| -rw-r--r-- | xmake/core/package/package.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index dab537c63..0cebce22e 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -841,11 +841,30 @@ function _instance:_rawenvs() return envs end +-- get path environment keys +function _instance:_pathenvs() + local pathenvs = self._PATHENVS + if pathenvs == nil then + pathenvs = hashset.from { + "PATH", + "LD_LIBRARY_PATH", + "DYLD_LIBRARY_PATH" + } + self._PATHENVS = pathenvs + end + return pathenvs +end + +-- mark as path environments +function _instance:mark_as_pathenv(name) + self:_pathenvs():insert(name) +end + -- get the exported environments function _instance:envs() local envs = {} - for name, values in pairs(instance:_rawenvs()) do - if name == "PATH" or name == "LD_LIBRARY_PATH" or name == "DYLD_LIBRARY_PATH" then + for name, values in pairs(self:_rawenvs()) do + if self:_pathenvs():has(name) then local newvalues = {} for _, value in ipairs(values) do if path.is_absolute(value) then |
