Again, flavors or options?

Shane Ambler FreeBSD at ShaneWare.Biz
Thu Dec 21 07:26:31 UTC 2017


On 21/12/2017 16:35, Freddie Cash wrote:
> On Dec 20, 2017 6:16 PM, "Yuri" <yuri at rawbw.com> wrote:
> 
> I have the port for the digital currency. It has 3 parts that install
> non-intersecting file sets: daemon, cli, qt-ui. The commonality: same
> repository, same build options, same license, mostly same port options.
> 
> I am attracted to the idea to use flavors to let users choose which part do
> they want: FLAVORS=default daemon qt cli

As I said in my first answer, flavours changes the dependencies not the
options of the port, eg a flavour using py27 another using py36

I don't think there is a way to have different options enabled for
different flavours, each flavour will use the same options.

Until we have the ability to break a single port into multiple packages
that can be installed separately, you either have options for each item
or a different port for each. So you could make the daemon and cli
enabled as default, which will be available in the standard repos, then
the qt-gui as an option the user needs to enable and build themselves.

To simplify maintaining multiple related ports, you can use the same
Makefile for each by setting up the others as slave ports, see 5.10 of
the porters handbook. By setting a variable in the slave, you can use
logic tests to control what varies for each port in the one Makefile.

> "default" will install all of them, others will install individual parts.
> Option list will be slightly different for each flavor.
> 
> One alternative: only have port options. Then some options can't be
> conditional on which parts are built.

You have several options to logically control what options are enabled.
You can find several possibilities in 5.13 of the porters handbook.

from 5.13.3.7 -
OPT1_IMPLIES= OPT2
# this means when you enable OPT1, OPT2 will automatically be turned on

from 5.13.3.8 -
OPT1_PREVENTS= OPT2
# this prevents enabling OPT1 and OPT2 at the same time

You can use the standard logic available in any Makefile -

.if ${PORT_OPTIONS:MOPT1} && ${PORT_OPTIONS:MOPT2}
# make adjustments for both options being on
.endif

You also get custom build targets based on options (5.13.3.12) -
post-patch-OPT1-on:
    ${REINPLACE_CMD} -e 's|opt2=True|opt2=False|' ${WRKSRC}/configure


-- 
FreeBSD - the place to B...Software Developing

Shane Ambler



More information about the freebsd-ports mailing list