Warren Block wrote at 00:22 -0700 on Jan 12, 2013:
 > On Fri, 11 Jan 2013, John Hein wrote:
 > > It's in /usr/share/mk/bsd.own.mk (which is included early by make(1) -
 > > due to bsd.own.mk inclusion in /usr/shar/mk/bsd.port.mk)...
 > >
 > > ..if defined(MODULES_WITH_WORLD)
 > > KMODDIR?=       /boot/modules
 > > ..else
 > > KMODDIR?=       /boot/kernel
 > > ..endif
 > >
 > > And from make.conf(5) ...
 > >
 > >     MODULES_WITH_WORLD
 > >                   (bool) Set to build modules with the system instead of 
 > > the
 > >                   kernel.
 > >
 > > Not the best named knob for the KMODDIR adjustment.
 > 
 > The explanation makes no sense to me.  It doesn't really mean build, 
 > it's a choice of where the new modules will be installed.
 > 
 >    MODULES_WITH_WORLD
 >      (bool) Set to install modules in the /boot/modules directory.
 >          Unset to install modules in the /boot/kernel directory along
 >      with the FreeBSD kernel.
 > 
 > It really should be inverted and the variable named MODULES_WITH_KERNEL.

Well, that's not the only place it's used (see the rest of my email).
But, yes, the name (and explanation) are misleading if you are
considering installation location.  The current usage of that knob is
used to determine _when_ the modules are built as much as where they
go (that's probably why the comment uses 'build').  Using it for ports
builds probably isn't right since it was invented to be used during
buildworld/buildkernel/install*.

Ports really wants to have its own default KMODDIR, but it's made
difficult since its current default value defined so early... putting
a default 'KMODDIR?= /boot/modules' at the top of bsd.port.mk is too
late.  Using .undef KMODDIR in b.p.m. seems hacky, but it [mostly]
works without having to resort to using knobs intended for the
buildworld system (and avoids having to set it globally in
/etc/make.conf which would affect buildworld/kernel).  It also allows
command line or environment override.

Index: bsd.port.mk
=================================--- bsd.port.mk        (revision 310372)
+++ bsd.port.mk (working copy)
@@ -1140,6 +1140,8 @@
 # by individual Makefiles or local system make configuration.
 PORTSDIR?=             /usr/ports
 LOCALBASE?=            /usr/local
+.undef KMODDIR
+KMODDIR?=              /boot/modules
 LINUXBASE?=            /compat/linux
 DISTDIR?=              ${PORTSDIR}/distfiles
 _DISTDIR?=             ${DISTDIR}/${DIST_SUBDIR}

However, it prevents the user from being able to define it in
/etc/make.conf if he wanted to.  That's bad for POLA.

This patch to bsd.own.mk would work in all the above cases and allow
all but a few individual ports to stop defining KMODDIR...

--- /usr/share/mk/bsd.own.mk.orig       2012-05-04 09:03:42.000000000 -0600
+++ /usr/share/mk/bsd.own.mk    2013-01-14 22:43:37.000000000 -0700
@@ -126,7 +126,7 @@
 BINMODE?=      555
 NOBINMODE?=    444
 
-.if defined(MODULES_WITH_WORLD)
+.if defined(BSDPORTMK) || defined(MODULES_WITH_WORLD)
 KMODDIR?=      /boot/modules
 .else
 KMODDIR?=      /boot/kernel


_______________________________________________
freebsd-emulation@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "freebsd-emulation-unsubscr...@freebsd.org"

Reply via email to