diff mbox series

[meta-oe,2/2] cpufrequtils: fix do_install, drop the toolchain patch, add nls PACKAGECONFIG

Message ID 20260814-cpufrequtils-v1-2-5ac5e77bf5ff@gmail.com
State New
Headers show
Series cpufrequtils: fix latent do_install build failure | expand

Commit Message

Alex Kiernan Aug. 14, 2026, 2:29 p.m. UTC
do_install ran make with -e, which gives the environment precedence over
the makefile's own assignments. Every CPPFLAGS and CFLAGS use in the
makefile is +=, seeded from the environment, so -e discarded all of the
makefile's additions: the CPPFLAGS += defining PACKAGE, PACKAGE_BUGREPORT
and VERSION, the conditional -DNLS, -pipe and $(WARNINGS). utils/info.c
and utils/set.c then failed to build with "'PACKAGE' undeclared" while
relinking cpufreq-info and cpufreq-set, which install: pulls in via all:.
Dropping -e also makes do_install and do_compile agree on flags, where
the install-time relink previously produced binaries built differently
from the ones do_compile had made.

-e predates 0001-dont-unset-cflags.patch, back when the makefile assigned
CC/LD/AR/STRIP/RANLIB absolutely and -e was the only way to override them.
That patch is dropped here in favour of setting CC on the make command
line, which outranks a makefile assignment without needing a patch at all.
CC is the only one of those variables the makefile ever references: LD, AR
and RANLIB are assigned but never used, and STRIP only feeds STRIPCMD,
which the recipe already overrides. The patch had carried
Upstream-Status: Pending since 2012 against a project whose last commit
was in 2011.

NLS becomes a PACKAGECONFIG rather than an inline USE_NLS expression so it
can be set per-recipe, defaulting from USE_NLS so existing behaviour is
unchanged. gettext-native is named explicitly because gettext.bbclass
substitutes gettext-minimal-native when USE_NLS is no, and that has no
xgettext/msgmerge for the update-gmo target this enables. The gettext
inherit becomes conditional on the same PACKAGECONFIG, deferred because it
reads a value that does not exist yet at that point in the parse.

AI-Generated: Claude Opus 5 (Claude Code)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
 .../cpufrequtils/0001-dont-unset-cflags.patch      | 32 ----------------------
 .../recipes-bsp/cpufrequtils/cpufrequtils_008.bb   | 17 +++++-------
 2 files changed, 7 insertions(+), 42 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils/0001-dont-unset-cflags.patch b/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils/0001-dont-unset-cflags.patch
deleted file mode 100644
index 72f480100030..000000000000
--- a/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils/0001-dont-unset-cflags.patch
+++ /dev/null
@@ -1,32 +0,0 @@ 
-Upstream-Status: Pending
-
---- git.old/Makefile	2012-04-17 13:29:46.280435340 +0200
-+++ git/Makefile	2012-04-17 13:31:13.664433470 +0200
-@@ -77,17 +77,7 @@ INSTALL_PROGRAM = ${INSTALL}
- INSTALL_DATA  = ${INSTALL} -m 644
- INSTALL_SCRIPT = ${INSTALL_PROGRAM}
- 
--# If you are running a cross compiler, you may want to set this
--# to something more interesting, like "arm-linux-".  If you want
--# to compile vs uClibc, that can be done here as well.
--CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
--CC = $(CROSS)gcc
--LD = $(CROSS)gcc
--AR = $(CROSS)ar
--STRIP = $(CROSS)strip
--RANLIB = $(CROSS)ranlib
--HOSTCC = gcc
--
-+HOSTCC = $(BUILD_CC)
- 
- # Now we set up the build system
- #
-@@ -95,7 +85,7 @@ HOSTCC = gcc
- # set up PWD so that older versions of make will work with our build.
- PWD = $(shell pwd)
- 
--export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
-+export CFLAGS LDFLAGS LIB_OBJS
- 
- # check if compiler option is supported
- cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
diff --git a/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb b/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb
index 4df67ca3eaec..0db24a82c3e1 100644
--- a/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb
+++ b/meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb
@@ -1,6 +1,6 @@ 
 DESCRIPTION = "To make access to the Linux kernel cpufreq subsystem easier for users and cpufreq userspace tools, a cpufrequtils package was created"
 
-inherit gettext
+inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'nls', 'gettext', '', d)}
 
 DEPENDS = "libtool-cross"
 
@@ -10,27 +10,24 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 SRCREV = "a2f0c39d5f21596bb9f5223e895c0ff210b265d0"
 PV .= "+git"
 
-SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git;branch=master;protocol=https \
-           file://0001-dont-unset-cflags.patch \
-"
+SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git;branch=master;protocol=https"
 
 # Upstream repo does not tag
 UPSTREAM_CHECK_COMMITS = "1"
 
-EXTRA_OEMAKE:append = " ${@['', 'NLS=false']['${USE_NLS}' == 'no']} "
-
-
-
 TARGET_CC_ARCH += "${LDFLAGS}"
 
-EXTRA_OEMAKE = "V=1 CROSS=${TARGET_PREFIX} STRIPCMD=echo 'CP=cp'"
+PACKAGECONFIG ??= "${@oe.utils.conditional('USE_NLS', 'no', '', 'nls', d)}"
+PACKAGECONFIG[nls] = "NLS=true,NLS=false,gettext-native"
+
+EXTRA_OEMAKE = "V=1 CROSS=${TARGET_PREFIX} CC='${CC}' STRIPCMD=echo 'CP=cp' ${PACKAGECONFIG_CONFARGS}"
 
 do_compile() {
 	oe_runmake
 }
 
 do_install() {
-	oe_runmake -e install DESTDIR=${D}
+	oe_runmake install DESTDIR=${D}
 	rm -f ${D}${libdir}/libcpufreq.so.0 ${D}${libdir}/libcpufreq.so
 	ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so.0
 	ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so