config BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
	bool
	default y
	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64 \
		|| BR2_powerpc64le || BR2_mipsel || BR2_mips64el \
		|| BR2_RISCV_64

config BR2_PACKAGE_EFIVAR
	bool "efivar"
	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
	depends on !BR2_STATIC_LIBS # dlfcn.h
	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 # linux/nvme.h
	depends on BR2_TOOLCHAIN_HAS_THREADS
	# linux/nvme.h has been renamed to linux/nvme_ioctl.h since 4.4,
	# and the efivar source handles that situation. However, some
	# Sourcery CodeBench toolchains use 4.4 kernel headers but they
	# don't have that header file renamed, and that is causing build
	# failures. So, prevent this package to be built using those
	# toolchains.
	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
	help
	  Tools and libraries to manipulate EFI variables

	  https://github.com/rhboot/efivar

comment "efivar needs a toolchain w/ dynamic library, threads, headers >= 3.12, gcc >= 4.9"
	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \
		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
