kumquat-buildroot/package/i2c-tools/i2c-tools.mk
Yann E. MORIN c19cca0452 package: switch to _CPE_ID_VALID
Now that we document _CPE_ID_VALID, and that it shall be used instead of
setting a default value to one of the other _CPE_ID_* variables, change
all of the existing packages to use it, to avoid any error when we later
extend check-package to validate the sanity ofthe _CPE_ID_* variables.

Mechanical change done within the reference container, running the new
check in check-package, to report the CPE_ID errors:

    $ make check-package 2>/dev/null \
    |awk '{
            split($(1), a, ":"); fname = a[1]
            split($(2), a, "'\''"); val = a[2]
            new_var = $(8); gsub("_CPE_ID_.*", "_CPE_ID_VALID", new_var)
            printf("%s %s %s %s\n", fname, $(8), val, new_var)
    }' \
    |while read fname var val new_var; do
        sed -r -i -e "s/${var}[[:space:]]*=[[:space:]]*${val}/${new_var} = YES/" "${fname}"
    done

    $ git diff -I'CPE_ID_(VENDOR|VALID)'
    [empty]

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-02-11 16:30:06 +01:00

69 lines
2.0 KiB
Makefile

################################################################################
#
# i2c-tools
#
################################################################################
I2C_TOOLS_VERSION = 4.3
I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.xz
I2C_TOOLS_SITE = https://www.kernel.org/pub/software/utils/i2c-tools
I2C_TOOLS_LICENSE = GPL-2.0+, GPL-2.0 (py-smbus), LGPL-2.1+ (libi2c)
I2C_TOOLS_LICENSE_FILES = COPYING COPYING.LGPL README
I2C_TOOLS_CPE_ID_VALID = YES
I2C_TOOLS_MAKE_OPTS = EXTRA=eeprog
I2C_TOOLS_INSTALL_STAGING = YES
ifeq ($(BR2_PACKAGE_PYTHON3),y)
I2C_TOOLS_DEPENDENCIES += host-python-setuptools python3
endif
ifeq ($(BR2_STATIC_LIBS),y)
I2C_TOOLS_MAKE_OPTS += BUILD_DYNAMIC_LIB=0 USE_STATIC_LIB=1
endif
ifeq ($(BR2_SHARED_LIBS),y)
I2C_TOOLS_MAKE_OPTS += BUILD_STATIC_LIB=0
endif
# Build/install steps mirror the distutil python package type in the python package
# infrastructure
ifeq ($(BR2_PACKAGE_PYTHON3),y)
# BASE_ENV taken from PKG_PYTHON_SETUPTOOLS_ENV in package/pkg-python.mk
I2C_TOOLS_PYTHON_BASE_ENV = \
$(PKG_PYTHON_SETUPTOOLS_ENV) \
CFLAGS="$(TARGET_CFLAGS) -I../include"
define I2C_TOOLS_BUILD_PYSMBUS
(cd $(@D)/py-smbus; \
$(I2C_TOOLS_PYTHON_BASE_ENV) \
$(HOST_DIR)/bin/python setup.py build)
endef
define I2C_TOOLS_INSTALL_PYSMBUS
(cd $(@D)/py-smbus; \
$(I2C_TOOLS_PYTHON_BASE_ENV) \
$(HOST_DIR)/bin/python setup.py install \
$(PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS) \
--root=$(TARGET_DIR))
endef
endif # BR2_PACKAGE_PYTHON3
define I2C_TOOLS_BUILD_CMDS
$(MAKE) $(TARGET_CONFIGURE_OPTS) $(I2C_TOOLS_MAKE_OPTS) -C $(@D)
$(I2C_TOOLS_BUILD_PYSMBUS)
endef
define I2C_TOOLS_INSTALL_TARGET_CMDS
$(MAKE) $(TARGET_CONFIGURE_OPTS) $(I2C_TOOLS_MAKE_OPTS) \
DESTDIR="$(TARGET_DIR)" PREFIX=/usr -C $(@D) install
$(I2C_TOOLS_INSTALL_PYSMBUS)
endef
define I2C_TOOLS_INSTALL_STAGING_CMDS
$(MAKE) $(TARGET_CONFIGURE_OPTS) $(I2C_TOOLS_MAKE_OPTS) \
DESTDIR="$(STAGING_DIR)" PREFIX=/usr -C $(@D) install
endef
$(eval $(generic-package))