[PATCH v2] tools: lib: thermal: Correct CFLAGS and LDFLAGS in pkg-config template

Romain Gantois posted 1 patch 1 month ago
tools/lib/thermal/libthermal.pc.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v2] tools: lib: thermal: Correct CFLAGS and LDFLAGS in pkg-config template
Posted by Romain Gantois 1 month ago
There are two issues with the current pkg-config template.

Firstly, the -lthermal linker flag is missing.

Secondly, the libnl3 include directory compiler flag references "include"
instead of "includedir", which leads to an unexpanded variable when
pkg-config is called. Moreover, it isn't necessary to add this flag here,
since the "Requires" field will cause pkg-config do add it automatically.
The same logic applies to the LDFLAGS for libnl3.

Add the missing -lthermal flag and remove unnecessary and incorrect libnl3
flags.

Fixes: 47c4b0de080a ("tools/lib/thermal: Add a thermal library")
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
Changes in v2:
- Removed unnecessary libnl3 flags.
- Added "Fixes" tag.
- Link to v1: https://lore.kernel.org/r/20251226-libthermal-pkgconfig-v1-1-3406de5ca8ea@bootlin.com
---
 tools/lib/thermal/libthermal.pc.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/thermal/libthermal.pc.template b/tools/lib/thermal/libthermal.pc.template
index ac24d0ab17f5..b984c5ecd20a 100644
--- a/tools/lib/thermal/libthermal.pc.template
+++ b/tools/lib/thermal/libthermal.pc.template
@@ -8,5 +8,5 @@ Name: libthermal
 Description: thermal library
 Requires: libnl-3.0 libnl-genl-3.0
 Version: @VERSION@
-Libs: -L${libdir} -lnl-genl-3 -lnl-3
-Cflags: -I${includedir} -I${include}/libnl3
+Libs: -L${libdir} -lthermal
+Cflags: -I${includedir}

---
base-commit: d113735421da322ea144c9778c433de6ff6bc57b
change-id: 20251226-libthermal-pkgconfig-23259b10478a

Best regards,
-- 
Romain Gantois <romain.gantois@bootlin.com>
Re: [PATCH v2] tools: lib: thermal: Correct CFLAGS and LDFLAGS in pkg-config template
Posted by Rafael J. Wysocki 4 weeks, 1 day ago
On Mon, Jan 5, 2026 at 1:31 PM Romain Gantois
<romain.gantois@bootlin.com> wrote:
>
> There are two issues with the current pkg-config template.
>
> Firstly, the -lthermal linker flag is missing.
>
> Secondly, the libnl3 include directory compiler flag references "include"
> instead of "includedir", which leads to an unexpanded variable when
> pkg-config is called. Moreover, it isn't necessary to add this flag here,
> since the "Requires" field will cause pkg-config do add it automatically.
> The same logic applies to the LDFLAGS for libnl3.
>
> Add the missing -lthermal flag and remove unnecessary and incorrect libnl3
> flags.
>
> Fixes: 47c4b0de080a ("tools/lib/thermal: Add a thermal library")
> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> ---
> Changes in v2:
> - Removed unnecessary libnl3 flags.
> - Added "Fixes" tag.
> - Link to v1: https://lore.kernel.org/r/20251226-libthermal-pkgconfig-v1-1-3406de5ca8ea@bootlin.com
> ---
>  tools/lib/thermal/libthermal.pc.template | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/thermal/libthermal.pc.template b/tools/lib/thermal/libthermal.pc.template
> index ac24d0ab17f5..b984c5ecd20a 100644
> --- a/tools/lib/thermal/libthermal.pc.template
> +++ b/tools/lib/thermal/libthermal.pc.template
> @@ -8,5 +8,5 @@ Name: libthermal
>  Description: thermal library
>  Requires: libnl-3.0 libnl-genl-3.0
>  Version: @VERSION@
> -Libs: -L${libdir} -lnl-genl-3 -lnl-3
> -Cflags: -I${includedir} -I${include}/libnl3
> +Libs: -L${libdir} -lthermal
> +Cflags: -I${includedir}
>
> ---

Applied as 6.20 material, thanks!