summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRedbeanw44602 <[email protected]>2025-09-22 14:58:55 +0800
committerRedbeanw44602 <[email protected]>2025-09-22 14:58:55 +0800
commit5c6b2b30ba26d2f3a870c0b72a77d92d53b9decc (patch)
tree79e134aa84a91babd9424bbebc0ebd7c23382c3f
parentf9bc475a5ba47b954d23d16c71a4b6bbd4cb6ca4 (diff)
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..76e65eb5f 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():gsub("^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)