Commit Graph

1422 Commits

Author SHA1 Message Date
Bryan Drewery
89bd07e927 DIRDEPS_BUILD: Cleanup leftover WORLDTMP files.
This will force any existing objects to rebuild if their .meta
files reference files from WORLDTMP.  This is a problem after
the UNIFIED_OBJDIR effort caused buildworld and DIRDEPS_BUILD
to share an OBJDIR.  Without cleaning these files the
Makefile.depend files end up with odd tmp/legacy/... entries
since some bootstrap-tools linger from there and otherwise
don't rebuild.  Removing the files causes anything having
used WORLDTMP to rebuild.

Sponsored by:	Dell EMC Isilon
2017-11-02 20:45:04 +00:00
Bryan Drewery
4dc89c4d51 Reduce MAKEOBJDIRPREFIX path spam by specifying a direct objdir to use.
Sponsored by:	Dell EMC Isilon
2017-11-02 18:08:36 +00:00
Bryan Drewery
3d165b2f1e native-xtools/xdev: Store these in a location including both MACHINE/TARGET.
Given MACHINE/MACHINE_ARCH=amd64, TARGET=arm64 and TARGET_ARCH=aarch64,
this change will build them in a location such as:
    /usr/obj/usr/src/amd64.amd64/nxb/arm64.aarch64/
and
    /usr/obj/usr/src/amd64.amd64/xdev/aarch64-freebsd/

Sponsored by:	Dell EMC Isilon
2017-11-01 21:22:13 +00:00
Bryan Drewery
c10062b9bf Add a 'make cleanuniverse'.
This will remove all build files for the source directory
when MK_UNIFIED_OBJDIR is enabled.

Sponsored by:	Dell EMC Isilon
2017-11-01 21:22:10 +00:00
Bryan Drewery
dfa099890c Add option UNIFIED_OBJDIR, on by default, which moves the default build OBJDIR.
This changes the build OBJDIR from the older style of /usr/obj/<srcdir> for
native builds, and /usr/obj/<target>.<target_arch>/<srcdir> for cross builds to
a new simpler format of /usr/obj/<srcdir>/<target>.<target_arch>.  This
new format is used regardless of cross or native build.  It allows
easier management of multiple source tree object directories.

The UNIFIED_OBJDIR option will be removed and its feature made permanent
for the 12.0 release.

Relnotes:	yes (don't note UNIFIED_OBJDIR option since it will be removed)
Prior work:	D3711 D874
Reviewed by:	gjb, sjg
Discussed at:	https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Discussed with:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12840
2017-11-01 21:22:05 +00:00
Bryan Drewery
f069674019 xdev: Follow-up r325087: Need to build lib/clang before lld.
LLD needs headers generated by the full libllvm.

X-MFC-With:	r325087
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 23:48:57 +00:00
Bryan Drewery
651c6845c7 kernel-toolchain: Fix improper build order after r325244.
Due to removing some targets that the previous .ORDER: ${WMAKE_TGTS}
set, it was no longer being respected; _build_tools was coming
immediately.

Pointyhat to:	bdrewery
X-MFC-with:	r325244
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 21:51:33 +00:00
Bryan Drewery
5a4121a800 kernel-toolchain: Skip world _obj and _cleanobj phases.
There's no good reason to treewalk the entire tree removing old OBJDIRS
and creating new ones when 'includes', 'libraries', and 'everything' are
all skipped.  The only shared directory in the existing toolchain target
and world is build-tools.  So handle cleaning in it directly if needed
only for the directories it wants to build.

The extra _obj/_cleanobj walks came in the initial kernel-toolchain
addition in r128189.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 19:02:14 +00:00
Bryan Drewery
7cd84b5641 build-tools: De-special-case the gcc tools build.
It merely wanted to use 'all' rather than 'build-tools' so just
add a build-tools target to the Makefile.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 19:02:05 +00:00
Bryan Drewery
555c6e60bc Follow-up r297998: Remove redundant TOOLS_PREFIX in XMAKE.
Sponsored by:	Dell EMC Isilon
2017-10-31 17:16:46 +00:00
Bryan Drewery
337698b78d native-xtools: Allow SYSTEM_COMPILER to be used after r325001.
Now that a proper sysroot is used and a separate target list, it should
be safe to skip building the initial cross-compiler.

X-MFC-With:	r325001
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-10-31 02:52:36 +00:00
Bryan Drewery
601594ed6a cleanworld: No need to cleandir if MK_AUTO_OBJ is enabled.
Sponsored by:	Dell EMC Isilon
2017-10-31 01:45:14 +00:00
Warner Losh
0255bc1370 Return proper status from buildenv.
make buildenv BUILDENV_SHELL=<some command> more useful. Remove '||
true' from the command line so that errors are properly
returned. There appears to be no reason for it, and it dates back to
the original commit by ru@.

Sponsored by: Netflix
2017-10-30 03:12:38 +00:00
Bryan Drewery
be1ef37b94 xdev: Consolidate duplicate cross-tools build/install list into XDEVDIRS.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:52 +00:00
Bryan Drewery
86c4ac993d xdev: Remove excess '/' since XDTP is asserted to be an absolute path.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:49 +00:00
Bryan Drewery
c16a698b5e xdev: Fix build for platforms needing LLD.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:46 +00:00
Bryan Drewery
57820ca8df xdev: Add missing 'make obj' treewalk for 'make includes'.
It is possible that building headers requires an OBJDIR.
The other phases of xdev have their own 'make obj' calls
where needed, such as inside 'make libraries' itself.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:42 +00:00
Bryan Drewery
5bd47cc56f Change native-xtools to not install by default; add a native-xtools-install.
Without this the user has to mess with 'make -f Makefile.inc1 ...' to figure
out where the files are installed in the OBJDIR and then they need to copy them
to where they really wanted them. Using DESTDIR may be problematic after
r325001 as well.

The files will be installed to DESTDIR/NXTP where NXTP defaults to /nxb-bin.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:29 +00:00
Bryan Drewery
24830684f2 Fix xdev TARGET/TARGET_ARCH assertion and expand to native-xtools.
The top of Makefile.inc1 requires TARGET/TARGET_ARCH be defined.  Just
building 'make xdev' would already set them, so this error was never
triggered.  Moving it to Makefile fixes the problem.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:19 +00:00
Bryan Drewery
bb3f65ea64 Disable AUTO_OBJ as a make argument to ensure it really is disabled.
If the user sets this to yes as a make argument too we still want
to ensure these do not get enabled.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:15 +00:00
Bryan Drewery
0a3c9523e0 Remove comment: debug files can be useful for build tools.
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:06 +00:00
Bryan Drewery
67d2f51ad6 Move some LIBCOMPAT tmpdir logic setup to its own build target.
Its own build target was already handling mtree extractions
just as _worldtmp did, so the other cleaning of the
tmpdir makes sense here as well.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:02 +00:00
Bryan Drewery
a3d90ddfb2 MK_TESTS is disabled in early phases, no need for TESTBASE extraction here.
Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:59 +00:00
Bryan Drewery
53f3deb166 FAST_DEPEND clean hack: Remove lib32/soft files properly.
Only remove them if the option is enabled and also handle libsoft
by using the proper LIBCOMPAT_OBJTREE.  LIBCOMPAT:D will expand
the text after it as a proper glob to the command line if LIBCOMPAT
is defined.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:56 +00:00
Bryan Drewery
fb3d959c66 Move FAST_DEPEND cleanup hack into its own target and call from _cleanobj.
The _worldtmp target is for setting up WORLDTMP.  Nothing between _worldtmp
and _cleanobj will read these files.  Move to its own target since it is
so large.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:53 +00:00
Bryan Drewery
354ffd5366 We don't need LIB32 directories extracted in early phase legacy/WORLDTMP dirs.
This reverts some changes from r289662

Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:50 +00:00
Bryan Drewery
64ec67921d Disallow using a colon ':' in source checkout paths.
This leaks into the PATH handling for WORLDTMP and breaks
finding cross-tools.  The PATH handling could be fixed to
properly quote but is not worth the effort.

Also allow this sanity check to always run even with 'make -n'.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:47 +00:00
Bryan Drewery
5e3b906168 Move sendmail special check into a _sanity_check target.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:43 +00:00
Bryan Drewery
a13a8505db Cleanup pieces missed in r315057 which made mandoc mandatory
Sponsored by:	Dell EMC Isilon
2017-10-25 21:46:39 +00:00
Bryan Drewery
ca95e9dd77 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
2017-10-25 21:46:36 +00:00
Bryan Drewery
b12371422a META_MODE: Follow-up r319593: Don't use host headers in a fresh new build.
Sponsored by:	Dell EMC Isilon
2017-10-25 21:46:30 +00:00
Baptiste Daroussin
71a6afa2dc Do not print error when running make check-old on system
without catpages directories

Reported by:	dim
2017-10-10 13:06:11 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Cy Schubert
0c059da3e1 When building multiple kernels using KERNCONF, non-existent KERNCONF
files will produce an error and buildkernel will fail. Previously missing
KERNCONF files silently failed giving no indication as to why, only to
subsequently discover during installkernel that the desired kernel was
never built in the first place.

This is a rework of r302865.

This is the correct patch.

Reviewed by:	ngie (previous version, r302865)
MFC after:	2 months
Differential Revision:	D7167
2017-10-04 03:39:54 +00:00
Cy Schubert
84f54c4fd7 Revert r324246. This is not exactly what was intended. 2017-10-04 03:35:23 +00:00
Cy Schubert
74e0e295e4 When building multiple kernels using KERNCONF, non-existent KERNCONF
files will produce an error and buildkernel will fail. Previously missing
KERNCONF files silently failed giving no indication as to why, only to
subsequently discover during installkernel that the desired kernel was
never built in the first place.

This is a rework of r302865.

Reviewed by:	ngie (previous version, r302865)
MFC after:	2 months
Differential Revision:	D7167
2017-10-04 03:24:16 +00:00
Baptiste Daroussin
b505dd63c9 Do not print error when running make delete-old on system
without catpages directories
2017-09-26 05:33:15 +00:00
Ryan Libby
6d0ab07837 Makefile.inc1: bump elf tool chain version check after PR 215350 fix
This causes builds to use the in-tree libdwarf with the bug fix instead
of the host library.

Reviewed by:	bdrewery, emaste, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12239
2017-09-06 01:55:40 +00:00
Enji Cooper
e133ecbbb3 Respect MK_TCSH with build-tools and native-xtools
This helps reduce the WORLDTMP footprint slightly.

Based on a patch I submitted 5 years ago to GNATS.

PR:		174051
MFC after:	2 weeks
Relnotes:	yes (anyone who cross-builds with MK_TCSH=yes will run into
		     build failures if the host doesn't have tcsh(1))
Reminded by:	Fabian Keil <fk@fabiankeil.de>
2017-08-27 16:15:37 +00:00
Ed Maste
6323f724ea Set MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools
LLD_BOOTSTRAP is intended to control the linker used to link world and
kernel, while LLD_IS_LD is intended to control the linker installed in
that world.

Force LLD_IS_LD equal to LLD_BOOTSTRAP for the cross-tools build and
install phase, so that lld will be installed as the ld to run on the
host, when LLD_BOOTSTRAP is set.

PR:		221543
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12072
2017-08-23 12:47:10 +00:00
Glen Barber
53d1eddd44 Revert r322327, r322352, r322358:
Disconnect the dependency on the kernel package from the runtime
package.  There are a number of problems here:

 1) The runtime package installed into a chroot or a jail would
    include the kernel package, changing the behavior of how jails
    work now [1];

 2) As result of (1), it is possible a binary may incorrectly
    resolve kernel symbols [2]; in addition, it is possible there
    will be unexpected fallout with 32-bit jails on a 64-bit host
    kernel [2].

Noticed by:	brd [1]
Discussed with:	kib [2]
MFC after:	3 days
MFC note:	record-only to wipe from the merge tracker
Sponsored by:	The FreeBSD Foundation
2017-08-15 15:13:33 +00:00
Glen Barber
ebd2eeb3f8 Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include
svnversion metadata to the runtime and kernel packages.

Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).

MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2017-08-11 19:21:40 +00:00
Glen Barber
1866d42eec Fix indentation from r322401.
MFC after:	3 days
MFC with:	r322401
Sponsored by:	The FreeBSD Foundation
2017-08-11 14:19:31 +00:00
Glen Barber
33f8570d0c Avoid creating kernel-dbg.txz distribution sets and kernel-debug
packages when MK_DEBUG_FILES is 'no'.

MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2017-08-11 14:18:11 +00:00
Glen Barber
1537337752 Indent nested conditionals for readability.
Sponsored by:	The FreeBSD Foundation
2017-08-10 14:18:58 +00:00
Glen Barber
16398a1141 Add a dependency on the kernel package for the runtime package.
The idea here is that, provided upstream pkg(8) maintainers accept
the proposed change, the kernel.ucl will contain a post-install
script causing pkg(8) to emit a message informing to reboot the
system after the kernel is upgraded using 'pkg upgrade', so the
new userland is installed on the running new kernel.  At present,
this functionality does not exist in pkg(8), but will help ensure
the upgrade path follows that from UPDATING.  To work around this
for now, evaluate ASSUME_ALWAYS_YES, and prompt the user if they
wish to proceed if not set to true.

Since there is a kernel dependency, and a non-GENERIC kernel may
be in use, update Makefile.inc1 to replace '%KERNCONF%' in the
runtime.ucl with the first-built kernel set either via command line
or in make.conf(5).

MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2017-08-09 19:16:54 +00:00
Dimitry Andric
8422e09e55 Follow-up to r321684 (Don't use libc++ when cross-building for gcc
arches), and handle two more cases where libc++ includes could be
incorrectly enabled, in case the host compiler is clang 5.0.0, and the
target (cross) compiler is gcc 4.2.1.

Noted by:	bdrewery
MFC after:	3 days
X-MFC-With:	321684
2017-08-07 16:23:53 +00:00
Bryan Drewery
91234af7d8 CCACHE_BUILD: Follow-up r321880: Fix some PATH issues with buildworld.
- bsd.compiler.mk: Must ensure that the CCACHE_WRAPPER_PATH comes first
  in PATH.
- Makefile.inc1: Must prepend the CCACHE_WRAPPER_PATH into BPATH as it
  overrides the PATH set in bsd.compiler.mk in sub-makes.  The PATH
  set in bsd.compiler.mk is not exported and doing so would cause it to
  then override the BPATH set from environment.  The only sane solution
  is to prepend into BPATH as needed.
CCACHE_PATH could possibly be used for some of this as well.

Sponsored by:	Dell EMC Isilon
2017-08-01 18:26:20 +00:00
Bryan Drewery
5aa73fa259 NO_CLEAN: No need to run delete-old if the directories don't exist.
X-MFC-With:	r321443
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-08-01 16:41:17 +00:00
Ian Lepore
dca576be69 In xdev-links, when installing symlinks to the cross-compiler pieces that
includes the OS version (armv6-freebsd12.0-cc, etc), use the OS version of
the compiler/world source code, not the version of the build host machine.
2017-08-01 14:54:25 +00:00