From nobody Mon Sep 6 08:16:12 2021 X-Original-To: freebsd-ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F0F3F1798B08 for ; Mon, 6 Sep 2021 08:16:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H31SZ6XMpz3PFc; Mon, 6 Sep 2021 08:16:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from aniel.nours.eu (nours.eu [IPv6:2001:41d0:8:3a4d::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id A9AC9201FF; Mon, 6 Sep 2021 08:16:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 4148A49FF5; Mon, 6 Sep 2021 10:16:12 +0200 (CEST) Date: Mon, 6 Sep 2021 10:16:12 +0200 From: Baptiste Daroussin To: Mel Pilgrim Cc: freebsd-ports@freebsd.org Subject: Re: Why no flavor_USES helper? Message-ID: <20210906081612.rxo2os7dvx5mkvz6@aniel.nours.eu> References: <8982e300-8b04-f31a-9c49-43d0dd428b38@bluerosetech.com> List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8982e300-8b04-f31a-9c49-43d0dd428b38@bluerosetech.com> X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N 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