kernel.bbclass: make pkg-config variables globally exported in the class
PATCH 1/1 kernel.bbclass: make pkg-config variables globally exported in the class
Rather than repeatedly exporting the variables in the different functions, make them globally exported in the class for better maintainability.
This is essentially "v3" discussed in [1].
[1] https://lore.kernel.org/openembedded-core/[email protected]/T/#t
--- meta/classes-recipe/kernel.bbclass | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
meta/classes-recipe/kernel.bbclass +7 -13
@@ -239,9 +239,15 @@ KERNEL_EXTRA_ARGS ?= "" EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"' EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"' EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"' -# Only for newer kernels (5.19+), native pkg-config variables are set for older kernels when building kernel and modules +# Only for newer kernels (5.19+), native pkg-config variables are set below for older kernels EXTRA_OEMAKE += ' HOSTPKG_CONFIG="pkg-config-native"' +# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) +export PKG_CONFIG_DIR = "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" +export PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig" +export PKG_CONFIG_LIBDIR = "${PKG_CONFIG_DIR}" +export PKG_CONFIG_SYSROOT_DIR = "" + KERNEL_ALT_IMAGETYPE ??= "" copy_initramfs() {
@@ -352,12 +358,6 @@ KERNEL_DEBUG_TIMESTAMPS ??= "0" kernel_do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE - # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) - export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig" - export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR" - export PKG_CONFIG_SYSROOT_DIR="" - if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not # be set....
@@ -408,12 +408,6 @@ addtask transform_kernel after do_compile before do_install do_compile_kernelmodules() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE - # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) - export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig" - export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR" - export PKG_CONFIG_SYSROOT_DIR="" - if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not # be set....
Signature · 1 line
2.34.1
Quoted 57 lines · Munehisa Kamata via lists.openembedded.org
Rather than repeatedly exporting the variables in the different functions, make them globally exported in the class for better maintainability.
This is essentially "v3" discussed in [1].
[1] https://lore.kernel.org/openembedded-core/[email protected]/T/#t
Signed-off-by Munehisa Kamata <[email protected]>---
meta/classes-recipe/kernel.bbclass | 20 +++++++-------------1 file changed, 7 insertions(+), 13 deletions(-)meta/classes-recipe/kernel.bbclass +0
-0@@ -239,9 +239,15 @@ KERNEL_EXTRA_ARGS ?= ""EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"'
EXTRA_OEMAKE+= ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"'EXTRA_OEMAKE+= ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"'meta/classes-recipe/kernel.bbclass +1
-1-# Only for newer kernels (5.19+), native pkg-config variables are set for older kernels when building kernel and modules +# Only for newer kernels (5.19+), native pkg-config variables are set below for older kernelsEXTRA_OEMAKE += ' HOSTPKG_CONFIG="pkg-config-native"'
meta/classes-recipe/kernel.bbclass +6
-0+# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) +export PKG_CONFIG_DIR = "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" +export PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig" +export PKG_CONFIG_LIBDIR = "${PKG_CONFIG_DIR}" +export PKG_CONFIG_SYSROOT_DIR = "" +KERNEL_ALT_IMAGETYPE ??= ""
copy_initramfs() {meta/classes-recipe/kernel.bbclass +0
-0@@ -352,12 +358,6 @@ KERNEL_DEBUG_TIMESTAMPS ??= "0" kernel_do_compile() {unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
meta/classes-recipe/kernel.bbclass +0
-6- # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) - export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig" - export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR" - export PKG_CONFIG_SYSROOT_DIR="" -if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not # be set....meta/classes-recipe/kernel.bbclass +0
-0@@ -408,12 +408,6 @@ addtask transform_kernel after do_compile before do_install do_compile_kernelmodules() {unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
meta/classes-recipe/kernel.bbclass +0
-6- # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) - export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig" - export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR" - export PKG_CONFIG_SYSROOT_DIR="" -if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
Quoted 3 lines
# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not # be set....
I'm really not keen on this. global exports are painful to remove later as you can't really tell when they need to be set (e.g during do_configure). Given that these reverse our usual usage of pkg-config too, I really don't want to be doing this at all.
Until we have a minimum kernel version which has saner pkg-config usage I appreciate we have to retain this but I do want to make it easier to remove later.
I'm therefore leaning against doing this.
Cheers,
Richard
Hi Richard,
Quoted 11 lines · Richard Purdie
I'm really not keen on this. global exports are painful to remove later as you can't really tell when they need to be set (e.g during
do_configure). Given that these reverse our usual usage of pkg-config too, I really don't want to be doing this at all.Until we have a minimum kernel version which has saner pkg-config usage I appreciate we have to retain this but I do want to make it easier to remove later.
I'm therefore leaning against doing this.
That's a fair point. As the original issue has already been solved and I meant this was a minor improvement, I don't insist on it.
Thanks,
Munehisa
Quoted 6 lines
Cheers,
Richard