Page MenuHomeFreeBSD

Remove MAKEFLAGS and MAKESYSPATH from env passed to PORTS_MODULES
ClosedPublic

Authored by jah on Nov 12 2017, 3:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 2:34 PM
Unknown Object (File)
Dec 20 2023, 12:26 AM
Unknown Object (File)
Nov 28 2023, 11:26 PM
Unknown Object (File)
Nov 1 2023, 12:39 AM
Unknown Object (File)
Sep 9 2023, 11:53 PM
Unknown Object (File)
Sep 6 2023, 6:07 AM
Unknown Object (File)
Sep 6 2023, 6:06 AM
Unknown Object (File)
Sep 6 2023, 6:04 AM
Subscribers

Details

Summary

Background: I have a port (multimedia/cx88) that installs some kmods, which I
like to rebuild during the PORTS_MODULES step. That port also installs a userspace
utility that is built using bsd.prog.mk with libs specified in LDADD. As such,
rebuilding it during PORTS_MODULES has been broken since 11.0 because MAKESYSPATH/
MAKEFLAGS (-m) point to SRCROOT, which consumes src.libnames.mk and results in an
error like "These libraries should be LIBADD+=foo rather than DPADD/LDADD+=-lfoo".

I'm not at all an expert on the build system, so this change may be the wrong thing
to do for a variety of reasons. The real answer might just be something like
"split the port up" or "don't use LDADD there". But as long as bsd.kmod.mk remains
a thin wrapper that respects SYSDIR, it seems like this approach could allow
PORTS_MODULES to work for a broader variety of ports. It would result in kmods
building against the makefiles in the updated src tree through SYSDIR, while any
remaining piece of the port would build against the installed ports/build system,
which (I think?) is what one would want in an upgrade scenario.

So I thought I'd at least post it so you guys could poke holes in it:)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I think removing MAKEFLAGS may be too much. I think we can just add MAKESYSPATH=/usr/share/mk to the environment and should also set _WITHOUT_SRCCONF=yes.

I think removing MAKEFLAGS may be too much. I think we can just add MAKESYSPATH=/usr/share/mk to the environment and should also set _WITHOUT_SRCCONF=yes.

I don't think that'll work: since src.libnames.mk is a .sinclude from bsd.libnames.mk, any presence of '-m ${SRCTOP}/share/mk' in MAKEFLAGS will cause it to be consumed, regardless of what else is in MAKEFLAGS or MAKESYSPATH. FWIW, here's what's in MAKEFLAGS during the PORTS_MODULES step on my machine (11-current):

"-m /usr/src/share/mk -m /usr/src/share/mk -D NO_MODULES_OBJ .MAKE.LEVEL.ENV=MAKELEVEL KERNEL=kernel TARGET=amd64 TARGET_ARCH=amd64"

As for _WITHOUT_SRCCONF, shouldn't we already be ok there? It's defined unconditionally by bsd.port.mk. Having it set in the env for the full PORTS_MODULES step seems like it would cause problems for any kmod or other steps of the port build that would need to consume src.conf. It definitely caused some strange errors when I tried it just now.

We could also kill off just the -m directives in MAKEFLAGS. A one-liner like this should do it:

${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / -m_/g:tw:N-m_*}

Remove only -m directives from MAKEFLAGS

This revision is now accepted and ready to land.Jan 24 2018, 8:44 PM
This revision was automatically updated to reflect the committed changes.