buildroot/package/pkg-virtual.mk
Yann E. MORIN 1e0d06cf20 core/pkg-virtual: fix fallout of host-dependecy no auto-derivation
In 4bdb067 (infra: remove auto derivation of host dependencies), the
dependencies of host packages are no longer inherited from the
dependencies of the corresponding target package.

However, for virtual packages, there is no provider declared for the
host variant, so we end up with no dependency for the host variant
of virtual packages.

This causes host-luainterpreter to have no provider, and thus breaks the
build of host-luarocks.

To fix that, we use the host variant of the provider of the target
variant of the virtual package to define the provider of the host variant
of the virtual package (re-read it, it's correct!).

Fixes:
    http://autobuild.buildroot.org/results/d8b/d8baf44b1e2f8e0e32c86558fc3e0694235b512a
    http://autobuild.buildroot.org/results/59a/59ac0fe84e5c76a590c698a1483b2a3ae26e1dcf
    http://autobuild.buildroot.org/results/203/2039f24731d8e14cde24c613b487b3db530dd238

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-07-03 13:19:05 +02:00

67 lines
2.6 KiB
Makefile

################################################################################
# Virtual package infrastructure
#
# This file implements an infrastructure that eases development of
# package .mk files for virtual packages. It should be used for all
# virtual packages.
#
# See the Buildroot documentation for details on the usage of this
# infrastructure
#
# In terms of implementation, this virtual infrastructure requires
# the .mk file to only call the 'virtual-package' macro.
#
################################################################################
################################################################################
# inner-virtual-package -- defines the dependency rules of the virtual
# package against its provider.
#
# argument 1 is the lowercase package name
# argument 2 is the uppercase package name, including a HOST_ prefix
# for host packages
# argument 3 is the uppercase package name, without the HOST_ prefix
# for host packages
# argument 4 is the type (target or host)
################################################################################
# Note: putting this comment here rather than in the define block, otherwise
# make would try to expand the $(error ...) in the comment, which is not
# really what we want.
# We need to use second-expansion for the $(error ...) call, below,
# so it is not evaluated now, but as part of the generated make code.
define inner-virtual-package
# Ensure the virtual package has an implementation defined.
ifeq ($$(BR2_PACKAGE_HAS_$(2)),y)
ifeq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),)
$$(error No implementation selected for virtual package $(1). Configuration error)
endif
endif
$(2)_IS_VIRTUAL = YES
# Add dependency against the provider
# For a host package, there is no corresponding BR2_PACKAGE_PROVIDES_HOST_FOO,
# so we need to compute it from the target variant.
ifeq ($(4),target)
$(2)_DEPENDENCIES += $$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2)))
else
$(2)_DEPENDENCIES += host-$$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(3)))
endif
# Call the generic package infrastructure to generate the necessary
# make targets
$(call inner-generic-package,$(1),$(2),$(3),$(4))
endef
################################################################################
# virtual-package -- the target generator macro for virtual packages
################################################################################
virtual-package = $(call inner-virtual-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
host-virtual-package = $(call inner-virtual-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)