diff options
| author | ruki <[email protected]> | 2025-07-26 00:47:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-07-26 00:47:48 +0800 |
| commit | e3759b8bd56d614b49d95256c04c7d093100d64a (patch) | |
| tree | cb290dce757bfff2bb07377569c033665cae1c41 /xmake/modules/utils/binary/deplibs.lua | |
| parent | 53d106bc017dc2e7db4bdff583ebe863c957ab9f (diff) | |
add resolve_hint_paths
Diffstat (limited to 'xmake/modules/utils/binary/deplibs.lua')
| -rw-r--r-- | xmake/modules/utils/binary/deplibs.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/xmake/modules/utils/binary/deplibs.lua b/xmake/modules/utils/binary/deplibs.lua index b81d644d8..15ca0b12b 100644 --- a/xmake/modules/utils/binary/deplibs.lua +++ b/xmake/modules/utils/binary/deplibs.lua @@ -235,6 +235,7 @@ end -- resolve file path with @rpath, @loader_path, and $ORIGIN function _resolve_filepath(binaryfile, dependfile, opt) local loaderfile = opt._loaderfile + local resolve_hint_paths = opt.resolve_hint_paths if dependfile:startswith("@rpath/") then local rpathlist = opt._rpathlist if rpathlist == nil then @@ -263,6 +264,19 @@ function _resolve_filepath(binaryfile, dependfile, opt) end end end + if not path.is_absolute(dependfile) then + if os.isfile(dependfile) then + dependfile = path.absolute(dependfile) + elseif resolve_hint_paths then + local filename = path.filename(dependfile) + for _, filepath in ipairs(resolve_hint_paths) do + if filename == path.filename(filepath) then + dependfile = path.absolute(filepath) + break + end + end + end + end dependfile = path.normalize(dependfile) if binaryfile ~= dependfile then return dependfile @@ -303,9 +317,10 @@ end -- get the library dependencies of the give binary files -- -- @param binaryfile the binary file --- @param opt the option, e.g. {recursive = false, resolve_path = true} +-- @param opt the option, e.g. {recursive = false, resolve_path = true, resolve_hint_paths = {}} -- - recursive: recursively get all sub-dependencies, sorted by topology -- - resolve_path: try to resolve the file full path, e.g. @rpath, @loader_path, $ORIGIN, relative path .. +-- - resolve_hint_paths: we can resolve and match path from them -- function main(binaryfile, opt) opt = opt or {} |
