diff options
| author | ruki <[email protected]> | 2026-06-06 23:54:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-06-06 23:54:01 +0800 |
| commit | 5d85aa086f8999114a913f2b212b53285614e87c (patch) | |
| tree | 13a4904a5c1901b10872c2d4a86564eee27adcd0 /xmake/core/package/package.lua | |
| parent | 2245e0b6ed0f954aae1dafe225c2b436ae98cfcd (diff) | |
improve package pathpackage
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 2cf65f2a4..2021452d7 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -2958,6 +2958,10 @@ function package.cachedir(opt) local cachedir = package._CACHEDIR if not cachedir then cachedir = os.getenv("XMAKE_PKG_CACHEDIR") or global.get("pkg_cachedir") or path.join(global.cachedir(), "packages") + -- normalize it to ensure all derived paths are consistent, e.g. the user + -- may pass a path with `..` or relative segments via XMAKE_PKG_CACHEDIR. + -- @see https://github.com/xmake-io/xmake/issues/7576 + cachedir = path.normalize(path.absolute(cachedir)) package._CACHEDIR = cachedir end if opt.rootonly then @@ -2981,6 +2985,11 @@ function package.installdir(opt) local installdir = package._INSTALLDIR if not installdir then installdir = os.getenv("XMAKE_PKG_INSTALLDIR") or global.get("pkg_installdir") or path.join(global.directory(), "packages") + -- normalize it to ensure all derived paths are consistent, e.g. the user + -- may pass a path with `..` or relative segments via XMAKE_PKG_INSTALLDIR. + -- otherwise the relocated pkgconfig *.pc files would contain a broken + -- relative prefix. @see https://github.com/xmake-io/xmake/issues/7576 + installdir = path.normalize(path.absolute(installdir)) package._INSTALLDIR = installdir end return installdir |
