Commit Graph

1877 Commits

Author SHA1 Message Date
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
Baptiste Daroussin
7622906160 pkgbase: fix kernel packing after switch ucl rework 2024-03-19 10:00:15 +01:00
Baptiste Daroussin
f8e46fd61e pkgbase: rework certctl package to only run rehash on the main package
Rework how ucl manifest are generated leveraging ucl features and flua

now the ucl generation is done via a lua script which uses libucl to
ingest the template and use variables as defined in its command line.

the template will include only if it exist a ucl file named after the
package name which will complement the template or overwrite what was
defined in the template if defined in this specific ucl file

this allows to overwrite license, but add script only to the packages
who actually needs them.

As a results the post install scripts are now only added to the right
package and not also added to the subpackages like -man or -dev

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44374
2024-03-19 07:58:29 +01:00
Brooks Davis
0d4f7723bc libc: link libsys as a auxiliary filter library
At runtime, when rtld loads libc it will also load libsys.  For each
symbol that is present in both, the libsys one will override the libc
one.  It continues to be the case that program need only link against
libc (usually implicitly).  The linkage to libsys is automatic.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Emmanuel Vadot
b6e9a7a2e2 Reapply "pkgbase: Create a FreeBSD-dtb package"
This reverts commit 9bbe06b004.

Before that dtbs where included in each kernel packages which prevents
us to install multiple kernels.

Fix mtree-to-plist.awk to only generate a dtb.plist when we create
the kernel one (because dtb are installed during make installkernel).

Sponsored by:   Beckhoff Automation GmbH & Co. KG
2024-02-03 09:49:12 +01:00
Emmanuel Vadot
9bbe06b004 Revert "pkgbase: Create a FreeBSD-dtb package"
Somehow this doesn't work iwth make packages due to some kind of a race.
The package is first created correctly but later in the process it is
overwritten by a badly created empty package.
Revert in the mean time so we can have working pkgbase on arm/arm64

This reverts commit a5afd7920d.
2024-02-02 11:39:51 +01:00
Emmanuel Vadot
a5afd7920d pkgbase: Create a FreeBSD-dtb package
Before that dtbs where included in each kernel packages which prevents
us to install multiple kernels.

Differential Revision:	https://reviews.freebsd.org/D43632
Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-01-29 19:24:25 +01:00
Emmanuel Vadot
a5ff900535 pkgbase: Create two new rules for creating repo
This adds two new rules named create-packages-kernel-repo and
create-packages-world-repo.
The goal of those rules is to create the {kernel,world} packages and
after that the repository.
It helps a lot for developing with pkgbase by adding the dev machine
repository created by those rules on top of the official pkgbase one.

Differential Revision:	https://reviews.freebsd.org/D43623
Reviewed by:	bapt, emaste
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-01-29 19:24:03 +01:00
Warner Losh
3d939d967a build: Use ls -i | cut rather than stat -f %i to extract inode
ls -i dates back to 5th edition Unix and is more portable than the stat
command, though %% is a newer shellism, it works on any shell that
FreeBSD builds with.

Sponsored by:		Netflix
2024-01-14 19:23:45 -07:00
Cy Schubert
3091cdb11f Revert "kerberos: Fix numerous segfaults when using weak crypto"
This revision breaks Linux and MacOS cross builds because
TARGET_ENDIANNESS is not define during bootstrapping on these
platforms.

I think the correct approach would be to separate the new
fbsd_ossl_provider_load() and unload functions into their own
library (instead of libroken). This avoids the less desirable
option of including bsd.cpu.mk in secure/lib/Makefile.common,
which does build but could complicate future work.

Reported by:	jrtc27

This reverts commit cb350ba7bf.
2024-01-11 23:42:33 -08:00
Cy Schubert
cb350ba7bf kerberos: Fix numerous segfaults when using weak crypto
Weak crypto is provided by the openssl legacy provider which is
not load by default. Load the legacy providers as needed.

When the legacy provider is loaded into the default context the default
provider will no longer be automatically loaded. Without the default
provider the various kerberos applicaions and functions will abort().

PR:			272835
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D43009
Tested by:		netchild, Joerg Pulz <Joerg.Pulz@frm2.tum.de>
2024-01-11 05:26:42 -08:00
Domagoj Stolfa
93f27766a7 dtrace: Add the 'oformat' libdtrace option
This option can be used to specify a format to use in DTrace output.
The following formats are supported:
 - json
 - xml
 - html
 - none (default DTrace output)

This is implemented using libxo and integrated into libdtrace. Client
code only works with the following API:

 - dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting.
 - dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished
 - dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled.
 - dtrace_set_outfp(FILE *) -- sets the output file for oformat.
 - Ensure that oformat is correctly checked in the drop handler and record
   processing callbacks.

This commit also adds tests which check if the generated output is
valid (JSON, XML) and extends the dtrace(1) describing the structured output.

Reviewed by:	markj
Discussed with:	phil
MFC after:	2 months
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41745
2024-01-10 18:14:26 -05:00
Jessica Clarke
ff7c12c1f1 Make kldxref a bootstrap tool and use unconditionally
Now that kldxref is a generic cross tool and can be built on non-FreeBSD
we can bootstrap it during the build and thus remove the condition for
whether it exists. We also need to make sure to add it to the METALOG
for -DNO_ROOT builds.

Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D43051
2023-12-13 21:43:10 +00:00
Jessica Clarke
e131d3f4f3 Makefile.inc1: Forward on METALOG and DISTBASE for kernel targets
Currently IMAKE_INSTALL, which includes -M METALOG, is enough for the
sub-makes to work, but using kldxref for -DNO_ROOT builds will require
manually adding linker.hints to the METALOG, and thus both METALOG
itself and DISTBASE need to be exposed directly to the sub-makes, so do
so.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D43050
2023-12-13 21:43:09 +00:00
Jessica Clarke
641eba2de4 Makefile.inc1: Reinstate building sbin/md5 for BOOTSTRAP_ALL_TOOLS
The sha256 and sha512 binaries are used when building release images.
Bootstrapping them used to be gated on MK_BOOT, which wasn't quite right
but in practice worked, at least in our use cases downstream. Add back
bootstrapping sbin/md5 and its aliases for this purpose to fix building
release images on Linux and macOS.

Fixes:	f213da893c ("Makefile.inc1: Remove beri straggler")
2023-12-13 18:02:45 +00:00
Ed Maste
3b1904d9eb pkgbase: pass --recurse-submodules to git ls-files
When generating source packages.  Although submodules are not used by
FreeBSD itself they may be used by downstream projects.  By default
for submodules `git ls-files` just emits the submodule directory name,
which resulted in:

    pkg: pkg_checksum_hash_sha256_file(read failed): Is a directory

Passing --recurse-submodules lists all of the files in each submodule
(which is desired when submodules are in use), and has no effect when
submodules are not present.

Reviewed by:	bapt, manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42983
2023-12-09 11:10:01 -05:00
Dimitry Andric
06c3fb2749 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR:		273753
MFC after:	1 month
2023-12-08 18:34:50 +01:00
Warner Losh
7b085f14b7 build: use bare (and portable) echo instead of echo -n
There's no need to use echo -n here. A single echo will do nicely.
This fixes the post-buildworld output on a macos build, where echo -n
is implemented like System V instead of BSD (so you get two lines
first one starting with -n).

Sponsored by:		Netflix
Reviewed by:		jrtc27, emaste
Differential Revision:	https://reviews.freebsd.org/D42869
2023-12-07 13:42:52 -07:00
Baptiste Daroussin
5faaa602ce pkgbase: propagate SRCRELDATE to the packages correctly
MFC After:		3 days
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D42892
2023-12-04 22:27:57 +01:00
Baptiste Daroussin
99b8c0c35b pkgbase: create source package
FreeBSD-src for all the sources but the kernel
FreeBSD-src-sys just for the kernel

MFC After:		3 days
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D42651
2023-12-04 09:05:03 +01:00
Warner Losh
f213da893c Makefile.inc1: Remove beri straggler
Beri's boot loader needed md5 to build. It was the only thing that
needed that, so remove it (confirmed with univers and grep).

Sponsored by:		Netflix
2023-11-20 20:30:02 -07:00
Baptiste Daroussin
051d69d6f8 pkgbase: create package with SRCRELDATE not OSRELDATE as OSVERSION
In 188fe88ec5 OSVERSION has been set
to OSRELDATE which is the RELDATE of the building OS while we wanted
to use SRCRELDATE which is the RELDATE of the target system
2023-11-14 08:43:15 +01:00
Doug Rabson
21e9018ae1 pkgbase: use <major>.<minor> format for alpha, beta and release package versions
This is consistent with version numbers used in releng/13.2.

PR:		275051
Reviewed by:	bapt
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D42562
2023-11-13 14:46:36 +00:00
Baptiste Daroussin
188fe88ec5 pkgbase: force OSVERSION
This is used to the package annotation helping pkg to know about
backward compatibility is set to the version of the packages not
the version of the host building the packages
2023-11-03 09:29:23 +01:00
Baptiste Daroussin
df6e7e11c5 pkgbase: set a default set of kernel for when PACKAGE_BUILDING=1
PACKAGE_BUILDING is already known in the ports tree as a variable
use to defined when the packages is being actually built in an
automation process, reuse that variable to define the default set
of kernel we plan to build for the default pkgbase.

Reviewed by:	manu, jrtc27
Accepted by:	manu
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D42444
2023-11-03 09:17:30 +01:00
SHENG-YI HONG
5c783a0b28
ASan: Add asan_static to build
This is a partial fix for building with -DWITH_ASAN.

Reviewed by:	Fangrui Song, dim, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42388
2023-11-03 15:02:26 +08:00
Ed Maste
f38bad0ab0 Remove MOVED_LIBS handling from list-old-libs
In 922337e8d3 I added MOVED_LIBS into list-old-files, so that
delete-old-files would remove the old /usr/lib/libc++.so.1 as soon as
possible (after the library moved to /lib).

I left it in list-old-libs in case a user updated their src tree between
delete-old-files and delete-old-libs.  Now that some time has passed,
tremove the redundant MOVED_LIBS entry.

PR:		272642
Sponsored by:	The FreeBSD Foundation
2023-11-01 10:32:31 -04:00
Baptiste Daroussin
820fbcf25b pkgbase: compress packages with zstandard
MFC After:	3 days
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D42375
2023-10-27 11:47:46 +02:00
Brooks Davis
0e0c4f5837 certctl: invoke with LOCALBASE set
When invoking certctl as part of installworld, set LOCALBASE in the
environment to match the build environment.  That ensures that LOCABASE
is non-empty on systems without the user.localbase sysctl and avoids
allowing a system configuration detail to leak into the build.  Users
who wish to build targeting a non-standard LOCALBASE should ensure it is
set in src.conf or similar.

Reviewed by:	Mina Galić <freebsd@igalic.co>
Differential Revision:	https://reviews.freebsd.org/D40530
2023-10-20 20:52:10 +01:00
Ed Maste
2ee2890249 Makefile.inc1: remove ncurses/form from _prebuild_libs
As of d287d3282f libbsddialog has a built-in form implementation and
does not need a formw dependency.

This reverts commit 483a226238.

Reported by:	asiciliano
Sponsored by:	The FreeBSD Foundation
2023-10-17 13:53:45 -04:00
Ed Maste
922337e8d3 Handle MOVED_LIBS in list-old-files
MOVED_LIBS is used when a library moves from one directory to another,
e.g. /usr/lib/libc++.so.1 to /lib/libc++.so.1.

delete-old-files and delete-old-libs are two separate steps, so that
old libraries can be retained until third party software packages are
rebuilt or reinstalled.

Having two copies of the same shared library with the same so version
(as can happen when delete-old-libs hasn't been run) causes trouble.
The PR below gives one example.

Libraries listed in MOVED_LIBS are logically equivalent to updating a
library without changing the so version, and should be removed as soon
as possible.  Handle them in list-old-files and thus delete-old-files.

Leave them also in *-old-libs for now, in case the user updates their
tree between running delete-old-files and delete-old-libs.

PR:		272642
Reviewed by:	dim
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Co-authored-by: Dimitry Andric <dim@FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D42197
2023-10-13 15:50:07 -04:00
Pierre Pronchery
1a18383a52 libcrypto: link engines and the legacy provider to libcrypto
OpenSSL's legacy provider module and engines need to link to
libcrypto.so, as it provides some of the actual implementations of
legacy routines.

This is a little tricky due to build order issues.  Introduce a small
hack (LIBCRYPTO_WITHOUT_SUBDIRS) that builds libcrypto.so in its usual
early phase without any OpenSSL provider modules or engines.  This is
intended to restore the test suite; a future change should remove the
hack and replace it with a better approach.

PR:		254853, 273528
Discussed with:	Folks at EuroBSDCon in Coimbra
Sponsored by:	The FreeBSD Foundation
2023-09-16 16:55:12 +01:00
Brooks Davis
bd016ad227 Teach make showconfig about group options
Output OPT_ variables in addition to MK_ variables.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41682
2023-09-01 17:54:23 +01:00
Martin Matuska
315ee00fa9 zfs: merge openzfs/zfs@804414aad
Notable upstream pull request merges:
  #15024 Add missed DMU_PROJECTUSED_OBJECT prefetch
  #15029 Do not request data L1 buffers on scan prefetch
  #15036 FreeBSD: catch up to __FreeBSD_version 1400093
  #15039 Fix raw receive with different indirect block size
  #15047 FreeBSD: Fix build on stable/13 after 1302506
  #15049 Fix the ZFS checksum error histograms with larger record sizes
  #15052 Reduce bloat in ereport.fs.zfs.checksum events
  #15056 Avoid extra snprintf() in dsl_deadlist_merge()
  #15061 Ignore pool ashift property during vdev attachment
  #15063 Don't panic if setting vdev properties is unsupported for this vdev type
  #15067 spa_min_alloc should be GCD, not min
  #15071 Add explicit prefetches to bpobj_iterate()
  #15072 Adjust prefetch parameters
  #15076 Refactor dmu_prefetch()
  #15079 set autotrim default to 'off' everywhere
  #15080 ZIL: Fix config lock deadlock
  #15088 metaslab: tuneable to better control force ganging
  #15096 Avoid waiting in dmu_sync_late_arrival()
  #15097 BRT should return EOPNOTSUPP
  #15103 Remove zl_issuer_lock from zil_suspend()
  #15107 Remove fastwrite mechanism
  #15113 libzfs: sendrecv: send_progress_thread: handle SIGINFO/SIGUSR1
  #15122 ZIL: Second attempt to reduce scope of zl_issuer_lock
  #15129 zpool_vdev_remove() should handle EALREADY error return
  #15132 ZIL: Replay blocks without next block pointer
  #15148 zfs_clone_range should return descriptive error codes
  #15153 ZIL: Avoid dbuf_read() before dmu_sync()
  #15172 copy_file_range: fix fallback when source create on same txg
  #15180 Update outdated assertion from zio_write_compress

Obtained from:	OpenZFS
OpenZFS commit:	804414aad2
2023-08-26 23:51:42 +02:00
Jessica Clarke
968a3db715 kbdcontrol: Support building as a bootstrap tool on old and non-FreeBSD
Systems that predate 971bac5ace ("kbd: consolidate kb interfaces
(phase one)") cannot build kbdcontrol since kbdelays and kbrates moved
to sys/kbio.h. Moreover, on non-FreeBSD, it requires all kinds of ioctls
and sysctls that are highly FreeBSD-specific to build, but we use it as
a bootstrap tool to generate the keymaps used by some kernels (LINT ones
in particular). Thus, when bootstrapping kbdcontrol, disable everything
that's not needed for that singular use, and use the in-tree kbio.h to
get the definitions of the necessary structures.

This allows KBDMUX_DFLT_KEYMAP, UKBD_DFLT_KEYMAP and ATKBD_DFLT_KEYMAP
to be enabled when building on non-FreeBSD, and thus LINT kernels.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D41541
2023-08-22 21:00:28 +01:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
2726978bd8 Makefile.inc1: Remove redundant test for armv[67]
If MACHINE is arm, then MACHINE_ARCH is going to be either armv6* or
armv7*.

Sponsored by:		Netflix
2023-08-11 22:55:10 -06:00
John Baldwin
1c02497648 Makefile.inc1: Enable requesting the universe toolchain.
make universe builds a cross toolchain under HOST_OBJTMP/tmp via the
universe-toolchain target.  However, doing a plain 'make buildworld'
after a universe/tinderbox run (e.g. to reproduce a failure and test
the fix for it), will try to build a new cross toolchain under
OBJTMP/tmp which can be tedious.  This commit adds a make variable
(UNIVERSE_TOOLCHAIN) which can be used similar to CROSS_TOOLCHAIN to
request an external toolchain.  If this variable is set (value doesn't
matter), the the universe toolchain is used as an external toolchain.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40777
2023-08-01 14:01:57 -07:00
Jessica Clarke
9f81119276 Makefile.inc1: Fix list-old-libs by deleting stray pipe
Reported by:	Yuri <yuri@aetern.org>
Fixes:		264594efbe ("Makefile.inc1: Automatically generate _LIBCOMPATS and list-old-* libcompats")
2023-07-28 00:14:19 +01:00
Jessica Clarke
2a4d73f3cf Makefile.inc1: Reinstate kbdcontrol bootstrap for BUILD_WITH_STRICT_TMPPATH
During BUILD_WITH_STRICT_TMPPATH builds we need to symlink the host's
kbdcontrol into WORLDTMP/legacy/bin so that it can be used. For
completeness, also check if the host has it, since technically the host
could have been built with WITHOUT_LEGACY_CONSOLE (though given nobody's
screamed since this code was removed that's likely not something that
gets hit in practice), and handle BOOTSTRAP_ALL_TOOLS (especially since
that case will cover cross-building if and when kbdcontrol can be built
on non-FreeBSD).

This allows a BUILD_WITH_STRICT_TMPPATH tinderbox to pass.

This partially reverts commit 33550b4739.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41202
2023-07-27 05:10:49 +01:00
Jessica Clarke
d81da4c983 Makefile.inc1: Add new buildetc and installetc targets
These implement the steps that etcupdate (and mergemaster) need in order
to build their pristine trees, avoiding the need to use internal targets
and variables. Additionally, buildetc includes the steps needed to build
with BUILD_WITH_STRICT_TMPPATH enabled, since we need some host tools to
be available during the various build and install steps.

Reviewed by:	jhb, imp
Differential Revision:	https://reviews.freebsd.org/D41205
2023-07-27 05:10:49 +01:00
Jessica Clarke
8fc3059b00 Makefile.inc1: Split _cleanworldtmp out from _worldtmp
This mirrors _cleanobj vs _obj, and will be used by etcupdate to ensure
its build tree has host tools available when BUILD_WITH_STRICT_TMPPATH
is enabled by default (whether in the source tree, like CheriBSD, or in
a system config file).

Note that due to line length the .MAKE .PHONY dependency line is split
into two, one for the filtered WMAKE_TGTS and one for the filtered
.ALLTARGETS.

Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D41190
2023-07-27 05:10:48 +01:00
Jessica Clarke
65f28f63a7 tools/build: Create toolchain symlinks for non-absolute compiler/linker
If any of the toolchain variables are not absolute then we need to
create a symlink in WORLDTMP/legacy/bin in order to make them available
during a BUILD_WITH_STRICT_TMPPATH build.

Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D41188
2023-07-27 05:10:47 +01:00