diff options
| author | Chen Yufei <[email protected]> | 2022-03-16 10:26:22 +0800 |
|---|---|---|
| committer | Chen Yufei <[email protected]> | 2022-03-16 10:26:22 +0800 |
| commit | 0a97ca79d0e52e8f21d068047595446423720957 (patch) | |
| tree | dbf415a398244893ad5ab4f26e1c4dee840ef3a4 | |
| parent | a15768131bc8b1743fee9d6c3c63428dda9d04c8 (diff) | |
Use core_package.installdir to fix path prefix.
| -rw-r--r-- | xmake/modules/private/action/require/impl/actions/install.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index 1830a01cd..5e8b84f26 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -19,9 +19,9 @@ -- -- imports -import("core.base.global") import("core.base.option") import("core.base.tty") +import("core.package.package", {alias = "core_package"}) import("core.project.target") import("lib.detect.find_file") import("private.action.require.impl.actions.test") @@ -100,12 +100,15 @@ end -- fix paths for the precompiled package -- @see https://github.com/xmake-io/xmake/issues/1671 function _fix_paths_for_precompiled_package(package) - local buildhash_pattern = string.rep('%x', 32) -- Matches to path like (string inside brackets is matched): -- /home/user/.xmake[/pacakges/f/foo/9adc96bd69124211aad7dd58a36f02ce/]v1.0 - -- Replaces path string before "packages" with global configured directory. + -- Replaces path string before "packages" with local pacakge install + -- directory. + -- Note: It's possible that package A references files package B, thus we + -- need to match against all possible package install paths. + local buildhash_pattern = string.rep('%x', 32) local match_pattern = "[\\/]packages[\\/]%w[\\/][^\\/]+[\\/][^\\/]+[\\/]" .. buildhash_pattern .. "[\\/]" - local prefix = global.directory() + local prefix = path.directory(core_package.installdir()) local filepaths = {path.join(package:installdir(), "**.cmake|include/**")} for _, filepath in ipairs(filepaths) do |
