Re: Why no flavor_USES helper?

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 6 Sep 2021 10:16:12 +0200
On Sun, Sep 05, 2021 at 10:39:29AM -0700, Mel Pilgrim wrote:
> The flavors helpers like flavor_RUN_DEPENDS are super useful, but I need to
> modify USES based on flavor, and find that there is no helper for it.  That
> is, I'd like to be able to do this:
> 
> flavor1_USES=	alice
> flavor2_USES=	bob
> 
> Instead of:
> 
> .if ${FLAVOR} == flavor1
> USES+=	alice
> .elif ${FLAVOR} == flavor2
> USES+=	bob
> .endif
> 
> At a glance, it looks like all that's needed is adding USES to
> _FLAVOR_HELPERS_APPEND[1]. What am I missing?
> 
> 1: Mk/bsd.port.mk, line 1525 as of bed4073e0
> 

Besause USES are loader 100 lines earlier, meaning only USES are already
processed when we expand the helper.

Without getting to far in the technical details, USES and FLAVORS are basically
expanded at the moment, in pre and post section, meaning one had to decide
either we should allow USES to define flavors, or we should allow USES helpers.

Given cases like python it was decided allowing USES to define flavors would be
more useful.

Best regards,
Bapt
Received on Mon Sep 06 2021 - 08:16:12 UTC

Original text of this message