HomeFreeBSD

Fix native-xtools build to use a proper sysroot.

Description

Fix native-xtools build to use a proper sysroot.

This takes longer but should reliably produce working binaries.
The old version linked against system libraries and headers
which would be a problem if building a native-xtools against
a newer source than the host system. With a proper sysroot made
first this is not a problem.

This also allows:

  • NXBDIRS to be built in parallel
  • NXBDIRS to be installed to NXBDESTDIR in parallel
  • SYSTEM_COMPILER logic to work again. Note that because this change is adding a sysroot phase the compiler may be built up to twice now. The first is the "cross-compiler" even though it is for the native architecture, but it is still built to ensure the latest compiler is used to generate the binaries, unless SYSTEM_COMPILER allows /usr/bin/cc to be used. Then the target compiler is built which is actually a cross-compiler since it runs on native host but generates TARGET.TARGET_ARCH binaries.

Note this also changes the path used for the OBJDIR. It used to use
/usr/obj/target.target_arch/nxb/<srcdir> for objects and
/usr/obj/target.target_arch/nxb-bin for installed files, but now uses
/usr/obj/nxb/target.target_arch/<srcdir> for objects and
/usr/obj/nxb/target.target_arch/<srcdir>/nxb-bin for installed files.

  • NXBDESTDIR can be specified for where to install or queried with make -f Makefile.inc1 TARGET=... TARGET_ARCH=... -V NXBDESTDIR

This could potentially be improved to reuse an existing sysroot. The
problem is with building the SUBDIR_OVERRIDE list it needs to use a
different OBJDIR since it is building all statically. We don't want to
pollute the existing 'buildworld' OBJDIR and cause confusion on the next
build. Using a separate OBJDIR for the 'everything' phase mostly works
except for some things like linking in INTERNALLIBS that exist in the
other OBJDIR.

MFC after: 1 month
Sponsored by: Dell EMC Isilon

Details

Provenance
bdreweryAuthored on
Parents
rS325000: native-xtools: Override proper NXBDESTDIR.
Branches
Unknown
Tags
Unknown