Subject: Re: bmake and bootstrap and own.mk and MKCONF
To: Jeremy C. Reed <reed@reedmedia.net>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-pkg
Date: 09/22/2005 20:31:59
On Thu, 22 Sep 2005 17:24:12 -0700 (PDT), "Jeremy C. Reed" writes:
>My next problem is that I didn't have any sys.mk created. I need it. The 
>system's native /usr/share/mk/sys.mk defines X11BASE early so it doesn't 
>get set later:

>X11BASE         ?=      /usr/X11R6

Yes, this was a long standing bug in freebsd, bsd.own.mk was included
by sys.mk so all the ?= might as well have been = since there is no
opportunity to pre-define.


>So this is what I have in bootstrap script:

I'm curious why simply running install-mk doesn't work for you?
Especially if you DTRT with Generic.sys.mk

>if [ ! -f $prefix/share/mk/sys.mk ]; then
>   ln -s Generic.sys.mk $prefix/share/mk/sys.mk
>fi
>
>I create the symlink above because my $opsys.sys.mk does not exist.

Don't you want to always use Generic.sys.mk?
and put an OS specific sys.mk in a $OS subdir?  That way your tree
"just works" when mounted via NFS on multiple systems.

>But for some reason my /usr/share/mk/sys.mk is still being used. I assume 
>the following is the order:
>
>pkgbox# strings `which bmake` | grep /mk:
>/usr/pkg/share/mk:/usr/share/mk:/usr/local/share/mk:/opt/share/mk

If you have a sys.mk in /usr/pkg/share/mk then you should be ok.
What is being found in /usr/share/mk that is causing you problems?

Setting up the environment correctly/consistently is better than
hacking make.

>See my problem here in the pkgsrc/x11/xorg-libs directory (X11_TYPE is 
>xorg):
>
>pkgbox# mv /usr/share/mk/sys.mk /usr/share/mk/sys.mk-moved
>
>pkgbox# bmake show-var VARNAME=unix
>We run DragonFly.
>
>pkgbox# bmake show-var VARNAME=X11BASE
>/usr/pkg/xorg
>
>pkgbox# mv /usr/share/mk/sys.mk-moved /usr/share/mk/sys.mk
>
>pkgbox# bmake show-var VARNAME=X11BASE
>/usr/X11R6

If /usr/pkg/share/mk contains sys.mk and everything else you need
anything else in the pre-compiled sys-path shouldn't matter.

The only way you have a hope of pkgsrc behaving consistently is if you
have a fully defined set of *.mk in pkg/share/mk or pkgsrc/mk and run bmake
with suitable -m args (or use a shell wrapper to set MAKESYSPATH).

Since pkgsrc is just one project and /usr/pkg/bin/bmake should be
useful for more, pkgsrc should run bmake with -m (or via a wrapper)
otherwise /usr/pkg/share/mk and pkgsrc/mk need to be the same which
may not be what everyone wants.

--sjg