diff options
| -rw-r--r-- | xmake/modules/private/action/require/impl/actions/install.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/target/action/install/pkgconfig_importfiles.lua | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index 4d0bada1f..907490a1e 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -78,10 +78,10 @@ function _patch_pkgconfig(package) -- get libs local libs = "" - local base_libdir = path.join(installdir, "lib") for _, linkdir in ipairs(fetchinfo.linkdirs) do - if linkdir ~= base_libdir then - libs = libs .. " -L" .. "${libdir}/" .. path.unix(path.relative(linkdir, base_libdir)) + linkdir = path.unix(path.normalize(linkdir)):replace(installdir, "${exec_prefix}", {plain = true}) + if linkdir ~= "${exec_prefix}/lib" then + libs = libs .. " -L" .. linkdir end end libs = libs .. " -L${libdir}" @@ -94,10 +94,10 @@ function _patch_pkgconfig(package) -- cflags local cflags = "" - local base_includedir = path.join(installdir, "include") for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do - if includedir ~= base_includedir then - cflags = cflags .. " -I" .. "${includedir}/" .. path.unix(path.relative(includedir, base_includedir)) + includedir = path.unix(path.normalize(includedir)):replace(installdir, "${prefix}", {plain = true}) + if includedir ~= "${prefix}/include" then + cflags = cflags .. " -I" .. includedir end end cflags = cflags .. " -I${includedir}" diff --git a/xmake/modules/target/action/install/pkgconfig_importfiles.lua b/xmake/modules/target/action/install/pkgconfig_importfiles.lua index 67ab51b64..aa44263c9 100644 --- a/xmake/modules/target/action/install/pkgconfig_importfiles.lua +++ b/xmake/modules/target/action/install/pkgconfig_importfiles.lua @@ -41,10 +41,10 @@ function main(target, opt) -- get libs local libs = "" - local base_libdir = path.join(installdir, "lib") for _, linkdir in ipairs(linkdirs) do - if linkdir ~= base_libdir then - libs = libs .. " -L" .. "${libdir}/" .. path.unix(path.relative(linkdir, base_libdir)) + linkdir = path.unix(path.normalize(linkdir)):replace(installdir, "${exec_prefix}", {plain = true}) + if linkdir ~= "${exec_prefix}/lib" then + libs = libs .. " -L" .. linkdir end end libs = libs .. " -L${libdir}" @@ -57,10 +57,10 @@ function main(target, opt) -- get cflags local cflags = "" - local base_includedir = path.join(installdir, "include") for _, includedir in ipairs(includedirs) do - if includedir ~= base_includedir then - cflags = cflags .. " -I" .. "${includedir}/" .. path.unix(path.relative(includedir, base_includedir)) + includedir = path.unix(path.normalize(includedir)):replace(installdir, "${prefix}", {plain = true}) + if includedir ~= "${prefix}/include" then + cflags = cflags .. " -I" .. includedir end end cflags = cflags .. " -I${includedir}" |
