Commit Graph

1919 Commits

Author SHA1 Message Date
Brooks Davis 8e35800732 build: remove the last vestiges of lint support
Commit 1cbb58886a (shipped in 12.0.0) removed all lint infrastructure.
A bunch of NO_LINT definitions remained (perhaps as a bootstrapping
measture).  Remove them.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50704
2025-06-06 00:55:34 +01:00
Ed Maste 26064d3e74 Makefile.inc1: Remove unused non-NO_ROOT support
As of commit 41adc5f29b ("release: Always use NO_ROOT for distribute*
and package*") this packagekernel code path is never used, so remove it.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50361
2025-05-23 17:50:38 -04:00
Mark Johnston f83ec40fca Makefile.inc1: Let the buildetc target run outside of etc
Commit 49bc071f40 ("nsswitch.conf: Avoid modification after
installation") changes handling of nsswitch.conf such that we make a
copy in the objdir during a build.  Historically, the in-tree
nsswitch.conf lived under etc.

The buildetc target and its copy set SUBDIR_OVERRIDE=etc when building
the object tree, but I think this isn't right when conf files are
scattered around the src tree.  If any of them require non-trivial
processing, they'll get skipped during buildetc, and then some
build-time commands may run during installetc.  In the linked PR, this
fails because the src tree is mounted read-only and no objdir was
created during buildetc.

Remove the SUBDIR_OVERRIDE for the _obj target, and build the
buildconfig target across the tree.

PR:		286072
Fixes:		49bc071f40 ("nsswitch.conf: Avoid modification after installation")
Reviewed by:	brooks, dim
Tested by:	dim, Alastair Hogge <agh@riseup.net>
Differential Revision:	https://reviews.freebsd.org/D49960
2025-04-24 14:32:41 +00:00
Dimitry Andric ea231471d0 Fix build with WITH_CLANG_BOOTSTRAP and WITHOUT_CLANG
When WITH_CLANG_BOOTSTRAP and WITHOUT_CLANG are both set, the
cross-tools stage does not build a cross clang binary. This is because
the Makefile in usr.bin/clang checks for WITHOUT_CLANG, and skips
building the binary.

To fix this, ensure that WITH_CLANG is set for the cross-tools phase
whenever WITH_CLANG_BOOTSTRAP is set. While here, skip using the
Makefile in usr.bin/clang, and directly use the Makefile in
usr.bin/clang/clang instead.

PR:		286154
Reported by:	avg
Reviewed by:	avg, emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D49886
2025-04-18 20:32:12 +02:00
Ed Maste ca0fc8ef2f elfcopy: Restore upstream name
ELF Tool Chain's objcopy-equivalent is called elfcopy.  Restore the
upstream name in our build infrastructure to make it more clear where
different binary utility components come from.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49784
2025-04-11 15:44:40 -04:00
Ed Maste 7d70f8b482 Makefile.inc1: Rework ELF Tool Chain bootstrapping
Remove additional conditions and bootstrap elfctl, elfdump, and elfcopy
(aka objdump) if ELFTOOLCHAIN_BOOTSTRAP is true.  The first two are
bespoke tools that won't exist in an external GNU or LLVM binutils, and
elfcopy is also not provided by that name.

This should fix GCC CI builds, which was skipping the elfcopy build
because of the ${TARGET_ARCH} != ${MACHINE_ARCH} condition.

Reported by:	olce
Reviewed by:	brooks
Fixes: b885643b63 ("boot: Always use ELF Tool Chain elfcopy for EFI builds")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49493
2025-03-27 12:38:25 -04:00
Ed Maste 2fa091dcfb Makefile.inc1: packageworld: remove non-NO_ROOT cases
The packageworld target requires NO_ROOT to be set (and there is a check
that this is the case).  Remove the now-unused non-NO_ROOT cases.

Reviewed by:	brooks, bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48590
2025-03-10 14:15:44 -04:00
John Baldwin db6f2bb93a Makefile.inc1: Conditionalize some package related variables
In particular, don't invoke git to compute SOURCE_DATE_EPOCH for
unrelated targets like check-old or delete-old.  If the git invocation
fails (e.g. when using a git worktree mounted over NFS) it can
generate a lot of irrelevant warning spam.

Reviewed by:	emaste
Fixes:		8a3537aaf7 ("Makefile.inc1: Make package timestamps reproducible by default")
Differential Revision:	https://reviews.freebsd.org/D49278
2025-03-10 13:30:26 -04:00
John Baldwin 7d529b1c8f Makefile.inc1: Correct comment for an .endif
Fixes:		0026fec57d ("Differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases.")
2025-03-07 11:57:40 -05:00
Baptiste Daroussin 8e99c8ad8f pkgbase: make pkg repo reproducible
Add a PKG_WORKERS_THREADS variable set to 1 by default, if as a user
you want speed again, then just override it.
2025-03-06 15:22:48 +01:00
Ed Maste 8a3537aaf7 Makefile.inc1: Make package timestamps reproducible by default
Set package archive timestamps based on most recent source commit
timestamp (approach suggested by bapt).

I'd like to include git metadata in a file included in src tarballs, so
that the build is reproducible (including the hash shown in uname etc.)
outside of a git checkout.  There are still details to be sorted out to
do that, so this is an interim step to improve reproducibility.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D49165
2025-02-28 10:11:52 -05:00
Kyle Evans 53fae788f2 sys: syscalls: add a test syscall definition file
This exercises some subset of the preprocessor that would be nice to
still support.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
2025-02-18 22:02:19 +00:00
Jose Luis Duran 01ff67f4bd mtree: TESTSBASE directory always starts with a /
Remove the extra forward slash ("/"), otherwise the mtree specification
file will have the double slash and will not be parsed by makefs when
attempting to build NanoBSD with NO_ROOT privileges.

Fixes:	07670b30fa ("Create /usr/tests *.debug file directory hierarchy")
Reviewed by:	emaste
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D47722
2025-01-24 23:10:05 +00:00
Mark Johnston f9097705fb pkgbase: Fix OSVERSION specification when creating a repo
-o OSVERSION= needs to appear before the "repo" verb, otherwise it has
no effect.  In this case, recent pkg-devel fails to create the repo,
saying that ABI cannot be specified without OSVERSION.

Reviewed by:	kevans, manu
MFC after:	2 weeks
Fixes:		188fe88ec5 ("pkgbase: force OSVERSION")
Differential Revision:	https://reviews.freebsd.org/D48518
2025-01-20 13:54:49 +00:00
Ed Maste 6eae413a25 build: Check NO_ROOT and METALOG for more targets
In f6575ed0de I added a check that DISTDIR is set and is not / for
`make distributeworld`.  Extend the check to `distributekernel` and the
two package* targets as the same argument applies.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48339
2025-01-11 08:44:53 -05:00
Pat Maddox 58610d1e0f build: Sort distributekernel METALOG when using -DNO_ROOT
The metalog is produced by install -M, which is not inherently sorted.
This results in non-deterministic file ordering in kernel.txz. Order the
files in kernel.txz to support reproducible builds.

PR:		283214
Reviewed by:	emaste

Signed-off-by: Pat Maddox <pat@patmaddox.com>
2025-01-06 12:56:30 -05:00
Ed Maste 0f7d8b71b4 Makefile.inc1: Set DISTDIR in stagekernel target
The distributekernel target expects DESTDIR and DISTDIR to be set.  The
stagekernel target invokes `make distributekernel`, and previously left
DISTDIR unset, resulting in a path with a "//" component.  Instead, set
DISTDIR to . to make the way we're (ab)using the distributekernel target
more explicit.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48288
2025-01-04 19:16:38 -05:00
Mark Johnston cfbbe5d7fa Makefile.inc1: Fix a typo
Fixes:	266f640b38 ("Makefile.inc1: Remove non-NO_ROOT cases from distributeworld")
2024-12-16 22:32:21 +00:00
Ed Maste 266f640b38 Makefile.inc1: Remove non-NO_ROOT cases from distributeworld
As of commit 41adc5f29b ("release: Always use NO_ROOT for distribute*
and package*") we pass -NO_ROOT for the release image artifact build
targets.  For distributeworld, add a check that NO_ROOT and METALOG are
set, and then remove tests for them being set.

This is an incremental step towards the goal of having all targets in
release/Makefile run without requiring root.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48095
2024-12-16 16:29:59 -05:00
Ed Maste f6575ed0de Makefile.inc1: Require DISTDIR be set for make distributeworld
distributeworld is the target used to stage world for building dist sets
for release targets, and is not really intended for end-user use.  If
DISTDIR is not set we would attempt to write to the root directory.
Error out in this case, serving as an assertion that an internal target
is not being used incorrectly.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48030
2024-12-13 10:22:01 -05:00
Brooks Davis 7d0d52fc7c distributeworld: dedup dist(.debug).meta generation
Debug file distribution metadata generation was added in 2d0bcb76c8
as a near duplicate of the default distribution bits.  Add another loop
instead of copying the code.  While here, improve indentation.

Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D48038
2024-12-12 16:14:14 +00:00
Ed Maste 3750ccefb8 Retire MK_PROFILE infrastructure
It was disabled by default in fe52b7f60e.  We planned to (but did not)
remove the option before FreeBSD 14.  Remove it now, for FreeBSD 15.

Relnotes:	Yes
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31558
2024-11-12 12:11:51 -05:00
Kyle Evans 8549e3ce0c pkgbase: don't remove the 'latest' symlink until the repo is final
We can encounter many issues in the pkg-repo(8) process which would
currently leave us with no more 'latest' symlink in the repository.  The
main problems with this are that we've now broken a subsequent
`update-packages` because we can't determine a PKG_VERSION_FROM, but
also we break configured clients that are still expecting to see *some*
repository.

Switch to just replacing the `latest` symlink entirely after we have
made it past the pkg-repo(8) step so that we only swap over when we have
a finished repository.

Reviewed by:	bapt, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D47303
2024-10-29 15:50:49 -05:00
Robert Clausecker cb5e41b160 lib/libcrypt: unbundle hash functions
libcrypt bundles the various hash functions it needs,
duplicating code that is also found in libmd.
Unbundle the hash functions and apply the same hack used
for libncursesw so static consumers link -lmd in addition
to -lcrypt.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D47062
2024-10-25 16:02:38 +02:00
Ka Ho Ng 968bcca262 libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed
ELF parsing helpers specialized in parsing KLDs and the kernel
executable. The library can be used to read metadata such as linker_set,
mod_depend, mod_version and PNP match info, and raw data from the ELF.

To promote the reuse of the facilities the ELF parsing code is separated
from kldxref(8) into a new private library.

For now, libkldelf's source files will be compiled into kldxref(8)
directly if kldxref is built during bootstrapping phase. The reason is
linking kldxref(8) against the libkldelf static library has an unwanted
side effect which renders the linker sets inside the libkldelf
implementation empty if the static library is not build by ld -r all the
.o files into a single .o before producing the static library.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	markj
Suggested by:	jrtc27, markj
Differential Revision:	https://reviews.freebsd.org/D46719
2024-10-18 20:20:13 +00:00
Baptiste Daroussin 458dc7f303 pkgbase: fix incremental generation of packages
Replace the regex trying to catch the branch name of the existing
repository which was too naive with simpler glob matching.

As a result the only case when we only use the new packages are:
moving from alpha to beta
moving from beta to rc
moving from rc to release
changing the major version number for the main git branch

PR:		281393
Differential Revision:	D46874
2024-10-10 08:48:28 +02:00
Ka Ho Ng 50c64df2a1 Revert "libkldelf: add a private library for kernel/kld-related ELF parsing"
This reverts commit 0a2cfd653e.
2024-10-08 19:40:20 +00:00
Ka Ho Ng 0a2cfd653e libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed
ELF parsing helpers specialized in parsing KLDs and the kernel
executable. The library can be used to read metadata such as linker_set,
mod_depend, mod_version and PNP match info, and raw data from the ELF.

To promote the reuse of the facilities the ELF parsing code is separated
from kldxref(8) into a new private library.

kldxref(8) is modified to link against the libkldelf library.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46719
2024-10-08 04:24:07 +00:00
Evgenii Khramtsov 1a58fd5bf6 Makefile.inc1: make pkg-create(8) compression level overridable
pkg(8) after 8991ebd7afb0 ("Fix #1566: Add pkg-create(8) -l,--level
to set compression level") accepts compression level when creating
packages with a compression format (e.g. txz, tzst).

When compression is used (PKG_FORMAT is not "tar"), use compression
level from PKG_LEVEL for pkg-create(8) to make use of 8991ebd7afb0.

PKG_LEVEL default is set to pkg default to keep current behavior,
see pkg(8) 31000cb40b30 ("tzst: by default compression at the 19 level).

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1420
2024-09-21 07:40:11 -06:00
Baptiste Daroussin 7899f917b1 flua: move modules source into the main source directory
Follow the path of what is done with bsnmp, build the modules along
with the main binary, this allows to build the modules at a moment
where all needed libraries are already built and available in the
linker path instead of having to declare all the libraries which a
flua module will be linked to in _prebuild_libs.

Discused with:	markj
Reviewed by:	markj, jrtc27, kevans, imp
Accepted by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D46610
2024-09-12 09:03:44 +02:00
Baptiste Daroussin 2b9c818d8d pkgbase: fix decision logic to keep the old packages
when running update-package, we try to keep as much as possible the old
packages to avoid wasting users bandwidth. the previous code was failing
at catching properly the "snap" extension and we lost incremental build.

With this new code we only stop checking we we have an old package with
the same checksum if we transition from:
- alpha to beta
- beta to rc
- rc to release

but we keep old packages when we transition from release to p1 or when
we stay on a given snapshot

PR:		281393
Reported by:	Evgenii Khramtsov <throwaway_vthgwq4@protonmail.com>
2024-09-10 18:05:29 +02:00
Baptiste Daroussin 9f0f4e23a5 prebuild_libs: register libucl dependency on libm
Reported by:	Rainer Hurling <rhurlin@gwdg.de>
2024-09-07 14:20:47 +02:00
Baptiste Daroussin 5daafa2c23 flua: fix buildworld from a clean room
now that the flua ucl module is built the lib directory, it is being
build at a moment where it cannot link yet to libucl, push libucl in
the _prebuild_libs to ensure it is present in a path to be linked
against at the time the lua ucl module is being built.

While here, remove libucl from boostrap as a dependence of flua as it is
not needed anymore now that flua ucl module is dynamically loadable.
2024-09-07 13:25:43 +02:00
Wolfram Schneider 9867b4af50 Makefile.inc1: show time for `make installworld'
For years we display the time in seconds how long it takes to
run `make buildworld' (see PR 224433). Now we will display the
time for "installworld" and "installkernel" as well.

e.g.:
--------------------------------------------------------------
>>> Installing everything completed on Sun Jul  7 16:11:37 UTC 2024
>>> Install world completed in 110 seconds, ncpu: 2, make -j2
--------------------------------------------------------------

This is an improved version of commit e5a0202f96

PR: 280187
Differential Revision: https://reviews.freebsd.org/D45912
2024-09-02 09:55:10 +00:00
Mark Johnston d02dcf21ee pkgbase: Make src package creation recipes more precise
Just remove the plist created by the respective rule.  Otherwise the two
receipes can race with each other.

Fixes:	d7d5c9efef ("pkgbase: Let source packages be built in parallel")
Reviewed by:	bapt, emaste
Reported by:	Mark Millard <marklmi@yahoo.com>
Differential Revision:	https://reviews.freebsd.org/D46320
2024-08-19 15:48:12 +00:00
Mark Johnston d7d5c9efef pkgbase: Let source packages be built in parallel
To build the packages target, we build src and src-sys packages
containing the source code from which the repo was built.  These
packages take significantly longer than the others, presumably because
they contain many more files.  Because both source packages are built
to satisfy the same target, they end up being built serially.  Split
them into separate subtargets so that they can run in parallel.  This
saves a couple of minutes on my build machine.

Reviewed by:	manu, emaste
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46288
2024-08-19 14:37:27 +00:00
Mark Johnston b118b6eb4c pkgbase: Unify pkg ABI handling for pkgbase targets
Right now, to get the pkg ABI we either use PKG_ABI, derived from
newvers.sh, or use an ABI file from the staged world.  This
inconsistency is confusing and can cause problems.

Switch to a single source of truth: use an ABI file from the worldstage
dir to get the ABI of pkgbase packages.  In particular, we do not need
to know the ABI until staging is done.  More specifically:
- use a shell command to define PKG_ABI,
- replace inline uses of ABI_FILE,
- run sign-packages in a subshell (this was already done for the
  update-packages target) so that the staging targets are done before we
  try to evaluate the ABI.

Reviewed by:	manu
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46287
2024-08-19 14:37:27 +00:00
Ed Maste 867873b398 Revert "Makefile.inc1: show time for `make installworld'"
It broke `make packages`, so revert until that can be fixed.

This reverts commit e5a0202f96.

Reported by:	bapt, theraven
2024-07-15 09:50:04 -04:00
Wolfram Schneider e5a0202f96 Makefile.inc1: show time for `make installworld'
For years we display the time in seconds how long it takes to
run `make buildworld' (see PR 224433). Now we will display the
time for "installworld" and "installkernel" as well.

e.g.:
--------------------------------------------------------------
>>> Installing everything completed on Sun Jul  7 16:11:37 UTC 2024
>>> Install world completed in 110 seconds, ncpu: 2, make -j2
--------------------------------------------------------------

PR: 280187
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D45912
2024-07-13 10:37:14 +00:00
Andrew Turner 7818c2d37c armv6: Remove support for building armv6
With it planned that armv7 will be the only 32-bit kernel when 15.0 is
released remove support for armv6.

Remove the top level build infrastructure. It was already removed from
universe, this just stops it from being built directly.

Reviewed by:	mmel, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45634
2024-07-12 11:31:53 +00:00
Navdeep Parhar aee4c9c5b8 Makefile.inc1: Fix typo affecting incremental pkgbase builds.
Fixes:	4231a5e504 release: don't keep old packages if the BRANCH changes
Sponsored by:	Chelsio Communications
2024-06-20 12:17:46 -07:00
Siva Mahadevan 4231a5e504 release: don't keep old packages if the BRANCH changes 2024-06-20 10:02:34 +02:00
Jessica Clarke a20a903b16 Makefile.inc1: Allow showconfig and test-system-* if (X)CC is GCC
This case gets hit in make universe on Linux, since we will first run
make test-system-compiler to determine whether to use the system or
universe toolchain, during which time CC is the host's, GCC, and XCC
isn't set, so defaults to the same.

Fixes:	4c0dfd5959 ("arm: fail early on gcc builds")
2024-06-03 00:16:58 +01:00
Brooks Davis 61ad1ddc5a Improve broken-on-gcc checks
Mark powerpc* and riscv broken.

Refactor and add a TRY_GCC_BROKEN option to build anyway.  This
simplifies things for people trying to get gcc builds working
while letting other developers know that they aren't expected to work.

Reviewed by:	jhb, emaste
Improves:	4c0dfd5959 arm: fail early on gcc builds
Differential Revision:	https://reviews.freebsd.org/D45230
2024-05-17 21:50:57 +01:00
Brooks Davis 4c0dfd5959 arm: fail early on gcc builds
Since at least 2022 (see https://reviews.freebsd.org/D36754), it has
not been possible to build armv6/armv7 with gcc due to atomics macros
gcc doesn't like.  Prevent developers doing due diligance from wasting
time and CPU cycles on this combination as it just fails to build in
libc.

Reviewed by:	imp, andrew
Differential Revision:	https://reviews.freebsd.org/D45193
2024-05-17 17:01:19 +01:00
Andrew Turner 2c35c867ba showconfig: Set MACHINE for src.opts.mk
Also set MACHINE and MACHINE_ARCH when reading config options from
src.opts.mk. This ensures any machine-dependent options are reported
correctly.

Reviewed by:	emaste, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44838
2024-04-24 18:17:20 +00:00
Elyes Haouas f092a54fdc Makefile.inc1: Fix typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:31 -06:00
Baptiste Daroussin 45d83c3926 pkgbase: add a mechanism to be able to force a give ucl include
This is made in order to be able to find add the post-install scripts
for the kernel, where PKGNAME varies for each KERNCONF but we don't want
to dynamically duplicated the kernel.ucl file.

At the same time we don't want the *-dbg* packages to actually include
those post-install scripts
2024-03-20 09:39:18 +01:00
Baptiste Daroussin 02b25ccfc0 pkgbase: fix packaging of dtb 2024-03-19 15:07:28 +01:00
Baptiste Daroussin 2addba5caf pkgbase: fix typo preventing packaging kernels 2024-03-19 14:05:12 +01:00