Page MenuHomeFreeBSD

Allow tools/build to work for DIRDEPS_BUILD
ClosedPublic

Authored by sjg on Apr 21 2023, 3:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 3:42 AM
Unknown Object (File)
Fri, Nov 8, 11:27 PM
Unknown Object (File)
Fri, Nov 8, 11:21 PM
Unknown Object (File)
Wed, Nov 6, 1:06 AM
Unknown Object (File)
Wed, Nov 6, 12:51 AM
Unknown Object (File)
Wed, Nov 6, 12:51 AM
Unknown Object (File)
Wed, Nov 6, 12:51 AM
Unknown Object (File)
Wed, Nov 6, 12:51 AM
Subscribers
None

Details

Summary

We want to be able to build some host tools for non-FreeBSD hosts
without building more than we need. The DIRDEPS_BUILD lets us
do that.

We use the pseudo MACHINE "host" when building
for the host - deal with that when setting _host_arch.

Stage necessary headers from cross-build/include/common
so that tools like makefs need minimal change.

If .MAKE.OS is Linux we have additional work.

cross-build/include/common/grp.h if SETGROUPENT_IMPL is defined
actually generate the function - so its address can be taken (needed
by pwcache.c)

cross-build/fflags.c needs sys/types.h

cross-build/include/common/sys/cdefs.h gets nullability support

cross-build/mkimg/Makefile remove MK_STAGING=no as that prevents
getting the right -Is during DIRDEPS_BUILD

Sponsored by: Juniper Networks, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sjg requested review of this revision.Apr 21 2023, 3:54 PM
sjg created this revision.

We are unlikely to be using host32 on FreeBSD

Stage common sys/_types.h too

mkimg needs Makefile.depend.options to get libegacy

Why are any of these tools/build/cross-build changes needed? Non-dirdeps does not need these. Fix your dirdeps build to match that case.

Add comments to linux sys/_types.h

Why are any of these tools/build/cross-build changes needed? Non-dirdeps does not need these. Fix your dirdeps build to match that case.

Again, the non-dirdeps build depend on side effects of multiple targets - it doesn't even *have* a standalone target to build any of this.

In D39751#904737, @sjg wrote:

Why are any of these tools/build/cross-build changes needed? Non-dirdeps does not need these. Fix your dirdeps build to match that case.

Again, the non-dirdeps build depend on side effects of multiple targets - it doesn't even *have* a standalone target to build any of this.

But you should make sure to use the same set of headers, compatibility files and compiler flags, then you won't need any changes to source files, just dirdeps build system bits to arrange things to match. The fact that you have to make changes to them points at the dirdeps environment being fundamentally different in ways that it shouldn't be.

Again, the non-dirdeps build depend on side effects of multiple targets - it doesn't even *have* a standalone target to build any of this.

But you should make sure to use the same set of headers, compatibility files and compiler flags, then you won't need any changes to source files, just dirdeps build system bits to arrange things to match. The fact that you have to make changes to them points at the dirdeps environment being fundamentally different in ways that it shouldn't be.

So I just did a buildworld (clean tree) on this Ub20 box, it did not finish, but produced mkimg at least. From which it is clear that tools/build/cross-build/mkimg/Makefile isn't used, as none of the CFLAGS it adds are present and there is no expand_number.o produced. I was surprised at the order of -I's used:
`-I/b/sjg/work/FreeBSD/sb/obj/b/sjg/work/FreeBSD/sb/src/amd64.amd64/tmp/legacy/usr/include
-DHAVE_NBTOOL_CONFIG_H=1
-I/b/sjg/work/FreeBSD/sb/src/tools/build/cross-build/include/common
-I/b/sjg/work/FreeBSD/sb/src/tools/build/cross-build/include/linux
-D_GNU_SOURCE=1`
47 -Wno-* flags might have something to do with it

Also odd tools/build has ${SRCTOP}/include/getopt.h in INCS but it is the getopt.h from libnetbsd that is actually getting used

If you build with -DWITH_DISK_IMAGE_BOOTSTRAP_TOOLS or whatever I called it you will also get makefs (and etdump).

LGTM with an appropriate commit message

This revision is now accepted and ready to land.Apr 22 2023, 7:18 PM
This revision was automatically updated to reflect the committed changes.