summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-23 23:26:43 +0800
committerGitHub <[email protected]>2025-09-23 23:26:43 +0800
commit964d19fc99ab8ee4ff983ee6bf33685fc8b5117d (patch)
tree48c96aa1f1d29371400e73c80f894be920c1688f
parent90b47a2aa5a9f102762b9a7f0123b5dc463d7f71 (diff)
parenta5bcafadecc816b0becc89f627151bf4aa6b49df (diff)
Merge pull request #6844 from Redbeanw44602/fix-pkgconfig-autogen-v
Fix version in auto-generated .pc.
-rw-r--r--xmake/modules/private/action/require/impl/actions/install.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua
index 27e30d77e..d7310149a 100644
--- a/xmake/modules/private/action/require/impl/actions/install.lua
+++ b/xmake/modules/private/action/require/impl/actions/install.lua
@@ -108,6 +108,8 @@ function _patch_pkgconfig(package)
-- patch a *.pc file
local file = io.open(pcfile, 'w')
if file then
+ -- @see https://github.com/xmake-io/xmake-repo/pull/8165#discussion_r2366249416
+ local version = package:version_str():ltrim("v")
file:print("# Generated by Xmake")
file:print("prefix=%s", "${pcfiledir}/" .. path.unix(path.relative(installdir, path.directory(pcfile))))
file:print("exec_prefix=${prefix}")
@@ -116,7 +118,7 @@ function _patch_pkgconfig(package)
file:print("")
file:print("Name: %s", package:name())
file:print("Description: %s", package:description())
- file:print("Version: %s", package:version_str())
+ file:print("Version: %s", version)
file:print("Libs: %s", libs)
file:print("Libs.private: ")
file:print("Cflags: %s", cflags)