Page MenuHomeFreeBSD

bsdgrep(1): Switch src.opts.mk .include to .sinclude for out-of-tree builds
Needs RevisionPublic

Authored by kevans on Jun 28 2017, 3:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 10:17 PM
Unknown Object (File)
Dec 23 2023, 1:57 PM
Unknown Object (File)
Dec 22 2023, 12:45 PM
Unknown Object (File)
Dec 11 2023, 6:06 AM
Unknown Object (File)
Nov 24 2023, 12:01 PM
Unknown Object (File)
Nov 22 2023, 2:50 PM
Unknown Object (File)
Nov 21 2023, 7:04 PM
Unknown Object (File)
Nov 21 2023, 4:52 PM
Subscribers

Details

Summary

Among other complaints (all MK_* variables will need set, LIBADD is "experimental" for out-of-tree builds), src.opts.mk does not
exist for out-of-source builds.

This is the only real show-stopper for compiling bsdgrep as a port without patching the Makefile on FreeBSD. The
next step of this will be to use the MK_* knobs in a more optional (while meaningful) way.

Test Plan

...build it

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10692
Build 11092: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jun 28 2017, 4:02 PM
kevans edited edge metadata.

Take the further step and sprinkle some helpful expressions throughout the Makefile
to help out-of-tree builds:

  • defined()/!defined() as appropriate to reflect current defaults in -CURRENT
  • Change some redundant MK_BSD_GREP tests to instead check if we're installing as grep
This revision now requires review to proceed.Jul 27 2017, 2:44 AM
This revision is now accepted and ready to land.Jul 27 2017, 3:51 AM

I'd like to see a brief (perhaps 1 or 2 lines) comment explaining the reason for the .sinclude/defined() contortions - i.e., just mention that this will be built out-of-tree as a port.

I'm not fond of this because the base svn version of this file will never actually be built by ports. The port has to have a copy of this file elsewhere that will be used to build. So these modifications could be made to that instead of polluting this with logic that won't ever be used directly. So it easily bitrots or people use this file as a template and create usr.bin/newtool with these patterns that are not needed.

Another solution would be to not modify much of this but to instead distribute your own src.opts.mk with the Makefile that sets the MK_* variables and then you change the .include <bsd.prog.mk> to something like .include <port.prog.mk> that converts LIBADD to LDADD similar to rS320171. You could probably not modify the bsd.prog.mk include line by just tweaking the include paths from the port Makefile to read in your own bsd.prog.mk/src.opts.mk before including the real ones in /usr/share/mk (MAKESYSPATH)

usr.bin/grep/Makefile
7

.if ${MK_BSD_GREP:Uno} == "yes"

or even this near the top:

.if !defined(SRCTOP)
MK_BSD_GREP=no
MK_BSD_GREP_FASTMATCH=no
...
.endif

Then the rest of the defined || changes are not needed.

45

LIBADD is not "experimental" for out-of-tree builds, it is not supported.
If you're referring to rS320171, that is only for partial checkout builds.

So you must use LDADD+= -l here and likewise for other LIBADD.

This revision now requires changes to proceed.Aug 8 2017, 10:11 PM
usr.bin/grep/Makefile
45

Also that commit is not in any of the release branches, so the port would not build on anything but head (and maybe stable/11... I forget if I MFC'd it).

I'm not fond of this because the base svn version of this file will never actually be built by ports. The port has to have a copy of this file elsewhere that will be used to build. So these modifications could be made to that instead of polluting this with logic that won't ever be used directly. So it easily bitrots or people use this file as a template and create usr.bin/newtool with these patterns that are not needed.

I was actually intending to just tar up head/usr.bin/grep and use it as-is to make for stupid easy maintenance of the port going forward, but I'll explore one of your other mentioned routes.

usr.bin/grep/Makefile
45

Well, that's good to know. I actually mis-spoke and was referring to the following warning emitted:

make: "/usr/share/mk/bsd.libnames.mk" line 212: warning: Converting out-of-tree build LIBADDs into LDADD. This is not fully supported.

and changed the wording from 'not fully supported' to 'experimental'

45

Whoops, yeah, the commit you mentioned. =)