diff options
| author | Chen Yufei <[email protected]> | 2022-03-25 20:35:02 +0800 |
|---|---|---|
| committer | Chen Yufei <[email protected]> | 2022-03-25 20:35:02 +0800 |
| commit | f36796763f3b2c898759fdfbf9b9b76cd000d116 (patch) | |
| tree | 26174dcb979b30d2da18460b19e487f87899d851 /xmake/modules | |
| parent | e22e43a152856d3899170e7fd627093ccb022ed3 (diff) | |
pkg-config path fix generalize varname=value case.
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/action/require/impl/actions/install.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index 9ed21d8b8..28fbb7994 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -137,7 +137,7 @@ function _fix_path_for_file(file, search_pattern) end if result then result = result:gsub("\\", "/") - vprint("fix path: %s in %s", result, file) + vprint("fix path: %s in %s", whole_value, file) return whole_value:replace(value, result, {plain = true}) end end) @@ -154,18 +154,18 @@ function _fix_paths_for_precompiled_package(package) }, { -- Fix path for pkg-config .pc files. - -- 1. prefix is just a variable name. We rely on variable name convention. + -- 1. `varname=value` defines a variable, which may contain path. -- 2. A package may reference another package with absolute path. -- For example: glog.pc with gflags and unwind enabled contains something like following: - -- Libs: -L/absolute/path/to/gflags/lib -L/absolute/path/to/libunwind/lib ... + -- Libs: -L/absolute/path/to/gflags/lib -L /absolute/path/to/libunwind/lib ... -- So searching for only prefix is not enough. -- 3. If path contains spaces, it should be double quoted. -- If not quoted, spaces should be backslash escaped, which we do - -- not support fix for now. + -- not fix for now. -- For pkg-config behavior for spaces in path, refer to -- https://github.com/golang/go/issues/16455#issuecomment-255900404 file_pattern = {"lib/pkgconfig/**.pc", "share/pkgconfig/**.pc"}, - search_pattern = {"(prefix%s*=%s*(.-)\n)", "(%-[I|L]%s*(%S+))", '("(.-)")'}, + search_pattern = {"([%w_]+%s*=%s*(.-)\n)", "(%-[I|L]%s*(%S+))", '("(.-)")'}, }, } for _, pat in ipairs(patterns) do |
