Introducing USE_SRC and ONLY_FOR_*VER (was: CFR: patch to cleanup usage of SRC_BASE in various ports)

Ganael LAPLANCHE ganael.laplanche at martymac.org
Fri Dec 3 07:59:24 UTC 2010


On Wed, 1 Dec 2010 10:38:10 +0200, Ion-Mihai Tetcu wrote

Hi,

> > It would be interesting to provide something like :
> > 
> > USE_BASE= yes 
> > Which would do the following :
> >  => defines ${SRC_BASE}
> >  => checks for ${SRC_BASE}/sys/Makefile
> >  => provides a standard error msg if not found
> > 
> > or, if set to something other than yes :
> > 
> > USE_BASE= some/file/within/src_base
> >  => defines ${SRC_BASE}
> >  => check for ${SRC_BASE}/some/file/within/src_base
> >  => provides a standard error msg if not found
> > 
> > Thus, we would avoid having the same tests again and again, and be 
> > able to provide more "standard" messages...
> > 
> > What do you think ?
> 
> Yes. It would help tracking some errors on automated build systems.

Following this idea, here is a small patch that provides that
functionality :

http://people.freebsd.org/~martymac/patches/20101203-patch-bsd.kmod.mk.txt

It provides :
- USE_SRC : to be set to "yes" or a space-separated list of files to
check under ${SRC_BASE}
- SRC_BASE : by default /usr/src if ${USE_SRC} is set, can be overridden

A standard message is displayed if kernel sources are missing.

I've also found that the ports that check for presence of kernel sources
also often check for a specific version of FreeBSD, so the patch also
provides :

ONLY_FOR_MINVER / ONLY_FOR_MINVER_REASON : the minimal version of
FreeBSD required to build the port, and a given reason (if any)

ONLY_FOR_MAXVER / ONLY_FOR_MAXVER_REASON : the maximal version of
FreeBSD required to build the port, and a given reason (if any)

Those variables will help us avoid duplicating the same kind of checks
again and again in our ports tree.

Find here :

http://people.freebsd.org/~martymac/patches/20101203-patch-uhso-kmod.txt

an example that shows how those variables could be used
(comms/uhso-kmod). Note that in this example, a change of behaviour is
introduced : the port will now refuse to build if OSVERSION > 800500,
while it was only displaying a warning in the previous version. This
patch to hso-kmod is *not* to be committed, but just a showcase.

Comments welcome,
Best regards,

--
Ganael LAPLANCHE <ganael.laplanche at martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac at FreeBSD.org>, http://www.FreeBSD.org


More information about the freebsd-ports mailing list