[HEADS UP] New world/kernel build options are imminent

From: Ruslan Ermilov <ru_at_FreeBSD.org>
Date: Fri, 17 Mar 2006 18:56:38 +0200
Hi,

For some time now, there has been a need to redesign the model of
build options for world/kernel.  Warner Losh, Poul-Henning Kamp
and I has been working towards the implementation, with some useful
input from Kris Kennaway and John Baldwin.

The new model borrows internal part of implementation from NetBSD
and user API part from FreeBSD ports.  There were several goals:

- The new naming scheme should be uniform, easy to remember.
- There should be a full list of options, with clear defaults
  and dependencies, in one central place.
- API should be stable and detective of user/developer errors.
- make(1) environment should be clean outside world/kernel.

Basically, the new implementation looks like this:

- There are MK_* options that are set either to "no" or "yes".
  Makefiles test them with either ``== "no"'' or ``!= "no"''.
  Users have no direct control over these variables, and attempt
  to set them will result in an error from make(1).  Most options
  default to "yes", but some default to "no".  Options may have
  dependencies.

- Then there are WITH_*/WITHOUT_* user configurable knobs (value
  is not important).  WITH_FOO changes MK_FOO to "yes", WITHOUT_FOO
  changes MK_FOO to "no".  Both WITH_FOO and WITHOUT_FOO can't be
  set at the same time, attempt to do so will result in an error.

- Some options have child MK_*_SUPPORT options.

- Full back compatibility is provided.  The plan is to desupport
  old options in 7.0-RELEASE, but that's an open question.

- Options can be passed on the make(1) command line or in the
  new /etc/src.conf (overrideable).  The reason for the new
  src.conf is so we keep make(1) environment clean from these
  variables outside world/kernel builds (make.conf pollutes
  the environment as it's included by sys.mk).

Now for some examples:

Old way:
    NO_INET6

New way:
    WITH_INET6/WITHOUT_INET6 (user knobs)
    MK_INET6 (defaults to "yes", changed by above two knobs)

    WITH_INET6_SUPPORT/WITHOUT_INET6_SUPPORT (user knobs)
    MK_INET6_SUPPORT (defaults to "yes" unless ${MK_INET6} == "no,
        in which case forced to "no".  If not forced to "no",
        can be changed by above two knobs)

    NO_INET6 is provided for compatibility and sets
        WITHOUT_INET6

Old way:
    YES_HESIOD

New way:
    WITH_HESIOD/WITHOUT_HESIOD (user knobs)
    MK_HESIOD={no|yes} (defaults to "no", changed by above
        two knobs)

Old way:
    .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)

New way:
    .if ${MK_KERBEROS} != "no" (dependencies are tracked)

    NO_CRYPT will set all of MK_CRYPT, MK_KERBEROS, MK_OPENSSL
    and MK_OPENSSH to "no".  NO_PF will set both MK_PF and
    MK_AUTHPF to "no".  This means less work and errors in
    makefiles.

Implementation is at:
	http://people.freebsd.org/~ru/patches/mk.patch

Implementation is in a single bsd.own.mk, should be easy to follow
if you talk "make" language.

Currently passed 75% of "make universe".

To get a list of defaults:

make -n -f bsd.own.mk -dg1 |grep ^MK_

To see how it works:

$ make -n -f share/mk/bsd.own.mk -dg1 |grep ^MK_INET6
MK_INET6_SUPPORT = yes
MK_INET6         = yes
$ make -n -f share/mk/bsd.own.mk -dg1 -DWITHOUT_INET6 |grep ^MK_INET6
MK_INET6_SUPPORT = no
MK_INET6         = no
$ make -n -f share/mk/bsd.own.mk -dg1 -DWITHOUT_INET6_SUPPORT |grep ^MK_INET6 
MK_INET6_SUPPORT = no
MK_INET6         = yes
$ make -n -f share/mk/bsd.own.mk -DWITH_INET6 -DWITHOUT_INET6
"share/mk/bsd.own.mk", line 348: WITH_INET6 and WITHOUT_INET6 shouldn't both be set.
$ make -n -f share/mk/bsd.own.mk -DNO_INET6 
"share/mk/bsd.own.mk", line 261: warning: NO_INET6 is deprecated in favour of WITHOUT_INET6=


Cheers,
-- 
Ruslan Ermilov
ru_at_FreeBSD.org
FreeBSD committer

Received on Fri Mar 17 2006 - 15:56:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:53 UTC