diff options
| author | ruki <[email protected]> | 2025-07-25 00:48:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-07-25 00:48:54 +0800 |
| commit | 8f3b582019d38f1aa9d774b1c752f9a5f18507fc (patch) | |
| tree | cf1bd27c07dde7bbeef7967714326731ba0b8f78 /xmake/modules/utils/binary/deplibs.lua | |
| parent | fbb062e201d403a662230bc643f527afe14b8b76 (diff) | |
improve to resolve rpath
Diffstat (limited to 'xmake/modules/utils/binary/deplibs.lua')
| -rw-r--r-- | xmake/modules/utils/binary/deplibs.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xmake/modules/utils/binary/deplibs.lua b/xmake/modules/utils/binary/deplibs.lua index 3c85bc1ff..fdc873b31 100644 --- a/xmake/modules/utils/binary/deplibs.lua +++ b/xmake/modules/utils/binary/deplibs.lua @@ -229,27 +229,27 @@ end -- resolve file path with @rpath, @loader_path, and $ORIGIN function _resolve_filepath(binaryfile, dependfile, opt) - local rpath_cache = opt._rpath_cache + local loaderfile = opt._loaderfile if dependfile:startswith("@rpath/") then - local rpath_list = rpath_cache[binaryfile] - if rpath_list == nil then - rpath_list = rpath_utils.list(binaryfile) - rpath_cache[binaryfile] = rpath_list or false + local rpathlist = opt._rpathlist + if rpathlist == nil then + rpathlist = rpath_utils.list(loaderfile) + opt._rpathlist = rpathlist or false end - if rpath_list then - for _, rpath in ipairs(rpath_list) do + if rpathlist then + for _, rpath in ipairs(rpathlist) do local filepath = dependfile:replace("@rpath/", rpath .. "/", {plain = true}) if os.isfile(filepath) then dependfile = filepath break elseif filepath:startswith("@loader_path/") then - filepath = filepath:replace("@loader_path/", path.directory(binaryfile) .. "/", {plain = true}) + filepath = filepath:replace("@loader_path/", path.directory(loaderfile) .. "/", {plain = true}) if os.isfile(filepath) then dependfile = filepath break end elseif filepath:startswith("$ORIGIN/") then - filepath = filepath:replace("$ORIGIN/", path.directory(binaryfile) .. "/", {plain = true}) + filepath = filepath:replace("$ORIGIN/", path.directory(loaderfile) .. "/", {plain = true}) if os.isfile(filepath) then dependfile = filepath break @@ -307,7 +307,7 @@ function main(binaryfile, opt) --opt.recursive = true --opt.resolve_path = true if opt.resolve_path then - opt._rpath_cache = {} + opt._loaderfile = binaryfile end binaryfile = path.normalize(path.absolute(binaryfile)) if opt.recursive then |
