aboutsummaryrefslogtreecommitdiff
path: root/tools/build
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/Makefile78
-rw-r--r--tools/build/cross-build/fflags.c62
-rw-r--r--tools/build/cross-build/include/common/exterr.h14
-rw-r--r--tools/build/cross-build/include/common/libutil.h2
-rw-r--r--tools/build/cross-build/include/common/sys/_types.h3
-rw-r--r--tools/build/cross-build/include/common/sys/exterrvar.h6
-rw-r--r--tools/build/cross-build/include/linux/libutil.h2
-rw-r--r--tools/build/cross-build/include/linux/sys/stat.h20
-rw-r--r--tools/build/cross-build/include/mac/endian.h7
-rw-r--r--tools/build/cross-build/include/mac/string.h7
-rwxr-xr-xtools/build/depend-cleanup.sh175
-rwxr-xr-xtools/build/make.py74
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc544
-rw-r--r--tools/build/options/WITHOUT_GSSAPI1
-rw-r--r--tools/build/options/WITHOUT_KERBEROS2
-rw-r--r--tools/build/options/WITHOUT_LLVM_TARGET_SPARC4
-rw-r--r--tools/build/options/WITHOUT_MALLOC_PRODUCTION7
-rw-r--r--tools/build/options/WITHOUT_MITKRB51
-rw-r--r--tools/build/options/WITH_CCACHE_BUILD7
-rw-r--r--tools/build/options/WITH_CLEAN3
-rw-r--r--tools/build/options/WITH_LLVM_TARGET_SPARC4
-rw-r--r--tools/build/options/WITH_MALLOC_PRODUCTION7
-rw-r--r--tools/build/options/WITH_MITKRB51
-rw-r--r--tools/build/options/WITH_PTHREADS_ASSERTIONS1
-rw-r--r--tools/build/options/WITH_RUN_TESTS1
-rw-r--r--tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT5
-rwxr-xr-xtools/build/options/makeman11
-rw-r--r--tools/build/options/makeman.lua791
-rw-r--r--tools/build/test-includes/Makefile3
-rw-r--r--tools/build/test-includes/badfiles.inc20
30 files changed, 1543 insertions, 320 deletions
diff --git a/tools/build/Makefile b/tools/build/Makefile
index f4bb383693a8..3c4e07e3cfc2 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -1,9 +1,18 @@
.PATH: ${.CURDIR}/../../include
+# XXX We need to include this to avoid installing MIT KRB5 includes on
+# XXX Heimdal systems. Remove the following line when Heimdal is finally
+# XXX removed.
+.include <src.opts.mk>
+
LIB= egacy
SRC=
INCSGROUPS= INCS SYSINCS CASPERINC UFSINCS FFSINCS MSDOSFSINCS DISKINCS
INCSGROUPS+= MACHINESYSINCS RPCINCS
+.if ${MK_MITKRB5} != "no"
+INCSGROUPS+= EDITINC K5GSSRPCINC GSSAPIINC
+INCSGROUPS+= K5GSSAPIINC K52GSSAPIINC KRB5INC
+.endif
INCS=
SYSINCSDIR= ${INCLUDEDIR}/sys
@@ -15,6 +24,16 @@ MSDOSFSINCSDIR= ${INCLUDEDIR}/fs/msdosfs
DISKINCSDIR= ${INCLUDEDIR}/sys/disk
MACHINESYSINCSDIR= ${INCLUDEDIR}/machine
RPCINCSDIR= ${INCLUDEDIR}/rpc
+.if ${MK_MITKRB5} != "no"
+EDITINCDIR= ${INCLUDEDIR}/edit/readline
+K5GSSRPCINCDIR= ${INCLUDEDIR}/gssrpc
+GSSAPIINCDIR= ${INCLUDEDIR}/gssapi
+K5GSSAPIINCDIR= ${INCLUDEDIR}/gssapi_krb5
+K52GSSAPIINCDIR=${INCLUDEDIR}/gssapi_krb5/gssapi
+KRB5INCDIR= ${INCLUDEDIR}/krb5
+KDB5INCDIR= ${INCLUDEDIR}/kdb5
+KADM5INCDIR= ${INCLUDEDIR}/kadm5
+.endif
BOOTSTRAPPING?= 0
@@ -212,8 +231,11 @@ CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \
-DHAVE_DIRFD -DHAVE_SYSCONF
# Provide getprogname/setprograme
SRCS+= progname.c
-# Stub implementations of fflagstostr/strtofflags
-SRCS+= fflags.c
+# Provide fflagstostr/strtofflags for mtree and makefs
+# On macOS we use the host's so conflate host and target flags, which ideally
+# we'd avoid, but in practice these align for many flags, including
+# SF_IMMUTABLE, the only flag we currently set during install.
+SRCS+= strtofflags.c
# macOS has a standalone cross-build implementation, but Linux can use the same
# ELF one as FreeBSD
@@ -248,11 +270,62 @@ subr_capability.c: ${SRCTOP}/sys/kern/subr_capability.c
cp ${.ALLSRC} ${.TARGET}
SRCS+= subr_capability.c
CLEANFILES+= subr_capability.c
+
+# Headers needed for msdosfs use in makefs
+SYSINCS+= ${SRCTOP}/sys/sys/_callout.h
+SYSINCS+= ${SRCTOP}/sys/sys/_lock.h
+SYSINCS+= ${SRCTOP}/sys/sys/_lockmgr.h
+SYSINCS+= ${SRCTOP}/sys/sys/_task.h
.endif # ${MAKE.OS} != "FreeBSD"
CASPERINC+= ${SRCTOP}/lib/libcasper/services/cap_fileargs/cap_fileargs.h
CASPERINC+= ${SRCTOP}/lib/libcasper/services/cap_net/cap_net.h
+.if ${MK_MITKRB5} != "no"
+EDITINC+= ${SRCTOP}/contrib/libedit/readline/readline.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/auth.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/auth_gss.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/auth_gssapi.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/auth_unix.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/clnt.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/netdb.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/pmap_clnt.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/pmap_prot.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/pmap_rmt.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/rpc_msg.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/rpc.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/svc_auth.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/svc.h
+K5GSSRPCINC+= ${SRCTOP}/krb5/include/gssrpc/types.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/xdr.h
+K5GSSRPCINC+= ${SRCTOP}/crypto/krb5/src/include/gssrpc/xdr.h
+GSSAPIINC+= ${SRCTOP}/crypto/krb5/src/lib/gssapi/krb5/gssapi_krb5.h
+GSSAPIINC+= ${SRCTOP}/crypto/krb5/src/lib/gssapi/generic/gssapi_alloc.h
+GSSAPIINC+= ${SRCTOP}/crypto/krb5/src/lib/gssapi/generic/gssapi_generic.h
+GSSAPIINC+= ${SRCTOP}/crypto/krb5/src/lib/gssapi/generic/gssapi_ext.h
+K5GSSAPIINC+= ${SRCTOP}/crypto/krb5/src/include/gssapi.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/ccselect_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/certauth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/clpreauth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/hostrealm_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/kadm5_auth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/kadm5_hook_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/kdcpolicy_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/kdcpreauth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/localauth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/locate_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/preauth_plugin.h
+KRB5INC+= ${SRCTOP}/crypto/krb5/src/include/krb5/pwqual_plugin.h
+INCS+= ${SRCTOP}/crypto/krb5/src/include/gssapi.h
+INCS+= ${SRCTOP}/crypto/krb5/src/include/kdb.h
+INCS+= ${SRCTOP}/crypto/krb5/src/include/krb5.h
+INCS+= ${SRCTOP}/crypto/krb5/src/include/krad.h
+INCS+= ${SRCTOP}/crypto/krb5/src/util/et/com_err.h
+INCS+= ${SRCTOP}/crypto/krb5/src/util/verto/verto-module.h
+INCS+= ${SRCTOP}/crypto/krb5/src/util/verto/verto.h
+.endif
+
.if empty(SRCS)
SRCS= dummy.c
.endif
@@ -422,6 +495,7 @@ INSTALLDIR_LIST= \
bin \
lib/geom \
usr/include/casper \
+ usr/include/openssl \
usr/include/private/ucl \
usr/include/private/zstd \
usr/lib \
diff --git a/tools/build/cross-build/fflags.c b/tools/build/cross-build/fflags.c
deleted file mode 100644
index f1d23c3637b6..000000000000
--- a/tools/build/cross-build/fflags.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory (Department of Computer Science and
- * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
- * DARPA SSITH research programme.
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
- * ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * This work was supported by Innovate UK project 105694, "Digital Security by
- * Design (DSbD) Technology Platform Prototype".
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <unistd.h>
-
-char *
-fflagstostr(u_long flags __unused)
-{
- return strdup("");
-}
-
-int
-strtofflags(char **stringp __unused, u_long *setp, u_long *clrp)
-{
- /* On linux just ignore the file flags for now */
- /*
- * XXX: this will prevent makefs from setting noschg on libc, etc.
- * so we should really find a way to support flags in disk images.
- */
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
- return (0); /* success */
-}
diff --git a/tools/build/cross-build/include/common/exterr.h b/tools/build/cross-build/include/common/exterr.h
new file mode 100644
index 000000000000..62482841c7b2
--- /dev/null
+++ b/tools/build/cross-build/include/common/exterr.h
@@ -0,0 +1,14 @@
+#ifndef _EXTERR_H_
+#define _EXTERR_H_
+
+#include <sys/types.h>
+
+static inline int
+uexterr_gettext(char *buf, size_t bufsz)
+{
+ if (bufsz > 0)
+ buf[0] = '\0';
+ return (0);
+}
+
+#endif
diff --git a/tools/build/cross-build/include/common/libutil.h b/tools/build/cross-build/include/common/libutil.h
index 15afd2fbca15..3cda32379965 100644
--- a/tools/build/cross-build/include/common/libutil.h
+++ b/tools/build/cross-build/include/common/libutil.h
@@ -39,4 +39,4 @@
#include_next <libutil.h>
#endif
-int expand_number(const char *_buf, uint64_t *_num);
+int expand_number(const char *_buf, int64_t *_num);
diff --git a/tools/build/cross-build/include/common/sys/_types.h b/tools/build/cross-build/include/common/sys/_types.h
index 408f0537d1e6..dc1b76f25063 100644
--- a/tools/build/cross-build/include/common/sys/_types.h
+++ b/tools/build/cross-build/include/common/sys/_types.h
@@ -48,3 +48,6 @@ typedef __builtin_va_list __va_list;
/* Needed for opensolaris compat. */
typedef __int64_t off64_t;
+
+/* Needed for sys/_callout.h */
+typedef __int64_t __sbintime_t;
diff --git a/tools/build/cross-build/include/common/sys/exterrvar.h b/tools/build/cross-build/include/common/sys/exterrvar.h
new file mode 100644
index 000000000000..0ba821aadef2
--- /dev/null
+++ b/tools/build/cross-build/include/common/sys/exterrvar.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_EXTERRVAR_H_
+#define _SYS_EXTERRVAR_H_
+
+#define UEXTERROR_MAXLEN 256
+
+#endif
diff --git a/tools/build/cross-build/include/linux/libutil.h b/tools/build/cross-build/include/linux/libutil.h
index 8f9ca406edc1..a1d6508be82d 100644
--- a/tools/build/cross-build/include/linux/libutil.h
+++ b/tools/build/cross-build/include/linux/libutil.h
@@ -46,7 +46,7 @@ struct pidfh;
__BEGIN_DECLS
int humanize_number(char *buf, size_t len, int64_t bytes, const char *suffix,
int scale, int flags);
-int expand_number(const char *_buf, uint64_t *_num);
+int expand_number(const char *_buf, int64_t *_num);
int flopen(const char *_path, int _flags, ...);
int flopenat(int dirfd, const char *path, int flags, ...);
diff --git a/tools/build/cross-build/include/linux/sys/stat.h b/tools/build/cross-build/include/linux/sys/stat.h
index 5937920ce461..1a69e127c2e1 100644
--- a/tools/build/cross-build/include/linux/sys/stat.h
+++ b/tools/build/cross-build/include/linux/sys/stat.h
@@ -66,5 +66,25 @@
#define ALLPERMS (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO)
#endif
+#define UF_SETTABLE 0x0000ffff
+#define UF_NODUMP 0x00000001
+#define UF_IMMUTABLE 0x00000002
+#define UF_APPEND 0x00000004
+#define UF_OPAQUE 0x00000008
+#define UF_NOUNLINK 0x00000010
+#define UF_SYSTEM 0x00000080
+#define UF_SPARSE 0x00000100
+#define UF_OFFLINE 0x00000200
+#define UF_REPARSE 0x00000400
+#define UF_ARCHIVE 0x00000800
+#define UF_READONLY 0x00001000
+#define UF_HIDDEN 0x00008000
+#define SF_SETTABLE 0xffff0000
+#define SF_ARCHIVED 0x00010000
+#define SF_IMMUTABLE 0x00020000
+#define SF_APPEND 0x00040000
+#define SF_NOUNLINK 0x00100000
+#define SF_SNAPSHOT 0x00200000
+
/* This include is needed for OpenZFS bootstrap */
#include <sys/mount.h>
diff --git a/tools/build/cross-build/include/mac/endian.h b/tools/build/cross-build/include/mac/endian.h
new file mode 100644
index 000000000000..11788044f05a
--- /dev/null
+++ b/tools/build/cross-build/include/mac/endian.h
@@ -0,0 +1,7 @@
+/*
+ * Copyright (c) 2025 John Baldwin <jhb@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <sys/endian.h>
diff --git a/tools/build/cross-build/include/mac/string.h b/tools/build/cross-build/include/mac/string.h
index d7db0d3023a4..58464f1f9834 100644
--- a/tools/build/cross-build/include/mac/string.h
+++ b/tools/build/cross-build/include/mac/string.h
@@ -38,9 +38,12 @@
#include_next <string.h>
/*
- * strchrnul is not provided by macOS and the strchrnul.c implementation
- * can not be compiled on macOS so just provide it inline here
+ * strchrnul is provided by macOS 15.4 and later. However, there is
+ * no good way to detect the current host version at compile time, so
+ * provide an inline definition under an alternate name.
*/
+#define strchrnul(p, ch) __freebsd_strchrnul(p, ch)
+
static inline char *
strchrnul(const char *p, int ch)
{
diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index eec073feca19..aa01db6ccc37 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -50,12 +50,12 @@
# - Replacing generated files with files committed to the tree. This is special
# case of moving from one directory to another. The stale generated file also
# needs to be deleted, so that it isn't found in make's .PATH. Note the
-# unconditional `rm -f`: there's no need for an extra call to first check for
+# unconditional `rm -fv`: there's no need for an extra call to first check for
# the file's existence.
#
# # 20250110 3863fec1ce2d add strlen SIMD implementation
# clean_dep lib/libc strlen S arm-optimized-routines
-# run rm -f "$OBJTOP"/lib/libc/strlen.S
+# run rm -fv "$OBJTOP"/lib/libc/strlen.S
#
# A rule may be required for only one architecture:
#
@@ -63,6 +63,10 @@
# if [ "$MACHINE_ARCH" = "amd64" ]; then
# clean_dep lib/libc bcmp c
# fi
+#
+# We also have a big hammer at the top of the tree, .clean_build_epoch, to be
+# used in severe cases where we can't surgically remove just the parts that
+# need rebuilt. This should be used sparingly.
set -e
set -u
@@ -80,7 +84,7 @@ err()
usage()
{
- echo "usage: $(basename $0) [-v] [-n] objtop" >&2
+ echo "usage: $(basename $0) [-v] [-n] objtop srctop" >&2
}
VERBOSE=
@@ -101,17 +105,31 @@ while getopts vn o; do
done
shift $((OPTIND-1))
-if [ $# -ne 1 ]; then
+if [ $# -ne 2 ]; then
usage
exit 1
fi
OBJTOP=$1
shift
+SRCTOP=$1
+shift
+
if [ ! -d "$OBJTOP" ]; then
err "$OBJTOP: Not a directory"
fi
+if [ ! -d "$SRCTOP" -o ! -f "$SRCTOP/Makefile.inc1" ]; then
+ err "$SRCTOP: Not the root of a src tree"
+fi
+
+: ${CLEANMK=""}
+if [ -n "$CLEANMK" ]; then
+ if [ -z "${MAKE+set}" ]; then
+ err "MAKE not set"
+ fi
+fi
+
if [ -z "${MACHINE+set}" ]; then
err "MACHINE not set"
fi
@@ -134,6 +152,11 @@ run()
fi
}
+# Clean the depend and object files for a given source file if the
+# depend file matches a regex (which defaults to the source file
+# name). This is typically used if a file was renamed, especially if
+# only its extension was changed (e.g. from .c to .cc).
+#
# $1 directory
# $2 source filename w/o extension
# $3 source extension
@@ -144,13 +167,97 @@ clean_dep()
dirprfx=${libcompat:+obj-lib${libcompat}/}
if egrep -qw "${4:-$2\.$3}" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
echo "Removing stale ${libcompat:+lib${libcompat} }dependencies and objects for $2.$3"
- run rm -f \
+ run rm -fv \
"$OBJTOP"/$dirprfx$1/.depend.$2.* \
"$OBJTOP"/$dirprfx$1/$2.*o
fi
done
}
+# Clean the object file for a given source file if it exists and
+# matches a regex. This is typically used if a a change in CFLAGS or
+# similar caused a change in the generated code without a change in
+# the sources.
+#
+# $1 directory
+# $2 source filename w/o extension
+# $3 source extension
+# $4 regex for egrep -w
+clean_obj()
+{
+ for libcompat in "" $ALL_libcompats; do
+ dirprfx=${libcompat:+obj-lib${libcompat}/}
+ if strings "$OBJTOP"/$dirprfx$1/$2.*o 2>/dev/null | egrep -qw "${4}"; then
+ echo "Removing stale ${libcompat:+lib${libcompat} }objects for $2.$3"
+ run rm -fv \
+ "$OBJTOP"/$dirprfx$1/$2.*o
+ fi
+ done
+}
+
+extract_epoch()
+{
+ [ -s "$1" ] || return 0
+
+ awk 'int($1) > 0 { epoch = $1 } END { print epoch }' "$1"
+}
+
+clean_world()
+{
+ local buildepoch="$1"
+
+ # The caller may set CLEANMK in the environment to make target(s) that
+ # should be invoked instead of just destroying everything. This is
+ # generally used after legacy/bootstrap tools to avoid over-cleansing
+ # since we're generally in the temporary tree's ancestor.
+ if [ -n "$CLEANMK" ]; then
+ echo "Cleaning up the object tree"
+ run $MAKE -C "$SRCTOP" -f "$SRCTOP"/Makefile.inc1 $CLEANMK
+ else
+ echo "Cleaning up the temporary build tree"
+ run rm -rf "$OBJTOP"
+ fi
+
+ # We don't assume that all callers will have grabbed the build epoch, so
+ # we'll do it here as needed. This will be useful if we add other
+ # non-epoch reasons to force clean.
+ if [ -z "$buildepoch" ]; then
+ buildepoch=$(extract_epoch "$SRCTOP"/.clean_build_epoch)
+ fi
+
+ mkdir -p "$OBJTOP"
+ echo "$buildepoch" > "$OBJTOP"/.clean_build_epoch
+
+ exit 0
+}
+
+check_epoch()
+{
+ local srcepoch objepoch
+
+ srcepoch=$(extract_epoch "$SRCTOP"/.clean_build_epoch)
+ if [ -z "$srcepoch" ]; then
+ err "Malformed .clean_build_epoch; please validate the last line"
+ fi
+
+ # We don't discriminate between the varying degrees of difference
+ # between epochs. If it went backwards we could be bisecting across
+ # epochs, in which case the original need to clean likely still stands.
+ objepoch=$(extract_epoch "$OBJTOP"/.clean_build_epoch)
+ if [ -z "$objepoch" ] || [ "$srcepoch" -ne "$objepoch" ]; then
+ if [ "$VERBOSE" ]; then
+ echo "Cleaning - src epoch: $srcepoch, objdir epoch: ${objepoch:-unknown}"
+ fi
+
+ clean_world "$srcepoch"
+ # NORETURN
+ fi
+}
+
+check_epoch
+
+#### Typical dependency cleanup begins here.
+
# Date Rev Description
# 20220326 fbc002cb72d2 move from bcmp.c to bcmp.S
@@ -162,7 +269,7 @@ fi
if stat "$OBJTOP"/tests/sys/kqueue/libkqueue/*kqtest* \
"$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.kqtest* >/dev/null 2>&1; then
echo "Removing old kqtest"
- run rm -f "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.* \
+ run rm -fv "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.* \
"$OBJTOP"/tests/sys/kqueue/libkqueue/*
fi
@@ -236,7 +343,7 @@ fi
if [ -f "$OBJTOP"/rescue/rescue/rescue.mk ] && \
! grep -q 'nvme_util.o' "$OBJTOP"/rescue/rescue/rescue.mk; then
echo "removing rescue.mk without nvme_util.o"
- run rm -f "$OBJTOP"/rescue/rescue/rescue.mk
+ run rm -fv "$OBJTOP"/rescue/rescue/rescue.mk
fi
# 20240910 e2df9bb44109
@@ -256,7 +363,7 @@ if [ ${MACHINE} = riscv ]; then
fi
if ! grep -q 'lib/libc/csu/riscv/reloc\.c' "$f"; then
echo "Removing stale dependencies and objects for libc_start1.c"
- run rm -f \
+ run rm -fv \
"$OBJTOP"/lib/libc/.depend.libc_start1.* \
"$OBJTOP"/lib/libc/libc_start1.*o
break
@@ -270,28 +377,28 @@ f="$p"/arm_mve_builtin_sema.inc
if [ -e "$f" ]; then
if grep -q SemaBuiltinConstantArgRange "$f"; then
echo "Removing pre-llvm19 clang-tblgen output"
- run rm -f "$p"/*.inc
+ run rm -fv "$p"/*.inc
fi
fi
# 20241025 cb5e41b16083 Unbundle hash functions fom lib/libcrypt
-clean_dep lib/libcrypt crypt-md5 c
-clean_dep lib/libcrypt crypt-nthash c
-clean_dep lib/libcrypt crypt-sha256 c
-clean_dep lib/libcrypt crypt-sha512 c
+clean_obj lib/libcrypt crypt-md5 c __MD5Init
+clean_obj lib/libcrypt crypt-nthash c __MD4Init
+clean_obj lib/libcrypt crypt-sha256 c __SHA256Init
+clean_obj lib/libcrypt crypt-sha512 c __SHA512Init
# 20241213 b55f5e1c4ae3 jemalloc: Move generated jemalloc.3 into lib/libc tree
if [ -h "$OBJTOP"/lib/libc/jemalloc.3 ]; then
# Have to cleanup the jemalloc.3 in the obj tree since make gets
# confused and won't use the one in lib/libc/malloc/jemalloc/jemalloc.3
echo "Removing stale jemalloc.3 object"
- run rm -f "$OBJTOP"/lib/libc/jemalloc.3
+ run rm -fv "$OBJTOP"/lib/libc/jemalloc.3
fi
if [ $MACHINE_ARCH = aarch64 ]; then
# 20250110 5e7d93a60440 add strcmp SIMD implementation
ALL_libcompats= clean_dep lib/libc strcmp S arm-optimized-routines
- run rm -f "$OBJTOP"/lib/libc/strcmp.S
+ run rm -fv "$OBJTOP"/lib/libc/strcmp.S
# 20250110 b91003acffe7 add strspn optimized implementation
ALL_libcompats= clean_dep lib/libc strspn c
@@ -310,7 +417,7 @@ if [ $MACHINE_ARCH = aarch64 ]; then
# 20250110 25c485e14769 add strncmp SIMD implementation
ALL_libcompats= clean_dep lib/libc strncmp S arm-optimized-routines
- run rm -f "$OBJTOP"/lib/libc/strncmp.S
+ run rm -fv "$OBJTOP"/lib/libc/strncmp.S
# 20250110 bad17991c06d add memccpy SIMD implementation
ALL_libcompats= clean_dep lib/libc memccpy c
@@ -321,11 +428,11 @@ if [ $MACHINE_ARCH = aarch64 ]; then
# 20250110 bea89d038ac5 add strlcat SIMD implementation, and move memchr
ALL_libcompats= clean_dep lib/libc strlcat c "libc.string.strlcat.c"
ALL_libcompats= clean_dep lib/libc memchr S "[[:space:]]memchr.S"
- run rm -f "$OBJTOP"/lib/libc/memchr.S
+ run rm -fv "$OBJTOP"/lib/libc/memchr.S
# 20250110 3863fec1ce2d add strlen SIMD implementation
ALL_libcompats= clean_dep lib/libc strlen S arm-optimized-routines
- run rm -f "$OBJTOP"/lib/libc/strlen.S
+ run rm -fv "$OBJTOP"/lib/libc/strlen.S
# 20250110 79e01e7e643c add bcopy & bzero wrapper
ALL_libcompats= clean_dep lib/libc bcopy c "libc.string.bcopy.c"
@@ -337,3 +444,35 @@ if [ $MACHINE_ARCH = aarch64 ]; then
# 20250110 3f224333af16 add timingsafe_memcmp() assembly implementation
ALL_libcompats= clean_dep lib/libc timingsafe_memcmp c
fi
+
+# 20250402 839d0755fea8 ctld converted to C++
+clean_dep usr.sbin/ctld ctld c
+clean_dep usr.sbin/ctld conf c
+clean_dep usr.sbin/ctld discovery c
+clean_dep usr.sbin/ctld isns c
+clean_dep usr.sbin/ctld kernel c
+clean_dep usr.sbin/ctld login c
+clean_dep usr.sbin/ctld uclparse c
+
+# 20250425 2e47f35be5dc libllvm, libclang and liblldb became shared libraries
+if [ -f "$OBJTOP"/lib/clang/libllvm/libllvm.a ]; then
+ echo "Removing old static libllvm library"
+ run rm -fv "$OBJTOP"/lib/clang/libllvm/libllvm.a
+fi
+if [ -f "$OBJTOP"/lib/clang/libclang/libclang.a ]; then
+ echo "Removing old static libclang library"
+ run rm -fv "$OBJTOP"/lib/clang/libclang/libclang.a
+fi
+if [ -f "$OBJTOP"/lib/clang/liblldb/liblldb.a ]; then
+ echo "Removing old static liblldb library"
+ run rm -fv "$OBJTOP"/lib/clang/liblldb/liblldb.a
+fi
+
+# 20250813 4f766afc1ca0 tcopy converted to C++
+clean_dep usr.bin/tcopy tcopy c
+
+# 20250904 aef807876c30 moused binary to directory
+if [ -f "$OBJTOP"/usr.sbin/moused/moused ]; then
+ echo "Removing old moused binary"
+ run rm -fv "$OBJTOP"/usr.sbin/moused/moused
+fi
diff --git a/tools/build/make.py b/tools/build/make.py
index ec42cb70dd21..2f36a3e23e32 100755
--- a/tools/build/make.py
+++ b/tools/build/make.py
@@ -34,12 +34,24 @@
# On FreeBSD you can use it the same way as just calling make:
# `MAKEOBJDIRPREFIX=~/obj ./tools/build/make.py buildworld -DWITH_FOO`
#
-# On Linux and MacOS you will either need to set XCC/XCXX/XLD/XCPP or pass
-# --cross-bindir to specify the path to the cross-compiler bindir:
-# `MAKEOBJDIRPREFIX=~/obj ./tools/build/make.py
-# --cross-bindir=/path/to/cross/compiler buildworld -DWITH_FOO TARGET=foo
-# TARGET_ARCH=bar`
+# On Linux and MacOS you may need to explicitly indicate the cross toolchain
+# to use. You can do this by:
+# - setting XCC/XCXX/XLD/XCPP to the paths of each tool
+# - using --cross-bindir to specify the path to the cross-compiler bindir:
+# `MAKEOBJDIRPREFIX=~/obj ./tools/build/make.py
+# --cross-bindir=/path/to/cross/compiler buildworld -DWITH_FOO TARGET=foo
+# TARGET_ARCH=bar`
+# - using --cross-toolchain to specify the package containing the cross-compiler
+# (MacOS only currently):
+# `MAKEOBJDIRPREFIX=~/obj ./tools/build/make.py
+# --cross-toolchain=llvm@NN buildworld -DWITH_FOO TARGET=foo
+# TARGET_ARCH=bar`
+#
+# On MacOS, this tool will search for an llvm toolchain installed via brew and
+# use it as the cross toolchain if an explicit toolchain is not specified.
+
import argparse
+import functools
import os
import shlex
import shutil
@@ -159,7 +171,8 @@ def check_required_make_env_var(varname, binary_name, bindir):
return
if not bindir:
sys.exit("Could not infer value for $" + varname + ". Either set $" +
- varname + " or pass --cross-bindir=/cross/compiler/dir/bin")
+ varname + " or pass --cross-bindir=/cross/compiler/dir/bin" +
+ " or --cross-toolchain=<package>")
# try to infer the path to the tool
guess = os.path.join(bindir, binary_name)
if not os.path.isfile(guess):
@@ -178,24 +191,45 @@ def check_xtool_make_env_var(varname, binary_name):
return
global parsed_args
if parsed_args.cross_bindir is None:
- parsed_args.cross_bindir = default_cross_toolchain()
+ cross_bindir = cross_toolchain_bindir(binary_name,
+ parsed_args.cross_toolchain)
+ else:
+ cross_bindir = parsed_args.cross_bindir
return check_required_make_env_var(varname, binary_name,
- parsed_args.cross_bindir)
+ cross_bindir)
+
+
+@functools.cache
+def brew_prefix(package: str) -> str:
+ path = subprocess.run(["brew", "--prefix", package], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).stdout.strip()
+ debug("Inferred", package, "dir as", path)
+ return path.decode("utf-8")
+def binary_path(bindir: str, binary_name: str) -> "Optional[str]":
+ try:
+ if bindir and Path(bindir, "bin", binary_name).exists():
+ return str(Path(bindir, "bin"))
+ except OSError:
+ pass
+ return None
-def default_cross_toolchain():
+def cross_toolchain_bindir(binary_name: str, package: "Optional[str]") -> str:
# default to homebrew-installed clang on MacOS if available
if sys.platform.startswith("darwin"):
if shutil.which("brew"):
- llvm_dir = subprocess.run([
- "brew", "--prefix", "llvm"],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.strip()
- debug("Inferred LLVM dir as", llvm_dir)
- try:
- if llvm_dir and Path(llvm_dir.decode("utf-8"), "bin").exists():
- return str(Path(llvm_dir.decode("utf-8"), "bin"))
- except OSError:
- return None
+ if not package:
+ package = "llvm"
+ bindir = binary_path(brew_prefix(package), binary_name)
+ if bindir:
+ return bindir
+
+ # brew installs lld as a separate package for LLVM 19 and later
+ if binary_name == "ld.lld":
+ lld_package = package.replace("llvm", "lld")
+ bindir = binary_path(brew_prefix(lld_package), binary_name)
+ if bindir:
+ return bindir
return None
@@ -215,6 +249,10 @@ if __name__ == "__main__":
help="Compiler type to find in --cross-bindir (only "
"needed if XCC/XCPP/XLD are not set)"
"Note: using CC is currently highly experimental")
+ parser.add_argument("--cross-toolchain", default=None,
+ help="Name of package containing cc/c++/cpp/ld to build "
+ "target binaries (only needed if XCC/XCPP/XLD "
+ "are not set)")
parser.add_argument("--host-compiler-type", choices=("cc", "clang", "gcc"),
default="cc",
help="Compiler type to find in --host-bindir (only "
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index b25f551d069b..a2fb28f1a186 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -55,10 +55,6 @@ OLD_FILES+=usr/share/man/man8/acpidump.8.gz
OLD_FILES+=usr/share/man/man8/iasl.8.gz
.endif
-.if ${MK_ACPI} == no && ${MK_APM} == no
-OLD_FILES+=etc/rc.d/powerd
-.endif
-
.if ${MK_APM} == no
OLD_FILES+=etc/rc.d/apm
OLD_FILES+=etc/rc.d/apmd
@@ -361,7 +357,6 @@ OLD_FILES+=boot/shortcuts.4th
OLD_FILES+=boot/support.4th
OLD_FILES+=boot/userboot.so
OLD_FILES+=boot/version.4th
-OLD_FILES+=boot/zfsboot
OLD_FILES+=boot/zfsloader
OLD_FILES+=usr/lib/kgzldr.o
OLD_FILES+=usr/share/man/man5/loader.conf.5.gz
@@ -378,7 +373,6 @@ OLD_FILES+=usr/share/man/man8/menu.4th.8.gz
OLD_FILES+=usr/share/man/man8/menusets.4th.8.gz
OLD_FILES+=usr/share/man/man8/pxeboot.8.gz
OLD_FILES+=usr/share/man/man8/version.4th.8.gz
-OLD_FILES+=usr/share/man/man8/zfsboot.8.gz
OLD_FILES+=usr/share/man/man8/zfsloader.8.gz
.endif
@@ -413,6 +407,8 @@ OLD_FILES+=usr/libexec/bsdinstall/distfetch
OLD_FILES+=usr/libexec/bsdinstall/docsinstall
OLD_FILES+=usr/libexec/bsdinstall/entropy
OLD_FILES+=usr/libexec/bsdinstall/fetchmissingdists
+OLD_FILES+=usr/libexec/bsdinstall/finalconfig
+OLD_FILES+=usr/libexec/bsdinstall/firmware
OLD_FILES+=usr/libexec/bsdinstall/hardening
OLD_FILES+=usr/libexec/bsdinstall/hostname
OLD_FILES+=usr/libexec/bsdinstall/jail
@@ -423,6 +419,7 @@ OLD_FILES+=usr/libexec/bsdinstall/netconfig
OLD_FILES+=usr/libexec/bsdinstall/netconfig_ipv4
OLD_FILES+=usr/libexec/bsdinstall/netconfig_ipv6
OLD_FILES+=usr/libexec/bsdinstall/partedit
+OLD_FILES+=usr/libexec/bsdinstall/pkgbase
OLD_FILES+=usr/libexec/bsdinstall/rootpass
OLD_FILES+=usr/libexec/bsdinstall/runconsoles
OLD_FILES+=usr/libexec/bsdinstall/script
@@ -462,7 +459,7 @@ OLD_FILES+=usr/include/bsnmp/snmpclient.h
OLD_FILES+=usr/include/bsnmp/snmpmod.h
OLD_FILES+=usr/lib/libbsnmp.a
OLD_FILES+=usr/lib/libbsnmp.so
-OLD_LIBS+=usr/lib/libbsnmp.so.6
+OLD_LIBS+=usr/lib/libbsnmp.so.7
OLD_FILES+=usr/lib/libbsnmp_p.a
OLD_FILES+=usr/lib/libbsnmptools.a
OLD_FILES+=usr/lib/libbsnmptools.so
@@ -875,6 +872,15 @@ OLD_FILES+=usr/share/man/man4/ccd.4.gz
OLD_FILES+=usr/share/man/man8/ccdconfig.8.gz
.endif
+.if ${MK_CLANG} == no && ${MK_CLANG_FORMAT} == no && ${MK_LLDB} == no
+OLD_LIBS+=usr/lib/libprivateclang.so.19
+.endif
+
+.if ${MK_CLANG_EXTRAS} == no && ${MK_CLANG} == no && ${MK_LLDB} == no && \
+ ${MK_LLD} == no && ${MK_LLVM_BINUTILS} == no && ${MK_LLVM_COV} == no
+OLD_LIBS+=usr/lib/libprivatellvm.so.19
+.endif
+
.if ${MK_CLANG} == no && ${MK_LLVM_BINUTILS} == no
OLD_FILES+=usr/bin/llvm-addr2line
OLD_FILES+=usr/bin/llvm-ar
@@ -1433,6 +1439,10 @@ OLD_LIBS+=${DEBUG_LIBS}
.endif
.endif
+.if ${MK_DETECT_TZ_CHANGES} == no
+OLD_FILES+=tests/lib/libc/stdtime/detect_tz_changes_test
+.endif
+
.if ${MK_DIALOG} == no
OLD_FILES+=usr/bin/dialog
OLD_FILES+=usr/bin/dpv
@@ -1461,12 +1471,12 @@ OLD_DIRS+=usr/share/dict
.endif
.if ${MK_DMAGENT} == no
+OLD_FILES+=etc/dma/auth.conf
OLD_FILES+=etc/dma/dma.conf
OLD_DIRS+=etc/dma
OLD_FILES+=usr/libexec/dma
OLD_FILES+=usr/libexec/dma-mbox-create
OLD_FILES+=usr/share/man/man8/dma.8.gz
-OLD_FILES+=usr/share/examples/dma/auth.conf
OLD_FILES+=usr/share/examples/dma/mailer.conf
OLD_DIRS+=usr/share/examples/dma
.endif
@@ -1629,6 +1639,7 @@ OLD_FILES+=usr/bin/ree
OLD_FILES+=usr/share/man/man1/edit.1.gz
OLD_FILES+=usr/share/man/man1/ee.1.gz
OLD_FILES+=usr/share/man/man1/ree.1.gz
+OLD_FILES+=usr/share/misc/init.ee
OLD_FILES+=usr/share/nls/C/ee.cat
OLD_FILES+=usr/share/nls/de_DE.ISO8859-1/ee.cat
OLD_FILES+=usr/share/nls/fr_FR.ISO8859-1/ee.cat
@@ -1675,9 +1686,6 @@ OLD_FILES+=usr/share/examples/diskless/README.BOOTP
OLD_FILES+=usr/share/examples/diskless/README.TEMPLATING
OLD_FILES+=usr/share/examples/diskless/clone_root
OLD_FILES+=usr/share/examples/dma/mailer.conf
-OLD_FILES+=usr/share/examples/drivers/README
-OLD_FILES+=usr/share/examples/drivers/make_device_driver.sh
-OLD_FILES+=usr/share/examples/drivers/make_pseudo_driver.sh
OLD_FILES+=usr/share/examples/dwatch/profile_template
OLD_FILES+=usr/share/examples/etc/README.examples
OLD_FILES+=usr/share/examples/etc/bsd-style-copyright
@@ -1701,6 +1709,8 @@ OLD_FILES+=usr/share/examples/hostapd/hostapd.conf
OLD_FILES+=usr/share/examples/hostapd/hostapd.eap_user
OLD_FILES+=usr/share/examples/hostapd/hostapd.wpa_psk
OLD_FILES+=usr/share/examples/indent/indent.pro
+OLD_FILES+=usr/share/examples/inotify/Makefile
+OLD_FILES+=usr/share/examples/inotify/inotify.c
OLD_FILES+=usr/share/examples/ipfilter/BASIC.NAT
OLD_FILES+=usr/share/examples/ipfilter/BASIC_1.FW
OLD_FILES+=usr/share/examples/ipfilter/BASIC_2.FW
@@ -1904,7 +1914,6 @@ OLD_DIRS+=usr/share/examples/bsdconfig
OLD_DIRS+=usr/share/examples/csh
OLD_DIRS+=usr/share/examples/diskless
OLD_DIRS+=usr/share/examples/dma
-OLD_DIRS+=usr/share/examples/drivers
OLD_DIRS+=usr/share/examples/dwatch
OLD_DIRS+=usr/share/examples/etc
OLD_DIRS+=usr/share/examples/etc/defaults
@@ -1914,6 +1923,7 @@ OLD_DIRS+=usr/share/examples/hast
OLD_DIRS+=usr/share/examples/ibcs2
OLD_DIRS+=usr/share/examples/hostapd
OLD_DIRS+=usr/share/examples/indent
+OLD_DIRS+=usr/share/examples/inotify
OLD_DIRS+=usr/share/examples/ipfilter
OLD_DIRS+=usr/share/examples/ipfw
OLD_DIRS+=usr/share/examples/jails
@@ -1984,6 +1994,32 @@ OLD_FILES+=usr/share/man/man8/fdcontrol.8.gz
.endif
.if ${MK_FORTH} == no
+OLD_FILES+=boot/beastie.4th
+OLD_FILES+=boot/brand-fbsd.4th
+OLD_FILES+=boot/brand.4th
+OLD_FILES+=boot/check-password.4th
+OLD_FILES+=boot/color.4th
+OLD_FILES+=boot/delay.4th
+OLD_FILES+=boot/efi.4th
+OLD_FILES+=boot/frames.4th
+OLD_FILES+=boot/loader_4th
+OLD_FILES+=boot/loader_4th.efi
+OLD_FILES+=boot/loader_4th.efi.old
+OLD_FILES+=boot/loader_4th.old
+OLD_FILES+=boot/loader.4th
+OLD_FILES+=boot/logo-beastie.4th
+OLD_FILES+=boot/logo-beastiebw.4th
+OLD_FILES+=boot/logo-fbsdbw.4th
+OLD_FILES+=boot/logo-orb.4th
+OLD_FILES+=boot/logo-orbbw.4th
+OLD_FILES+=boot/menu-commands.4th
+OLD_FILES+=boot/menu.4th
+OLD_FILES+=boot/menusets.4th
+OLD_FILES+=boot/screen.4th
+OLD_FILES+=boot/shortcuts.4th
+OLD_FILES+=boot/support.4th
+OLD_LIBS+=boot/userboot_4th.so
+OLD_FILES+=boot/version.4th
OLD_FILES+=usr/share/man/man8/beastie.4th.8.gz
OLD_FILES+=usr/share/man/man8/brand.4th.8.gz
OLD_FILES+=usr/share/man/man8/check-password.4th.8.gz
@@ -2226,79 +2262,6 @@ OLD_FILES+=usr/share/man/man3/gpio_pin_tristate.3.gz
OLD_FILES+=usr/share/man/man8/gpioctl.8.gz
.endif
-.if ${MK_GSSAPI} == no
-OLD_FILES+=usr/include/gssapi/gssapi.h
-OLD_DIRS+=usr/include/gssapi
-OLD_FILES+=usr/include/gssapi.h
-OLD_FILES+=usr/lib/libgssapi.a
-OLD_FILES+=usr/lib/libgssapi.so
-OLD_LIBS+=usr/lib/libgssapi.so.10
-OLD_FILES+=usr/lib/libgssapi_p.a
-OLD_FILES+=usr/lib/librpcsec_gss.a
-OLD_FILES+=usr/lib/librpcsec_gss.so
-OLD_LIBS+=usr/lib/librpcsec_gss.so.1
-OLD_FILES+=usr/sbin/gssd
-OLD_FILES+=usr/share/man/man3/gss_accept_sec_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_acquire_cred.3.gz
-OLD_FILES+=usr/share/man/man3/gss_add_cred.3.gz
-OLD_FILES+=usr/share/man/man3/gss_add_oid_set_member.3.gz
-OLD_FILES+=usr/share/man/man3/gss_canonicalize_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_compare_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_context_time.3.gz
-OLD_FILES+=usr/share/man/man3/gss_create_empty_oid_set.3.gz
-OLD_FILES+=usr/share/man/man3/gss_delete_sec_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_display_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_display_status.3.gz
-OLD_FILES+=usr/share/man/man3/gss_duplicate_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_export_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_export_sec_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_get_mic.3.gz
-OLD_FILES+=usr/share/man/man3/gss_import_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_import_sec_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_indicate_mechs.3.gz
-OLD_FILES+=usr/share/man/man3/gss_init_sec_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_inquire_context.3.gz
-OLD_FILES+=usr/share/man/man3/gss_inquire_cred.3.gz
-OLD_FILES+=usr/share/man/man3/gss_inquire_cred_by_mech.3.gz
-OLD_FILES+=usr/share/man/man3/gss_inquire_mechs_for_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_inquire_names_for_mech.3.gz
-OLD_FILES+=usr/share/man/man3/gss_process_context_token.3.gz
-OLD_FILES+=usr/share/man/man3/gss_release_buffer.3.gz
-OLD_FILES+=usr/share/man/man3/gss_release_cred.3.gz
-OLD_FILES+=usr/share/man/man3/gss_release_name.3.gz
-OLD_FILES+=usr/share/man/man3/gss_release_oid_set.3.gz
-OLD_FILES+=usr/share/man/man3/gss_seal.3.gz
-OLD_FILES+=usr/share/man/man3/gss_sign.3.gz
-OLD_FILES+=usr/share/man/man3/gss_test_oid_set_member.3.gz
-OLD_FILES+=usr/share/man/man3/gss_unseal.3.gz
-OLD_FILES+=usr/share/man/man3/gss_unwrap.3.gz
-OLD_FILES+=usr/share/man/man3/gss_verify.3.gz
-OLD_FILES+=usr/share/man/man3/gss_verify_mic.3.gz
-OLD_FILES+=usr/share/man/man3/gss_wrap.3.gz
-OLD_FILES+=usr/share/man/man3/gss_wrap_size_limit.3.gz
-OLD_FILES+=usr/share/man/man3/gssapi.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_get_error.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_get_mech_info.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_get_mechanisms.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_get_principal_name.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_get_versions.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_getcred.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_is_installed.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_max_data_length.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_mech_to_oid.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_oid_to_mech.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_qop_to_num.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_seccreate.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_set_callback.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_set_defaults.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_set_svc_name.3.gz
-OLD_FILES+=usr/share/man/man3/rpc_gss_svc_max_data_length.3.gz
-OLD_FILES+=usr/share/man/man3/rpcsec_gss.3.gz
-OLD_FILES+=usr/share/man/man5/mech.5.gz
-OLD_FILES+=usr/share/man/man5/qop.5.gz
-OLD_FILES+=usr/share/man/man8/gssd.8.gz
-.endif
-
.if ${MK_HAST} == no
OLD_FILES+=etc/rc.d/hastd
OLD_FILES+=sbin/hastctl
@@ -2654,6 +2617,7 @@ OLD_FILES+=usr/share/man/man8/ippool.8.gz
.if ${MK_IPFW} == no
OLD_FILES+=etc/rc.d/ipfw
+OLD_FILES+=etc/rc.d/natd
OLD_FILES+=etc/periodic/security/500.ipfwdenied
OLD_FILES+=etc/periodic/security/550.ipfwlimit
OLD_FILES+=sbin/ipfw
@@ -2695,23 +2659,99 @@ OLD_FILES+=usr/share/man/man1/kdump.1.gz
OLD_FILES+=usr/share/man/man1/truss.1.gz
.endif
-.if ${MK_KERBEROS} == no
-OLD_FILES+=etc/rc.d/ipropd_master
-OLD_FILES+=etc/rc.d/ipropd_slave
-OLD_FILES+=usr/bin/asn1_compile
+.if ${MK_KERBEROS_SUPPORT} == "no"
+OLD_FILES+=etc/rc.d/gssd
+OLD_FILES+=usr/sbin/gssd
+OLD_FILES+=usr/share/man/man8/gssd.8.gz
+.endif
+
+# Kerberos files which are installed by both Heimdal and MIT. These should
+# only be removed if Kerberos is disabled entirely.
+.if ${MK_KERBEROS} == "no"
+
OLD_FILES+=usr/bin/compile_et
-OLD_FILES+=usr/bin/hxtool
+OLD_FILES+=usr/share/man/man1/compile_et.1.gz
+# This is kadmin(1) in MIT but kadmin(8) in Heimdal, therefore the manpage
+# is not listed here.
OLD_FILES+=usr/bin/kadmin
-OLD_FILES+=usr/bin/kcc
OLD_FILES+=usr/bin/kdestroy
-OLD_FILES+=usr/bin/kf
-OLD_FILES+=usr/bin/kgetcred
+OLD_FILES+=usr/share/man/man1/kdestroy.1.gz
OLD_FILES+=usr/bin/kinit
+OLD_FILES+=usr/share/man/man1/kinit.1.gz
OLD_FILES+=usr/bin/klist
+OLD_FILES+=usr/share/man/man1/klist.1.gz
OLD_FILES+=usr/bin/kpasswd
+OLD_FILES+=usr/share/man/man1/kpasswd.1.gz
OLD_FILES+=usr/bin/krb5-config
-OLD_FILES+=usr/bin/ksu
+OLD_FILES+=usr/share/man/man1/krb5-config.1.gz
OLD_FILES+=usr/bin/kswitch
+OLD_FILES+=usr/share/man/man1/kswitch.1.gz
+# MIT has a manpage for this, Heimdal does not.
+OLD_FILES+=usr/bin/ksu
+
+OLD_FILES+=usr/include/com_err.h
+OLD_FILES+=usr/include/gssapi.h
+OLD_FILES+=usr/include/gssapi/gssapi.h
+OLD_FILES+=usr/include/gssapi/gssapi_krb5.h
+OLD_FILES+=usr/include/kadm5/admin.h
+OLD_FILES+=usr/include/krb5.h
+OLD_FILES+=usr/include/krb5/locate_plugin.h
+
+OLD_FILES+=usr/lib/libcom_err.a
+OLD_FILES+=usr/lib/libcom_err.so
+OLD_FILES+=usr/lib/libgssapi_krb5.a
+OLD_FILES+=usr/lib/libgssapi_krb5.so
+OLD_FILES+=usr/lib/libkadm5clnt.so
+OLD_FILES+=usr/lib/libkrb5.a
+OLD_FILES+=usr/lib/libkrb5.so
+OLD_FILES+=usr/lib/librpcsec_gss.a
+OLD_FILES+=usr/lib/librpcsec_gss.so
+OLD_LIBS+=usr/lib/librpcsec_gss.so.1
+OLD_FILES+=usr/lib/pam_krb5.so
+OLD_LIBS+=usr/lib/pam_krb5.so.6
+OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
+OLD_FILES+=usr/lib/pam_ksu.so
+OLD_LIBS+=usr/lib/pam_ksu.so.6
+OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
+
+OLD_FILES+=usr/libexec/kadmind
+OLD_FILES+=usr/share/man/man8/kadmind.8.gz
+
+OLD_FILES+=usr/share/man/man3/com_err.3.gz
+OLD_FILES+=usr/share/man/man3/rpcsec_gss.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_get_error.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_get_mech_info.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_get_mechanisms.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_get_principal_name.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_get_versions.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_getcred.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_is_installed.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_max_data_length.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_mech_to_oid.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_oid_to_mech.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_qop_to_num.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_seccreate.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_set_callback.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_set_defaults.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_set_svc_name.3.gz
+OLD_FILES+=usr/share/man/man3/rpc_gss_svc_max_data_length.3.gz
+OLD_FILES+=usr/share/man/man5/krb5.conf.5.gz
+.endif # ${MK_KERBEROS} == "no"
+
+# Heimdal-specific files that don't exist in MIT Kerberos. These should be
+# removed if Kerberos is disabled, or if MIT Kerberos is selected.
+.if ${MK_KERBEROS} == "no" || ${MK_MITKRB5} != "no"
+
+# compile_et is a binary in Heimdal, but a shell script in MIT Kerberos.
+# When switching from Heimdal to MIT, we need to remove the debug symbols
+# explicitly.
+OLD_FILES+=usr/lib/debug/usr/bin/compile_et.debug
+
+OLD_FILES+=usr/bin/asn1_compile
+OLD_FILES+=usr/bin/hxtool
+OLD_FILES+=usr/bin/kcc
+OLD_FILES+=usr/bin/kf
+OLD_FILES+=usr/bin/kgetcred
OLD_FILES+=usr/bin/make-roken
OLD_FILES+=usr/bin/slc
OLD_FILES+=usr/bin/string2key
@@ -2720,13 +2760,13 @@ OLD_FILES+=usr/include/asn1-common.h
OLD_FILES+=usr/include/asn1_err.h
OLD_FILES+=usr/include/base64.h
OLD_FILES+=usr/include/cms_asn1.h
+OLD_FILES+=usr/include/com_right.h
OLD_FILES+=usr/include/crmf_asn1.h
OLD_FILES+=usr/include/der-private.h
OLD_FILES+=usr/include/der-protos.h
OLD_FILES+=usr/include/der.h
OLD_FILES+=usr/include/digest_asn1.h
OLD_FILES+=usr/include/getarg.h
-OLD_FILES+=usr/include/gssapi/gssapi_krb5.h
OLD_FILES+=usr/include/hdb-protos.h
OLD_FILES+=usr/include/hdb.h
OLD_FILES+=usr/include/hdb_asn1.h
@@ -2743,25 +2783,20 @@ OLD_FILES+=usr/include/hx509-protos.h
OLD_FILES+=usr/include/hx509.h
OLD_FILES+=usr/include/hx509_err.h
OLD_FILES+=usr/include/k524_err.h
-OLD_FILES+=usr/include/kadm5/admin.h
OLD_FILES+=usr/include/kadm5/kadm5-private.h
OLD_FILES+=usr/include/kadm5/kadm5-protos.h
OLD_FILES+=usr/include/kadm5/kadm5-pwcheck.h
OLD_FILES+=usr/include/kadm5/kadm5_err.h
OLD_FILES+=usr/include/kadm5/private.h
-OLD_DIRS+=usr/include/kadm5
OLD_FILES+=usr/include/kafs.h
OLD_FILES+=usr/include/kdc-protos.h
OLD_FILES+=usr/include/kdc.h
OLD_FILES+=usr/include/krb5-private.h
OLD_FILES+=usr/include/krb5-protos.h
OLD_FILES+=usr/include/krb5-types.h
-OLD_FILES+=usr/include/krb5.h
OLD_FILES+=usr/include/krb5/ccache_plugin.h
-OLD_FILES+=usr/include/krb5/locate_plugin.h
OLD_FILES+=usr/include/krb5/send_to_kdc_plugin.h
OLD_FILES+=usr/include/krb5/windc_plugin.h
-OLD_DIRS+=usr/include/krb5
OLD_FILES+=usr/include/krb5_asn1.h
OLD_FILES+=usr/include/krb5_ccapi.h
OLD_FILES+=usr/include/krb5_err.h
@@ -2779,113 +2814,98 @@ OLD_FILES+=usr/include/pkinit_asn1.h
OLD_FILES+=usr/include/resolve.h
OLD_FILES+=usr/include/rfc2459_asn1.h
OLD_FILES+=usr/include/roken-common.h
+OLD_FILES+=usr/include/roken.h
OLD_FILES+=usr/include/rtbl.h
OLD_FILES+=usr/include/wind.h
OLD_FILES+=usr/include/wind_err.h
OLD_FILES+=usr/include/xdbm.h
OLD_FILES+=usr/lib/libasn1.a
OLD_FILES+=usr/lib/libasn1.so
-OLD_LIBS+=usr/lib/libasn1.so.11
-OLD_FILES+=usr/lib/libasn1_p.a
-OLD_FILES+=usr/lib/libcom_err.a
-OLD_FILES+=usr/lib/libcom_err.so
-OLD_LIBS+=usr/lib/libcom_err.so.5
-OLD_FILES+=usr/lib/libcom_err_p.a
-OLD_FILES+=usr/lib/libgssapi_krb5.a
-OLD_FILES+=usr/lib/libgssapi_krb5.so
-OLD_LIBS+=usr/lib/libgssapi_krb5.so.10
-OLD_FILES+=usr/lib/libgssapi_krb5_p.a
+OLD_FILES+=usr/lib/libgssapi.a
+OLD_FILES+=usr/lib/libgssapi.so
OLD_FILES+=usr/lib/libgssapi_ntlm.a
OLD_FILES+=usr/lib/libgssapi_ntlm.so
-OLD_LIBS+=usr/lib/libgssapi_ntlm.so.10
-OLD_FILES+=usr/lib/libgssapi_ntlm_p.a
OLD_FILES+=usr/lib/libgssapi_spnego.a
OLD_FILES+=usr/lib/libgssapi_spnego.so
-OLD_LIBS+=usr/lib/libgssapi_spnego.so.10
-OLD_FILES+=usr/lib/libgssapi_spnego_p.a
OLD_FILES+=usr/lib/libhdb.a
OLD_FILES+=usr/lib/libhdb.so
-OLD_LIBS+=usr/lib/libhdb.so.11
-OLD_FILES+=usr/lib/libhdb_p.a
OLD_FILES+=usr/lib/libheimbase.a
OLD_FILES+=usr/lib/libheimbase.so
-OLD_LIBS+=usr/lib/libheimbase.so.11
-OLD_FILES+=usr/lib/libheimbase_p.a
OLD_FILES+=usr/lib/libheimntlm.a
OLD_FILES+=usr/lib/libheimntlm.so
-OLD_LIBS+=usr/lib/libheimntlm.so.11
-OLD_FILES+=usr/lib/libheimntlm_p.a
-OLD_FILES+=usr/lib/libheimsqlite.a
-OLD_FILES+=usr/lib/libheimsqlite.so
-OLD_LIBS+=usr/lib/libheimsqlite.so.11
-OLD_FILES+=usr/lib/libheimsqlite_p.a
OLD_FILES+=usr/lib/libhx509.a
OLD_FILES+=usr/lib/libhx509.so
-OLD_LIBS+=usr/lib/libhx509.so.11
-OLD_FILES+=usr/lib/libhx509_p.a
OLD_FILES+=usr/lib/libkadm5clnt.a
-OLD_FILES+=usr/lib/libkadm5clnt.so
-OLD_LIBS+=usr/lib/libkadm5clnt.so.11
-OLD_FILES+=usr/lib/libkadm5clnt_p.a
OLD_FILES+=usr/lib/libkadm5srv.a
OLD_FILES+=usr/lib/libkadm5srv.so
-OLD_LIBS+=usr/lib/libkadm5srv.so.11
-OLD_FILES+=usr/lib/libkadm5srv_p.a
OLD_FILES+=usr/lib/libkafs5.a
OLD_FILES+=usr/lib/libkafs5.so
-OLD_LIBS+=usr/lib/libkafs5.so.11
-OLD_FILES+=usr/lib/libkafs5_p.a
OLD_FILES+=usr/lib/libkdc.a
OLD_FILES+=usr/lib/libkdc.so
-OLD_LIBS+=usr/lib/libkdc.so.11
-OLD_FILES+=usr/lib/libkdc_p.a
-OLD_FILES+=usr/lib/libkrb5.a
-OLD_FILES+=usr/lib/libkrb5.so
-OLD_LIBS+=usr/lib/libkrb5.so.11
-OLD_FILES+=usr/lib/libkrb5_p.a
-OLD_FILES+=usr/lib/libroken.a
-OLD_FILES+=usr/lib/libroken.so
-OLD_LIBS+=usr/lib/libroken.so.11
-OLD_FILES+=usr/lib/libroken_p.a
-OLD_FILES+=usr/lib/libwind.a
-OLD_FILES+=usr/lib/libwind.so
-OLD_LIBS+=usr/lib/libwind.so.11
-OLD_FILES+=usr/lib/libwind_p.a
-OLD_FILES+=usr/lib/pam_krb5.so
-OLD_LIBS+=usr/lib/pam_krb5.so.6
-OLD_FILES+=usr/lib/pam_ksu.so
-OLD_LIBS+=usr/lib/pam_ksu.so.6
OLD_FILES+=usr/lib/libprivateheimipcc.a
OLD_FILES+=usr/lib/libprivateheimipcc.so
-OLD_LIBS+=usr/lib/libprivateheimipcc.so.11
-OLD_FILES+=usr/lib/libprivateheimipcc_p.a
OLD_FILES+=usr/lib/libprivateheimipcs.a
OLD_FILES+=usr/lib/libprivateheimipcs.so
-OLD_LIBS+=usr/lib/libprivateheimipcs.so.11
-OLD_FILES+=usr/lib/libprivateheimipcs_p.a
+OLD_FILES+=usr/lib/libroken.a
+OLD_FILES+=usr/lib/libroken.so
+OLD_FILES+=usr/lib/libwind.a
+OLD_FILES+=usr/lib/libwind.so
OLD_FILES+=usr/libexec/digest-service
OLD_FILES+=usr/libexec/hprop
OLD_FILES+=usr/libexec/hpropd
OLD_FILES+=usr/libexec/ipropd-master
OLD_FILES+=usr/libexec/ipropd-slave
-OLD_FILES+=usr/libexec/kadmind
OLD_FILES+=usr/libexec/kcm
OLD_FILES+=usr/libexec/kdc
OLD_FILES+=usr/libexec/kdigest
OLD_FILES+=usr/libexec/kfd
OLD_FILES+=usr/libexec/kimpersonate
OLD_FILES+=usr/libexec/kpasswdd
+OLD_FILES+=usr/sbin/iprop-log
OLD_FILES+=usr/sbin/kstash
OLD_FILES+=usr/sbin/ktutil
-OLD_FILES+=usr/sbin/iprop-log
-OLD_FILES+=usr/share/man/man1/kdestroy.1.gz
OLD_FILES+=usr/share/man/man1/kf.1.gz
-OLD_FILES+=usr/share/man/man1/kinit.1.gz
-OLD_FILES+=usr/share/man/man1/klist.1.gz
-OLD_FILES+=usr/share/man/man1/kpasswd.1.gz
-OLD_FILES+=usr/share/man/man1/krb5-config.1.gz
-OLD_FILES+=usr/share/man/man1/kswitch.1.gz
+OLD_FILES+=usr/share/man/man1/kgetcred.1.gz
OLD_FILES+=usr/share/man/man3/HDB.3.gz
+OLD_FILES+=usr/share/man/man3/gss_accept_sec_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_acquire_cred.3.gz
+OLD_FILES+=usr/share/man/man3/gss_add_cred.3.gz
+OLD_FILES+=usr/share/man/man3/gss_add_oid_set_member.3.gz
+OLD_FILES+=usr/share/man/man3/gss_canonicalize_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_compare_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_context_time.3.gz
+OLD_FILES+=usr/share/man/man3/gss_create_empty_oid_set.3.gz
+OLD_FILES+=usr/share/man/man3/gss_delete_sec_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_display_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_display_status.3.gz
+OLD_FILES+=usr/share/man/man3/gss_duplicate_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_export_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_export_sec_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_get_mic.3.gz
+OLD_FILES+=usr/share/man/man3/gss_import_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_import_sec_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_indicate_mechs.3.gz
+OLD_FILES+=usr/share/man/man3/gss_init_sec_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_inquire_context.3.gz
+OLD_FILES+=usr/share/man/man3/gss_inquire_cred.3.gz
+OLD_FILES+=usr/share/man/man3/gss_inquire_cred_by_mech.3.gz
+OLD_FILES+=usr/share/man/man3/gss_inquire_mechs_for_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_inquire_names_for_mech.3.gz
+OLD_FILES+=usr/share/man/man3/gss_process_context_token.3.gz
+OLD_FILES+=usr/share/man/man3/gss_release_buffer.3.gz
+OLD_FILES+=usr/share/man/man3/gss_release_cred.3.gz
+OLD_FILES+=usr/share/man/man3/gss_release_name.3.gz
+OLD_FILES+=usr/share/man/man3/gss_release_oid_set.3.gz
+OLD_FILES+=usr/share/man/man3/gss_seal.3.gz
+OLD_FILES+=usr/share/man/man3/gss_sign.3.gz
+OLD_FILES+=usr/share/man/man3/gss_test_oid_set_member.3.gz
+OLD_FILES+=usr/share/man/man3/gss_unseal.3.gz
+OLD_FILES+=usr/share/man/man3/gss_unwrap.3.gz
+OLD_FILES+=usr/share/man/man3/gss_verify.3.gz
+OLD_FILES+=usr/share/man/man3/gss_verify_mic.3.gz
+OLD_FILES+=usr/share/man/man3/gss_wrap.3.gz
+OLD_FILES+=usr/share/man/man3/gss_wrap_size_limit.3.gz
+OLD_FILES+=usr/share/man/man3/gssapi.3.gz
OLD_FILES+=usr/share/man/man3/hdb__del.3.gz
OLD_FILES+=usr/share/man/man3/hdb__get.3.gz
OLD_FILES+=usr/share/man/man3/hdb__put.3.gz
@@ -3575,38 +3595,188 @@ OLD_FILES+=usr/share/man/man3/ntlm_core.3.gz
OLD_FILES+=usr/share/man/man3/ntlm_type1.3.gz
OLD_FILES+=usr/share/man/man3/ntlm_type2.3.gz
OLD_FILES+=usr/share/man/man3/ntlm_type3.3.gz
-OLD_FILES+=usr/share/man/man5/krb5.conf.5.gz
+OLD_FILES+=usr/share/man/man5/mech.5.gz
+OLD_FILES+=usr/share/man/man5/qop.5.gz
OLD_FILES+=usr/share/man/man8/hprop.8.gz
OLD_FILES+=usr/share/man/man8/hpropd.8.gz
OLD_FILES+=usr/share/man/man8/iprop-log.8.gz
OLD_FILES+=usr/share/man/man8/iprop.8.gz
OLD_FILES+=usr/share/man/man8/kadmin.8.gz
-OLD_FILES+=usr/share/man/man8/kadmind.8.gz
OLD_FILES+=usr/share/man/man8/kcm.8.gz
OLD_FILES+=usr/share/man/man8/kdc.8.gz
OLD_FILES+=usr/share/man/man8/kdigest.8.gz
OLD_FILES+=usr/share/man/man8/kerberos.8.gz
+OLD_FILES+=usr/share/man/man8/kfd.8.gz
OLD_FILES+=usr/share/man/man8/kimpersonate.8.gz
OLD_FILES+=usr/share/man/man8/kpasswdd.8.gz
OLD_FILES+=usr/share/man/man8/kstash.8.gz
OLD_FILES+=usr/share/man/man8/ktutil.8.gz
-OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
-OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
OLD_FILES+=usr/share/man/man8/string2key.8.gz
OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
-.endif
-.if ${MK_KERBEROS_SUPPORT} == no
-OLD_FILES+=usr/bin/compile_et
-OLD_FILES+=usr/include/com_err.h
-OLD_FILES+=usr/include/com_right.h
-OLD_FILES+=usr/lib/libcom_err.a
-OLD_FILES+=usr/lib/libcom_err.so
+OLD_LIBS+=usr/lib/libasn1.so.11
OLD_LIBS+=usr/lib/libcom_err.so.5
-OLD_FILES+=usr/lib/libcom_err_p.a
-OLD_FILES+=usr/share/man/man1/compile_et.1.gz
-OLD_FILES+=usr/share/man/man3/com_err.3.gz
-.endif
+OLD_LIBS+=usr/lib/libgssapi.so.10
+OLD_LIBS+=usr/lib/libgssapi_krb5.so.10
+OLD_LIBS+=usr/lib/libgssapi_ntlm.so.10
+OLD_LIBS+=usr/lib/libgssapi_spnego.so.10
+OLD_LIBS+=usr/lib/libheimbase.so.11
+OLD_LIBS+=usr/lib/libheimntlm.so.11
+OLD_LIBS+=usr/lib/libhx509.so.11
+OLD_LIBS+=usr/lib/libhdb.so.11
+OLD_LIBS+=usr/lib/libkadm5clnt.so.11
+OLD_LIBS+=usr/lib/libkadm5srv.so.11
+OLD_LIBS+=usr/lib/libkafs5.so.11
+OLD_LIBS+=usr/lib/libkdc.so.11
+OLD_LIBS+=usr/lib/libkrb5.so.11
+OLD_LIBS+=usr/lib/libprivateheimipcc.so.11
+OLD_LIBS+=usr/lib/libprivateheimipcs.so.11
+OLD_LIBS+=usr/lib/libroken.so.11
+OLD_LIBS+=usr/lib/libwind.so.11
+.endif # ${MK_KERBEROS} == "no" || ${MK_MITKRB5} != "no"
+
+# MIT-specific files that don't exist in Heimdal. These should be removed if
+# Kerberos is disabled, or if Heimdal is selected.
+.if ${MK_KERBEROS} == "no" || ${MK_MITKRB5} == "no"
+OLD_DIRS+=usr/lib/debug/usr/lib/krb5/plugins/kdb
+OLD_DIRS+=usr/lib/debug/usr/lib/krb5/plugins/preauth
+OLD_DIRS+=usr/lib/debug/usr/lib/krb5/plugins/tls
+OLD_DIRS+=usr/lib/debug/usr/lib/krb5/plugins
+OLD_DIRS+=usr/lib/debug/usr/lib/krb5
+
+# Heimdal doesn't install debug symbols for these.
+OLD_FILES+=usr/lib/debug/usr/bin/klist.debug
+OLD_FILES+=usr/lib/debug/usr/bin/kswitch.debug
+
+OLD_FILES+=usr/bin/gss-client
+OLD_FILES+=usr/bin/k5srvutil
+OLD_FILES+=usr/bin/ktutil
+OLD_FILES+=usr/bin/kvno
+OLD_FILES+=usr/bin/sclient
+OLD_FILES+=usr/include/gssapi/gssapi_alloc.h
+OLD_FILES+=usr/include/gssapi/gssapi_ext.h
+OLD_FILES+=usr/include/gssapi/gssapi_generic.h
+OLD_FILES+=usr/include/gssapi/mechglue.h
+OLD_FILES+=usr/include/gssrpc/auth.h
+OLD_FILES+=usr/include/gssrpc/auth_gss.h
+OLD_FILES+=usr/include/gssrpc/auth_gssapi.h
+OLD_FILES+=usr/include/gssrpc/auth_unix.h
+OLD_FILES+=usr/include/gssrpc/clnt.h
+OLD_FILES+=usr/include/gssrpc/netdb.h
+OLD_FILES+=usr/include/gssrpc/pmap_clnt.h
+OLD_FILES+=usr/include/gssrpc/pmap_prot.h
+OLD_FILES+=usr/include/gssrpc/pmap_rmt.h
+OLD_FILES+=usr/include/gssrpc/rename.h
+OLD_FILES+=usr/include/gssrpc/rpc.h
+OLD_FILES+=usr/include/gssrpc/rpc_msg.h
+OLD_FILES+=usr/include/gssrpc/svc.h
+OLD_FILES+=usr/include/gssrpc/svc_auth.h
+OLD_FILES+=usr/include/gssrpc/types.h
+OLD_FILES+=usr/include/gssrpc/xdr.h
+OLD_FILES+=usr/include/kadm5/chpass_util_strings.h
+OLD_FILES+=usr/include/kadm5/kadm_err.h
+OLD_FILES+=usr/include/kdb.h
+OLD_FILES+=usr/include/krad.h
+OLD_FILES+=usr/include/krb5/ccselect_plugin.h
+OLD_FILES+=usr/include/krb5/certauth_plugin.h
+OLD_FILES+=usr/include/krb5/clpreauth_plugin.h
+OLD_FILES+=usr/include/krb5/gssapi_err_generic.h
+OLD_FILES+=usr/include/krb5/gssapi_err_krb5.h
+OLD_FILES+=usr/include/krb5/hostrealm_plugin.h
+OLD_FILES+=usr/include/krb5/kadm5_auth_plugin.h
+OLD_FILES+=usr/include/krb5/kadm5_hook_plugin.h
+OLD_FILES+=usr/include/krb5/kdcpolicy_plugin.h
+OLD_FILES+=usr/include/krb5/kdcpreauth_plugin.h
+OLD_FILES+=usr/include/krb5/krb5.h
+OLD_FILES+=usr/include/krb5/localauth_plugin.h
+OLD_FILES+=usr/include/krb5/plugin.h
+OLD_FILES+=usr/include/krb5/preauth_plugin.h
+OLD_FILES+=usr/include/krb5/pwqual_plugin.h
+OLD_FILES+=usr/include/profile.h
+OLD_FILES+=usr/include/verto-module.h
+OLD_FILES+=usr/include/verto.h
+OLD_FILES+=usr/lib/krb5/plugins/kdb/db2.so
+OLD_FILES+=usr/lib/krb5/plugins/kdb/db2.so.122
+OLD_FILES+=usr/lib/krb5/plugins/preauth/otp.so
+OLD_FILES+=usr/lib/krb5/plugins/preauth/otp.so.122
+OLD_FILES+=usr/lib/krb5/plugins/preauth/pkinit.so
+OLD_FILES+=usr/lib/krb5/plugins/preauth/pkinit.so.122
+OLD_FILES+=usr/lib/krb5/plugins/preauth/spake.so
+OLD_FILES+=usr/lib/krb5/plugins/preauth/spake.so.122
+OLD_FILES+=usr/lib/krb5/plugins/preauth/test.so
+OLD_FILES+=usr/lib/krb5/plugins/preauth/test.so.122
+OLD_FILES+=usr/lib/krb5/plugins/tls/k5tls.so
+OLD_FILES+=usr/lib/krb5/plugins/tls/k5tls.so.122
+OLD_FILES+=usr/lib/libgssrpc.a
+OLD_FILES+=usr/lib/libgssrpc.so
+OLD_FILES+=usr/lib/libk5crypto.a
+OLD_FILES+=usr/lib/libk5crypto.so
+OLD_FILES+=usr/lib/libkadm5clnt_mit.a
+OLD_FILES+=usr/lib/libkadm5clnt_mit.so
+OLD_FILES+=usr/lib/libkadm5srv_mit.a
+OLD_FILES+=usr/lib/libkadm5srv_mit.so
+OLD_FILES+=usr/lib/libkdb5.a
+OLD_FILES+=usr/lib/libkdb5.so
+OLD_FILES+=usr/lib/libkrad.a
+OLD_FILES+=usr/lib/libkrad.so
+OLD_FILES+=usr/lib/libkrb5profile.a
+OLD_FILES+=usr/lib/libkrb5profile.so
+OLD_FILES+=usr/lib/libkrb5support.a
+OLD_FILES+=usr/lib/libkrb5support.so
+OLD_FILES+=usr/lib/libverto.a
+OLD_FILES+=usr/lib/libverto.so
+OLD_FILES+=usr/libdata/pkgconfig/gssrpc.pc
+OLD_FILES+=usr/libdata/pkgconfig/kadm-server.pc
+OLD_FILES+=usr/libdata/pkgconfig/kadm-client.pc
+OLD_FILES+=usr/libdata/pkgconfig/kdb.pc
+OLD_FILES+=usr/libdata/pkgconfig/krb5-gssapi.pc
+OLD_FILES+=usr/libdata/pkgconfig/krb5.pc
+OLD_FILES+=usr/libdata/pkgconfig/mit-krb5.pc
+OLD_FILES+=usr/libdata/pkgconfig/mit-krb5-gssapi.pc
+OLD_FILES+=usr/libexec/kprop
+OLD_FILES+=usr/libexec/kpropd
+OLD_FILES+=usr/libexec/kproplog
+OLD_FILES+=usr/libexec/krb5kdc
+OLD_FILES+=usr/sbin/gss-server
+OLD_FILES+=usr/sbin/kadmin.local
+OLD_FILES+=usr/sbin/kdb5_util
+OLD_FILES+=usr/sbin/sim_server
+OLD_FILES+=usr/share/et/et_h.awk
+OLD_FILES+=usr/share/et/et_c.awk
+OLD_FILES+=usr/share/man/man1/k5srvutil.1.gz
+OLD_FILES+=usr/share/man/man1/kadmin.1.gz
+OLD_FILES+=usr/share/man/man1/ksu.1.gz
+OLD_FILES+=usr/share/man/man1/ktutil.1.gz
+OLD_FILES+=usr/share/man/man1/kvno.1.gz
+OLD_FILES+=usr/share/man/man1/sclient.1.gz
+OLD_FILES+=usr/share/man/man5/.k5identity.5.gz
+OLD_FILES+=usr/share/man/man5/.k5login.5.gz
+OLD_FILES+=usr/share/man/man5/k5identity.5.gz
+OLD_FILES+=usr/share/man/man5/k5login.5.gz
+OLD_FILES+=usr/share/man/man5/kadm5.acl.5.gz
+OLD_FILES+=usr/share/man/man5/kdc.conf.5.gz
+OLD_FILES+=usr/share/man/man7/kerberos.7.gz
+OLD_FILES+=usr/share/man/man8/kadmin.local.8.gz
+OLD_FILES+=usr/share/man/man8/kdb5_util.8.gz
+OLD_FILES+=usr/share/man/man8/kprop.8.gz
+OLD_FILES+=usr/share/man/man8/kpropd.8.gz
+OLD_FILES+=usr/share/man/man8/kproplog.8.gz
+OLD_FILES+=usr/share/man/man8/krb5kdc.8.gz
+OLD_FILES+=usr/share/man/man8/pam-krb5.8.gz
+
+OLD_LIBS+=usr/lib/libcom_err.so.122
+OLD_LIBS+=usr/lib/libgssapi_krb5.so.122
+OLD_LIBS+=usr/lib/libgssrpc.so.122
+OLD_LIBS+=usr/lib/libk5crypto.so.122
+OLD_LIBS+=usr/lib/libkadm5clnt_mit.so.122
+OLD_LIBS+=usr/lib/libkadm5srv_mit.so.122
+OLD_LIBS+=usr/lib/libkdb5.so.122
+OLD_LIBS+=usr/lib/libkrad.so.122
+OLD_LIBS+=usr/lib/libkrb5.so.122
+OLD_LIBS+=usr/lib/libkrb5profile.so.122
+OLD_LIBS+=usr/lib/libkrb5support.so.122
+OLD_LIBS+=usr/lib/libverto.so.122
+.endif # ${MK_KERBEROS} == "no" || ${MK_MITKRB5} == "no"
.if ${MK_LDNS} == no
OLD_FILES+=usr/lib/libprivateldns.a
@@ -3623,11 +3793,14 @@ OLD_FILES+=usr/share/man/man1/host.1.gz
.endif
.if ${MK_LEGACY_CONSOLE} == no
+OLD_FILES+=etc/moused.conf
OLD_FILES+=etc/rc.d/moused
+OLD_FILES+=etc/rc.d/msconvd
OLD_FILES+=etc/rc.d/syscons
OLD_FILES+=usr/sbin/kbdcontrol
OLD_FILES+=usr/sbin/kbdmap
OLD_FILES+=usr/sbin/moused
+OLD_FILES+=usr/sbin/msconvd
OLD_FILES+=usr/sbin/vidcontrol
OLD_FILES+=usr/sbin/vidfont
OLD_FILES+=usr/share/man/man1/kbdcontrol.1.gz
@@ -3636,7 +3809,11 @@ OLD_FILES+=usr/share/man/man1/vidcontrol.1.gz
OLD_FILES+=usr/share/man/man1/vidfont.1.gz
OLD_FILES+=usr/share/man/man5/kbdmap.5.gz
OLD_FILES+=usr/share/man/man5/keymap.5.gz
+OLD_FILES+=usr/share/man/man5/moused.conf.5.gz
OLD_FILES+=usr/share/man/man8/moused.8.gz
+OLD_FILES+=usr/share/man/man8/msconvd.8.gz
+OLD_FILES+=usr/share/moused/5-generic-touchpad.quirks
+OLD_DIRS+=usr/share/moused
.endif
.for LIBCOMPAT libcompat in ${_ALL_LIBCOMPATS_libcompats}
@@ -3677,6 +3854,7 @@ OLD_FILES+=usr/bin/ld.lld
.if ${MK_LLDB} == no
OLD_FILES+=usr/bin/lldb
OLD_FILES+=usr/bin/lldb-server
+OLD_LIBS+=usr/lib/libprivatelldb.so.19
OLD_FILES+=usr/share/man/man1/lldb-server.1.gz
OLD_FILES+=usr/share/man/man1/lldb.1.gz
.endif
@@ -5566,6 +5744,7 @@ OLD_FILES+=usr/share/man/man1/genl.1.gz
.endif
.if ${MK_NIS} == no
+OLD_FILES+=etc/rc.d/nisdomain
OLD_FILES+=etc/rc.d/ypbind
OLD_FILES+=etc/rc.d/ypldap
OLD_FILES+=etc/rc.d/yppasswdd
@@ -6645,6 +6824,9 @@ OLD_FILES+=etc/newsyslog.conf.d/pf.conf
OLD_FILES+=etc/periodic/security/520.pfdenied
OLD_FILES+=etc/pf.os
OLD_FILES+=etc/rc.d/ftp-proxy
+OLD_FILES+=etc/rc.d/pf
+OLD_FILES+=etc/rc.d/pflog
+OLD_FILES+=etc/rc.d/pfsync
OLD_FILES+=sbin/pfctl
OLD_FILES+=sbin/pflogd
OLD_FILES+=usr/include/netpfil/pf/pf.h
@@ -6834,6 +7016,7 @@ OLD_FILES+=usr/share/man/man8/pmcstudy.8.gz
.if ${MK_PPP} == no
OLD_FILES+=etc/newsyslog.conf.d/ppp.conf
OLD_FILES+=etc/ppp/ppp.conf
+OLD_FILES+=etc/rc.d/ppp
OLD_FILES+=etc/syslog.d/ppp.conf
OLD_DIRS+=etc/ppp
OLD_FILES+=usr/sbin/ppp
@@ -8982,12 +9165,14 @@ OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-WIRELESS-MIB.txt
.if ${MK_ZFS} == no
OLD_FILES+=boot/gptzfsboot
-OLD_FILES+=boot/zfsboot
OLD_FILES+=boot/zfsloader
OLD_FILES+=etc/rc.d/zfs
OLD_FILES+=etc/rc.d/zfsbe
OLD_FILES+=etc/rc.d/zfsd
OLD_FILES+=etc/rc.d/zfskeys
+OLD_FILES+=etc/rc.d/zpool
+OLD_FILES+=etc/rc.d/zpoolreguid
+OLD_FILES+=etc/rc.d/zpoolupgrade
OLD_FILES+=etc/rc.d/zvol
OLD_FILES+=etc/devd/zfs.conf
OLD_FILES+=etc/periodic/daily/404.status-zfs
@@ -9082,7 +9267,6 @@ OLD_FILES+=usr/share/man/man8/gptzfsboot.8.gz
OLD_FILES+=usr/share/man/man8/zdb.8.gz
OLD_FILES+=usr/share/man/man8/zfs-program.8.gz
OLD_FILES+=usr/share/man/man8/zfs.8.gz
-OLD_FILES+=usr/share/man/man8/zfsboot.8.gz
OLD_FILES+=usr/share/man/man8/zfsbootcfg.8.gz
OLD_FILES+=usr/share/man/man8/zfsd.8.gz
OLD_FILES+=usr/share/man/man8/zfsloader.8.gz
diff --git a/tools/build/options/WITHOUT_GSSAPI b/tools/build/options/WITHOUT_GSSAPI
deleted file mode 100644
index 3b208b6edecd..000000000000
--- a/tools/build/options/WITHOUT_GSSAPI
+++ /dev/null
@@ -1 +0,0 @@
-Do not build libgssapi.
diff --git a/tools/build/options/WITHOUT_KERBEROS b/tools/build/options/WITHOUT_KERBEROS
index 98e1ffe3721d..e0301ee1d786 100644
--- a/tools/build/options/WITHOUT_KERBEROS
+++ b/tools/build/options/WITHOUT_KERBEROS
@@ -1 +1 @@
-Set this to not build Kerberos 5 (KTH Heimdal).
+Set this to not build Kerberos.
diff --git a/tools/build/options/WITHOUT_LLVM_TARGET_SPARC b/tools/build/options/WITHOUT_LLVM_TARGET_SPARC
deleted file mode 100644
index 4da802ad0312..000000000000
--- a/tools/build/options/WITHOUT_LLVM_TARGET_SPARC
+++ /dev/null
@@ -1,4 +0,0 @@
-Do not build LLVM target support for SPARC.
-The
-.Va LLVM_TARGET_ALL
-option should be used rather than this in most cases.
diff --git a/tools/build/options/WITHOUT_MALLOC_PRODUCTION b/tools/build/options/WITHOUT_MALLOC_PRODUCTION
index 57b8ab574f93..90efc200fd54 100644
--- a/tools/build/options/WITHOUT_MALLOC_PRODUCTION
+++ b/tools/build/options/WITHOUT_MALLOC_PRODUCTION
@@ -1,3 +1,8 @@
Enable assertions and statistics gathering in
.Xr malloc 3 .
-It also defaults the A and J runtime options to on.
+The run-time options
+.Dv opt.abort ,
+.Dv opt.abort_conf ,
+and
+.Dv opt.junk
+also default to true.
diff --git a/tools/build/options/WITHOUT_MITKRB5 b/tools/build/options/WITHOUT_MITKRB5
new file mode 100644
index 000000000000..14a9e5932ef2
--- /dev/null
+++ b/tools/build/options/WITHOUT_MITKRB5
@@ -0,0 +1 @@
+Set this to build KTH Heimdal instead of MIT Kerberos 5.
diff --git a/tools/build/options/WITH_CCACHE_BUILD b/tools/build/options/WITH_CCACHE_BUILD
index 9e53769287e5..9a5c2ce1cb80 100644
--- a/tools/build/options/WITH_CCACHE_BUILD
+++ b/tools/build/options/WITH_CCACHE_BUILD
@@ -3,11 +3,18 @@ Use
for the build.
No configuration is required except to install the
.Sy devel/ccache
+or
+.Sy devel/sccache
package.
When using with
.Xr distcc 1 ,
set
.Sy CCACHE_PREFIX=/usr/local/bin/distcc .
+When using with sccache
+set
+.Sy CCACHE_NAME=sccache
+in
+.Xr src.conf 5 .
The default cache directory of
.Pa $HOME/.ccache
will be used, which can be overridden by setting
diff --git a/tools/build/options/WITH_CLEAN b/tools/build/options/WITH_CLEAN
index d5962258bcc0..0bb05e33371b 100644
--- a/tools/build/options/WITH_CLEAN
+++ b/tools/build/options/WITH_CLEAN
@@ -1 +1,4 @@
Clean before building world and/or kernel.
+Note that recording a new epoch in
+.Pa .clean_build_epoch
+in the root of the source tree will also force a clean world build.
diff --git a/tools/build/options/WITH_LLVM_TARGET_SPARC b/tools/build/options/WITH_LLVM_TARGET_SPARC
deleted file mode 100644
index 0d67602688de..000000000000
--- a/tools/build/options/WITH_LLVM_TARGET_SPARC
+++ /dev/null
@@ -1,4 +0,0 @@
-Build LLVM target support for SPARC.
-The
-.Va LLVM_TARGET_ALL
-option should be used rather than this in most cases.
diff --git a/tools/build/options/WITH_MALLOC_PRODUCTION b/tools/build/options/WITH_MALLOC_PRODUCTION
index 1a214ff805be..ac267bdc48a6 100644
--- a/tools/build/options/WITH_MALLOC_PRODUCTION
+++ b/tools/build/options/WITH_MALLOC_PRODUCTION
@@ -1,3 +1,8 @@
Disable assertions and statistics gathering in
.Xr malloc 3 .
-It also defaults the A and J runtime options to off.
+The run-time options
+.Dv opt.abort ,
+.Dv opt.abort_conf ,
+and
+.Dv opt.junk
+also default to false.
diff --git a/tools/build/options/WITH_MITKRB5 b/tools/build/options/WITH_MITKRB5
new file mode 100644
index 000000000000..6e3683c351c5
--- /dev/null
+++ b/tools/build/options/WITH_MITKRB5
@@ -0,0 +1 @@
+Set this to build MIT Kerberos 5 instead of KTH Heimdal.
diff --git a/tools/build/options/WITH_PTHREADS_ASSERTIONS b/tools/build/options/WITH_PTHREADS_ASSERTIONS
new file mode 100644
index 000000000000..03c15b76fb85
--- /dev/null
+++ b/tools/build/options/WITH_PTHREADS_ASSERTIONS
@@ -0,0 +1 @@
+Enable debugging assertions in pthreads library.
diff --git a/tools/build/options/WITH_RUN_TESTS b/tools/build/options/WITH_RUN_TESTS
new file mode 100644
index 000000000000..91b30522a3d3
--- /dev/null
+++ b/tools/build/options/WITH_RUN_TESTS
@@ -0,0 +1 @@
+Run tests as part of the build.
diff --git a/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT b/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
index f3d97df2fb89..32aadf6d46c9 100644
--- a/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
+++ b/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
@@ -1 +1,6 @@
Build leapsecond information in to the timezone database.
+This option violates
+.St -p1003.1
+and all other applicable standards, and is known to cause unexpected
+issues with date/time handling in many applications and programming
+languages.
diff --git a/tools/build/options/makeman b/tools/build/options/makeman
index e0980d3be607..88ee5884d180 100755
--- a/tools/build/options/makeman
+++ b/tools/build/options/makeman
@@ -127,8 +127,8 @@ show()
exit 1
;;
esac
- requireds=`env -i ${make} -f ${srcdir}/share/mk/src.opts.mk \
- -V '${__REQUIRED_OPTIONS:ts,}'`
+ requireds=$(env -i ${make} -f ${srcdir}/share/mk/src.opts.mk \
+ -V 'REQUIRED_OPTIONS:ts,')
env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
SRCCONF=/dev/null |
while read var _ val ; do
@@ -222,8 +222,11 @@ variables that control the aspects of how the system builds.
.Pp
The default location of
.Nm
-is
-.Pa /etc/src.conf ,
+is the top level of the source tree, or
+.Pa /etc/src.conf
+if no
+.Nm
+is found in the source tree itself,
though an alternative location can be specified in the
.Xr make 1
variable
diff --git a/tools/build/options/makeman.lua b/tools/build/options/makeman.lua
new file mode 100644
index 000000000000..e96e6f50174b
--- /dev/null
+++ b/tools/build/options/makeman.lua
@@ -0,0 +1,791 @@
+--
+-- Copyright (c) 2023 Kyle Evans <kevans@FreeBSD.org>
+--
+-- SPDX-License-Identifier: BSD-2-Clause
+--
+
+local libgen = require('posix.libgen')
+local lfs = require('lfs')
+local stdlib = require('posix.stdlib')
+local unistd = require('posix.unistd')
+local sys_wait = require('posix.sys.wait')
+
+local curdate = os.date("%B %e, %Y")
+
+local output_head <const> = ".\\\" DO NOT EDIT-- this file is @" .. [[generated by tools/build/options/makeman.
+.Dd ]] .. curdate .. [[
+
+.Dt SRC.CONF 5
+.Os
+.Sh NAME
+.Nm src.conf
+.Nd "source build options"
+.Sh DESCRIPTION
+The
+.Nm
+file contains variables that control what components will be generated during
+the build process of the
+.Fx
+source tree; see
+.Xr build 7 .
+.Pp
+The
+.Nm
+file uses the standard makefile syntax.
+However,
+.Nm
+should not specify any dependencies to
+.Xr make 1 .
+Instead,
+.Nm
+is to set
+.Xr make 1
+variables that control the aspects of how the system builds.
+.Pp
+The default location of
+.Nm
+is
+.Pa /etc/src.conf ,
+though an alternative location can be specified in the
+.Xr make 1
+variable
+.Va SRCCONF .
+Overriding the location of
+.Nm
+may be necessary if the system-wide settings are not suitable
+for a particular build.
+For instance, setting
+.Va SRCCONF
+to
+.Pa /dev/null
+effectively resets all build controls to their defaults.
+.Pp
+The only purpose of
+.Nm
+is to control the compilation of the
+.Fx
+source code, which is usually located in
+.Pa /usr/src .
+As a rule, the system administrator creates
+.Nm
+when the values of certain control variables need to be changed
+from their defaults.
+.Pp
+In addition, control variables can be specified
+for a particular build via the
+.Fl D
+option of
+.Xr make 1
+or in its environment; see
+.Xr environ 7 .
+.Pp
+The environment of
+.Xr make 1
+for the build can be controlled via the
+.Va SRC_ENV_CONF
+variable, which defaults to
+.Pa /etc/src-env.conf .
+Some examples that may only be set in this file are
+.Va WITH_DIRDEPS_BUILD ,
+and
+.Va WITH_META_MODE ,
+and
+.Va MAKEOBJDIRPREFIX
+as they are environment-only variables.
+.Pp
+The values of
+.Va WITH_
+and
+.Va WITHOUT_
+variables are ignored regardless of their setting;
+even if they would be set to
+.Dq Li FALSE
+or
+.Dq Li NO .
+The presence of an option causes
+it to be honored by
+.Xr make 1 .
+.Pp
+This list provides a name and short description for variables
+that can be used for source builds.
+.Bl -tag -width indent
+]]
+
+local output_tail <const> = [[.El
+.Sh FILES
+.Bl -tag -compact -width Pa
+.It Pa /etc/src.conf
+.It Pa /etc/src-env.conf
+.It Pa /usr/share/mk/bsd.own.mk
+.El
+.Sh SEE ALSO
+.Xr make 1 ,
+.Xr make.conf 5 ,
+.Xr build 7 ,
+.Xr ports 7
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was autogenerated by
+.An tools/build/options/makeman .
+]]
+
+local scriptdir <const> = libgen.dirname(stdlib.realpath(arg[0]))
+local srcdir <const> = stdlib.realpath(scriptdir .. "/../../../")
+local makesysdir <const> = srcdir .. "/share/mk"
+
+local make_envvar = os.getenv("MAKE")
+local make_cmd_override = {}
+if make_envvar then
+ for word in make_envvar:gmatch("[^%s]+") do
+ make_cmd_override[#make_cmd_override + 1] = word
+ end
+end
+
+-- Lifted from bsdinstall/scripts/pkgbase.in (read_all)
+local function read_pipe(pipe)
+ local ret = ""
+ repeat
+ local buffer = assert(unistd.read(pipe, 1024))
+ ret = ret .. buffer
+ until buffer == ""
+ return ret
+end
+local function run_make(args)
+ local cmd_args = {"env", "-i", "make", "-C", srcdir, "-m", makesysdir,
+ "__MAKE_CONF=/dev/null", "SRCCONF=/dev/null"}
+
+ if #make_cmd_override > 0 then
+ cmd_args[3] = make_cmd_override[1]
+ for k = 2, #make_cmd_override do
+ local val = make_cmd_override[k]
+
+ table.insert(cmd_args, 3 + (k - 1), val)
+ end
+ end
+ for k, v in ipairs(args) do
+ cmd_args[#cmd_args + 1] = v
+ end
+
+ local r, w = assert(unistd.pipe())
+ local pid = assert(unistd.fork())
+ if pid == 0 then
+ -- Child
+ assert(unistd.close(r))
+ assert(unistd.dup2(w, 1))
+ assert(unistd.dup2(w, 2))
+ assert(unistd.execp("env", cmd_args))
+ unistd._exit()
+ end
+
+ -- Parent
+ assert(unistd.close(w))
+
+ local output = read_pipe(r)
+ assert(unistd.close(r))
+
+ local _, exit_type, exit_code = assert(sys_wait.wait(pid))
+ assert(exit_type == "exited", "make exited with wrong status")
+ assert(exit_code == 0, "make exited unsuccessfully")
+ return output
+end
+
+local function native_target()
+ local output = run_make({"MK_AUTO_OBJ=NO", "-V", "MACHINE",
+ "-V", "MACHINE_ARCH"})
+
+ local arch, machine_arch
+ for x in output:gmatch("[^\n]+") do
+ if not arch then
+ arch = x
+ elseif not machine_arch then
+ machine_arch = x
+ end
+ end
+
+ return arch .. "/" .. machine_arch
+end
+
+local function src_targets()
+ local targets = {}
+ targets[native_target()] = true
+
+ local output = run_make({"MK_AUTO_OBJ=no", "targets"})
+ local curline = 0
+
+ for line in output:gmatch("[^\n]+") do
+ curline = curline + 1
+ if curline ~= 1 then
+ local arch = line:match("[^%s]+/[^%s]+")
+
+ -- Make sure we don't roll over our default arch
+ if arch and not targets[arch] then
+ targets[arch] = false
+ end
+ end
+ end
+
+ return targets
+end
+
+local function config_options(srcconf, env, take_dupes, linting)
+ srcconf = srcconf or "/dev/null"
+ env = env or {}
+
+ local option_args = {".MAKE.MODE=normal", "showconfig",
+ "SRC_ENV_CONF=" .. srcconf}
+
+ for _, val in ipairs(env) do
+ option_args[#option_args + 1] = val
+ end
+
+ local output = run_make(option_args)
+
+ local options = {}
+ local known_dupes = {}
+
+ local function warn_on_dupe(option, val)
+ if not linting or known_dupes[option] then
+ return false
+ end
+ if not option:match("^OPT_") then
+ val = val == "yes"
+ end
+
+ known_dupes[option] = true
+ return val ~= options[val]
+ end
+
+ for opt in output:gmatch("[^\n]+") do
+ if opt:match("^MK_[%a%d_]+%s+=%s+.+") then
+ local name = opt:match("MK_[%a%d_]+")
+ local val = opt:match("= .+"):sub(3)
+
+ -- Some settings, e.g., MK_INIT_ALL_ZERO, may end up
+ -- output twice for some reason that I haven't dug into;
+ -- take the first value. In some circumstances, though,
+ -- we do make an exception and actually want to take the
+ -- latest.
+ if take_dupes or options[name] == nil then
+ options[name] = val == "yes"
+ elseif warn_on_dupe(name, val) then
+ io.stderr:write("ignoring duplicate option " ..
+ name .. "\n")
+ end
+ elseif opt:match("^OPT_[%a%d_]+%s+=%s+.+") then
+ local name = opt:match("OPT_[%a%d_]+")
+ local val = opt:match("= .+"):sub(3)
+
+ -- Multi-value options will arbitrarily use a table here
+ -- to indicate the difference.
+ if take_dupes or options[name] == nil then
+ options[name] = val
+ elseif warn_on_dupe(name, val) then
+ io.stderr:write("ignoring duplicate option " ..
+ name .. "\n")
+ end
+ end
+ end
+
+ return options
+end
+
+local function env_only_options()
+ local output = run_make({"MK_AUTO_OBJ=no", "-V", "__ENV_ONLY_OPTIONS"})
+ local options = {}
+
+ for opt in output:gmatch("[^%s]+") do
+ options["MK_" .. opt] = true
+ end
+
+ return options
+end
+
+local function required_options()
+ local output = run_make({"-f", "share/mk/src.opts.mk", "-V",
+ "__REQUIRED_OPTIONS"})
+ local options = {}
+
+ for opt in output:gmatch("[^%s]+") do
+ options["MK_" .. opt] = true
+ end
+
+ return options
+end
+
+local function config_description(option_name)
+ local fh = io.open(scriptdir .. "/" .. option_name)
+ local desc
+
+ if fh then
+ desc = ""
+ for line in fh:lines() do
+ if not line:match("%$FreeBSD%$") then
+ desc = desc .. line .. "\n"
+ end
+ end
+
+ assert(fh:close())
+ end
+
+ return desc
+end
+
+local function config_descriptions(options)
+ local desc = {}
+ for name, _ in pairs(options) do
+ if name:match("^MK_") then
+ local basename = name:gsub("^MK_", "")
+ local with_name = "WITH_" .. basename
+ local without_name = "WITHOUT_" .. basename
+
+ desc[with_name] = config_description(with_name)
+ desc[without_name] = config_description(without_name)
+ elseif name:match("^OPT_") then
+ local basename = name:gsub("^OPT_", "")
+
+ desc[name] = config_description(basename)
+ end
+ end
+ return desc
+end
+
+local function dependent_options(tmpdir, option_name, all_opts, omit_others)
+ local opt_sense = not not option_name:match("^WITH_")
+ local base_option_name = option_name:gsub("^[^_]+_", "")
+ local prefix = (opt_sense and "WITHOUT_") or "WITH_"
+
+ local srcconf = tmpdir .. "/src-" ..prefix .. "ALL_" ..
+ option_name .. ".conf"
+ local fh = assert(io.open(srcconf, "w+"))
+
+ fh:write(option_name .. "=\"YES\"\n")
+ if not omit_others then
+ for opt, value in pairs(all_opts) do
+ local base_opt = opt:gsub("^MK_", "")
+
+ if base_opt ~= base_option_name then
+ local opt_prefix = (value and "WITH_") or "WITHOUT_"
+ fh:write(opt_prefix .. base_opt .. "=\"YES\"\n")
+ end
+ end
+ end
+ assert(fh:close())
+
+ local option_name_key = "MK_" .. base_option_name
+ local options = config_options(srcconf, nil, omit_others)
+ for name, value in pairs(options) do
+ if name == option_name_key or value == all_opts[name] then
+ options[name] = nil
+ elseif name:match("^OPT_") then
+ -- Strip out multi-option values at the moment, they do
+ -- not really make sense.
+ options[name] = nil
+ end
+ end
+
+ return options
+end
+
+local function export_option_table(fd, name, options)
+ unistd.write(fd, name .. " = {")
+ for k, v in pairs(options) do
+ v = (v and "true") or "false"
+ unistd.write(fd, "['" .. k .. "'] = " .. v .. ",")
+ end
+ unistd.write(fd, "}")
+end
+
+local function all_dependent_options(tmpdir, options, default_opts,
+ with_all_opts, without_all_opts)
+ local all_enforced_options = {}
+ local all_effect_options = {}
+ local children = {}
+
+ for _, name in ipairs(options) do
+ local rfd, wfd = assert(unistd.pipe())
+ local pid = assert(unistd.fork())
+
+ if pid == 0 then
+ -- We need to pcall() this so that errors bubble up to
+ -- our _exit() call rather than the main exit.
+ local ret, errobj = pcall(function()
+ unistd.close(rfd)
+
+ local compare_table
+ if name:match("^WITHOUT") then
+ compare_table = with_all_opts
+ else
+ compare_table = without_all_opts
+ end
+
+ -- List of knobs forced on by this one
+ local enforced_options = dependent_options(tmpdir, name,
+ compare_table)
+ -- List of knobs implied by this by one (once additionally
+ -- filtered based on enforced_options values)
+ local effect_options = dependent_options(tmpdir, name,
+ default_opts, true)
+
+ export_option_table(wfd, "enforced_options",
+ enforced_options)
+ export_option_table(wfd, "effect_options",
+ effect_options)
+ end)
+
+ io.stderr:write(".")
+
+ if ret then
+ unistd._exit(0)
+ else
+ unistd.write(wfd, errobj)
+ unistd._exit(1)
+ end
+ end
+
+ unistd.close(wfd)
+ children[pid] = {name, rfd}
+ end
+
+ while next(children) ~= nil do
+::again::
+ local pid, status, exitcode = sys_wait.wait(-1)
+
+ if status ~= "exited" then
+ goto again
+ end
+
+ local info = children[pid]
+ children[pid] = nil
+
+ local name = info[1]
+ local rfd = info[2]
+ local buf = ''
+ local rbuf, sz
+
+ -- Drain the pipe
+ rbuf = unistd.read(rfd, 512)
+ while #rbuf ~= 0 do
+ buf = buf .. rbuf
+ rbuf = unistd.read(rfd, 512)
+ end
+
+ unistd.close(rfd)
+
+ if exitcode ~= 0 then
+ error("Child " .. pid .. " failed, buf: " .. buf)
+ end
+
+ -- The child has written a pair of tables named enforced_options
+ -- and effect_options to the pipe. We'll load the pipe buffer
+ -- as a string and then yank these out of the clean environment
+ -- that we execute the chunk in.
+ local child_env = {}
+ local res, err = pcall(load(buf, "child", "t", child_env))
+
+ all_enforced_options[name] = child_env["enforced_options"]
+ all_effect_options[name] = child_env["effect_options"]
+ end
+
+ io.stderr:write("\n")
+ return all_enforced_options, all_effect_options
+end
+
+local function get_defaults(target_archs, native_default_opts)
+ local target_defaults = {}
+ -- Set of options with differing defaults in some archs
+ local different_defaults = {}
+
+ for tgt, dflt in pairs(target_archs) do
+ if dflt then
+ local native_copy = {}
+ for opt, val in pairs(native_default_opts) do
+ native_copy[opt] = val
+ end
+ target_defaults[tgt] = native_copy
+ goto skip
+ end
+
+ local target = tgt:gsub("/.+$", "")
+ local target_arch = tgt:gsub("^.+/", "")
+
+ local target_opts = config_options(nil, {"TARGET=" .. target,
+ "TARGET_ARCH=" .. target_arch})
+
+ for opt, val in pairs(target_opts) do
+ if val ~= native_default_opts[opt] then
+ different_defaults[opt] = true
+ end
+ end
+
+ target_defaults[tgt] = target_opts
+::skip::
+ end
+
+ for opt in pairs(native_default_opts) do
+ if different_defaults[opt] == nil then
+ for _, opts in pairs(target_defaults) do
+ opts[opt] = nil
+ end
+ end
+ end
+
+ for tgt, opts in pairs(target_defaults) do
+ local val = opts["MK_ACPI"]
+
+ if val ~= nil then
+ print(" - " .. tgt .. ": " .. ((val and "yes") or "no"))
+ end
+ end
+
+ return target_defaults, different_defaults
+end
+
+local function option_comparator(lhs, rhs)
+ -- Convert both options to the base name, compare that instead unless
+ -- they're the same option. For the same option, we just want to get
+ -- ordering between WITH_/WITHOUT_ correct.
+ local base_lhs = lhs:gsub("^[^_]+_", "")
+ local base_rhs = rhs:gsub("^[^_]+_", "")
+
+ if base_lhs == base_rhs then
+ return lhs < rhs
+ else
+ return base_lhs < base_rhs
+ end
+end
+
+local function main(tmpdir)
+ io.stderr:write("building src.conf.5 man page from files in " ..
+ scriptdir .. "\n")
+
+ local env_only_opts <const> = env_only_options()
+ local default_opts = config_options(nil, nil, nil, true)
+ local opt_descriptions = config_descriptions(default_opts)
+ local srcconf_all <const> = tmpdir .. "/src-all-enabled.conf"
+ local fh = io.open(srcconf_all, "w+")
+ local all_targets = src_targets()
+ local target_defaults, different_defaults = get_defaults(all_targets,
+ default_opts)
+ local options = {}
+ local without_all_opts = {}
+
+ for name, value in pairs(default_opts) do
+ if name:match("^MK_") then
+ local base_name = name:gsub("^MK_", "")
+ local with_name = "WITH_" .. base_name
+ local without_name = "WITHOUT_" .. base_name
+ -- If it's differently defaulted on some architectures,
+ -- we'll split it into WITH_/WITHOUT_ just to simplify
+ -- some later bits.
+ if different_defaults[name] ~= nil then
+ options[#options + 1] = with_name
+ options[#options + 1] = without_name
+ elseif value then
+ options[#options + 1] = without_name
+ else
+ options[#options + 1] = with_name
+ end
+
+ without_all_opts[name] = false
+ assert(fh:write(with_name .. '="YES"\n'))
+ else
+ options[#options + 1] = name
+ end
+ end
+
+ assert(fh:close())
+
+ local with_all_opts = config_options(srcconf_all)
+ local all_enforced_options, all_effect_options
+ local all_required_options = required_options()
+
+ all_enforced_options, all_effect_options = all_dependent_options(tmpdir,
+ options, default_opts, with_all_opts, without_all_opts)
+
+ table.sort(options, option_comparator)
+ io.stdout:write(output_head)
+ for _, name in ipairs(options) do
+ local value
+
+ if name:match("^OPT_") then
+ goto skip
+ end
+ assert(name:match("^WITH"), "Name looks wrong: " .. name)
+ local describe_option = name
+
+ value = not not name:match("^WITHOUT")
+
+ -- Normalize name to MK_ for indexing into various other
+ -- arrays
+ name = "MK_" .. name:gsub("^[^_]+_", "")
+
+ print(".It Va " .. describe_option:gsub("^OPT_", ""))
+ if opt_descriptions[describe_option] then
+ io.stdout:write(opt_descriptions[describe_option])
+ else
+ io.stderr:write("Missing description for " ..
+ describe_option .. "\n")
+ end
+
+ local enforced_options = all_enforced_options[describe_option]
+ local effect_options = all_effect_options[describe_option]
+
+ if different_defaults[name] ~= nil then
+ print([[.Pp
+This is a default setting on]])
+
+ local which_targets = {}
+ for tgt, tgt_options in pairs(target_defaults) do
+ if tgt_options[name] ~= value then
+ which_targets[#which_targets + 1] = tgt
+ end
+ end
+
+ table.sort(which_targets)
+ for idx, tgt in ipairs(which_targets) do
+ io.stdout:write(tgt)
+ if idx < #which_targets - 1 then
+ io.stdout:write(", ")
+ elseif idx == #which_targets - 1 then
+ io.stdout:write(" and ")
+ end
+ end
+ print(".")
+ end
+
+ -- Unset any implied options that are actually required.
+ for dep_opt in pairs(enforced_options) do
+ if all_required_options[dep_opt] then
+ enforced_options[dep_opt] = nil
+ end
+ end
+ if next(enforced_options) ~= nil then
+ print([[When set, it enforces these options:
+.Pp
+.Bl -item -compact]])
+
+ local sorted_dep_opt = {}
+ for dep_opt in pairs(enforced_options) do
+ sorted_dep_opt[#sorted_dep_opt + 1] = dep_opt
+ end
+
+ table.sort(sorted_dep_opt)
+ for _, dep_opt in ipairs(sorted_dep_opt) do
+ local dep_val = enforced_options[dep_opt]
+ local dep_prefix = (dep_val and "WITH_") or
+ "WITHOUT_"
+ local dep_name = dep_opt:gsub("^MK_",
+ dep_prefix)
+ print(".It")
+ print(".Va " .. dep_name)
+ end
+
+ print(".El")
+ end
+
+ if next(effect_options) ~= nil then
+ if next(enforced_options) ~= nil then
+ -- Remove any options that were previously
+ -- noted as enforced...
+ for opt, val in pairs(effect_options) do
+ if enforced_options[opt] == val then
+ effect_options[opt] = nil
+ end
+ end
+
+ -- ... and this could leave us with an empty
+ -- set.
+ if next(effect_options) == nil then
+ goto noenforce
+ end
+
+ print(".Pp")
+ end
+
+ print([[When set, these options are also in effect:
+.Pp
+.Bl -inset -compact]])
+
+ local sorted_dep_opt = {}
+ for dep_opt in pairs(effect_options) do
+ sorted_dep_opt[#sorted_dep_opt + 1] = dep_opt
+ end
+
+ table.sort(sorted_dep_opt)
+ for _, dep_opt in ipairs(sorted_dep_opt) do
+ local dep_val = effect_options[dep_opt]
+ local dep_prefix = (dep_val and "WITH_") or
+ "WITHOUT_"
+ local not_dep_prefix = ((not dep_val) and "WITH_") or
+ "WITHOUT_"
+ local dep_name = dep_opt:gsub("^MK_",
+ dep_prefix)
+ local not_dep_name = dep_opt:gsub("^MK_",
+ not_dep_prefix)
+
+ print(".It Va " .. dep_name)
+ print("(unless")
+ print(".Va " .. not_dep_name)
+ print("is set explicitly)")
+ end
+
+ print(".El")
+::noenforce::
+ end
+
+ if env_only_opts[name] ~= nil then
+ print([[.Pp
+This must be set in the environment, make command line, or
+.Pa /etc/src-env.conf ,
+not
+.Pa /etc/src.conf .]])
+ end
+ ::skip::
+ end
+ print([[.El
+.Pp
+The following options accept a single value from a list of valid values.
+.Bl -tag -width indent]])
+ for _, name in ipairs(options) do
+ if name:match("^OPT_") then
+ local desc = opt_descriptions[name]
+
+ print(".It Va " .. name:gsub("^OPT_", ""))
+ if desc then
+ io.stdout:write(desc)
+ else
+ io.stderr:write("Missing description for " ..
+ name .. "\n")
+ end
+ end
+ end
+ io.stdout:write(output_tail)
+end
+
+local tmpdir = "/tmp/makeman." .. unistd.getpid()
+
+if not lfs.mkdir(tmpdir) then
+ error("Failed to create tempdir " .. tmpdir)
+end
+
+-- Catch any errors so that we can properly clean up, then re-throw it.
+local ret, errobj = pcall(main, tmpdir)
+
+for fname in lfs.dir(tmpdir) do
+ if fname ~= "." and fname ~= ".." then
+ assert(os.remove(tmpdir .. "/" .. fname))
+ end
+end
+
+if not lfs.rmdir(tmpdir) then
+ assert(io.stderr:write("Failed to clean up tmpdir: " .. tmpdir .. "\n"))
+end
+
+if not ret then
+ io.stderr:write(errobj .. "\n")
+ os.exit(1)
+end
diff --git a/tools/build/test-includes/Makefile b/tools/build/test-includes/Makefile
index 2c25e0fb32ce..5c45fd7daa4f 100644
--- a/tools/build/test-includes/Makefile
+++ b/tools/build/test-includes/Makefile
@@ -26,6 +26,9 @@ CFLAGS.event.c= -D_WANT_KEVENT32 -D_WANT_FREEBSD11_KEVENT
# details like __inline that the header files must follow to support C89.
CFLAGS+=-ansi
+# Make sure we're pulling in headers from the src tree.
+CFLAGS+=-I${SRCTOP}/sys
+
.include "badfiles.inc"
.for h c in ${HDRS:@x@$x ${x:S,/,_,g:R}.c@}
diff --git a/tools/build/test-includes/badfiles.inc b/tools/build/test-includes/badfiles.inc
index 5f088d3862aa..9feb73edc5d0 100644
--- a/tools/build/test-includes/badfiles.inc
+++ b/tools/build/test-includes/badfiles.inc
@@ -65,11 +65,8 @@ BADHDRS= \
sys/kobj.h \
sys/ksem.h \
sys/ktls.h \
- sys/ktrace.h \
sys/libkern.h \
sys/link_aout.h \
- sys/linker.h \
- sys/linker_set.h \
sys/lock.h \
sys/lock_profile.h \
sys/lockf.h \
@@ -77,7 +74,6 @@ BADHDRS= \
sys/loginclass.h \
sys/mbuf.h \
sys/md4.h \
- sys/md5.h \
sys/mdioctl.h \
sys/memdesc.h \
sys/memrange.h \
@@ -85,7 +81,6 @@ BADHDRS= \
sys/module_khelp.h \
sys/mpt_ioctl.h \
sys/msgbuf.h \
- sys/mutex.h \
sys/namei.h \
sys/osd.h \
sys/pciio.h \
@@ -106,7 +101,6 @@ BADHDRS= \
sys/runq.h \
sys/rwlock.h \
sys/sbuf.h \
- sys/sema.h \
sys/sf_buf.h \
sys/sglist.h \
sys/sigio.h \
@@ -117,10 +111,8 @@ BADHDRS= \
sys/sockopt.h \
sys/stack.h \
sys/stats.h \
- sys/sx.h \
sys/syscallsubr.h \
sys/syslimits.h \
- sys/systm.h \
sys/taskqueue.h \
sys/terminal.h \
sys/termios.h \
@@ -140,7 +132,6 @@ BADHDRS= \
sys/vdso.h \
sys/vmmeter.h \
sys/vnode.h \
- net/bpf.h \
net/bpf_buffer.h \
net/bpf_jitter.h \
net/bpf_zerocopy.h \
@@ -155,13 +146,11 @@ BADHDRS= \
net/if_llc.h \
net/if_media.h \
net/if_mib.h \
- net/if_pfsync.h \
net/if_tap.h \
net/if_tun.h \
net/if_var.h \
net/if_vlan_var.h \
net/iflib.h \
- net/iflib_private.h \
net/ifq.h \
net/mp_ring.h \
net/mppc.h \
@@ -172,9 +161,7 @@ BADHDRS= \
net/paravirt.h \
net/pfil.h \
net/pfkeyv2.h \
- net/pfvar.h \
net/radix.h \
- net/raw_cb.h \
net/rndis.h \
net/route.h \
net/rss_config.h \
@@ -256,9 +243,7 @@ BADHDRS= \
netinet/in_pcb.h \
netinet/in_pcb_var.h \
netinet/in_rss.h \
- netinet/in_systm.h \
netinet/in_var.h \
- netinet/ip.h \
netinet/ip6.h \
netinet/ip_carp.h \
netinet/ip_dummynet.h \
@@ -275,14 +260,11 @@ BADHDRS= \
netinet/sctp_pcb.h \
netinet/sctp_structs.h \
netinet/sctp_sysctl.h \
- netinet/tcp_debug.h \
netinet/tcp_hpts.h \
netinet/tcp_log_buf.h \
netinet/tcp_lro.h \
netinet/tcp_offload.h \
- netinet/tcp_pcap.h \
netinet/tcp_ratelimit.h \
- netinet/tcp_var.h \
netinet/tcpip.h \
netinet/toecore.h \
netinet/udplite.h \
@@ -294,7 +276,6 @@ BADHDRS= \
netinet6/ip6.h \
netinet6/ip6_mroute.h \
netinet6/ip6_var.h \
- netinet6/ip6protosw.h \
netinet6/ip_fw_nat64.h \
netinet6/ip_fw_nptv6.h \
netinet6/mld6.h \
@@ -314,7 +295,6 @@ BADHDRS= \
netipsec/ipsec6.h \
netipsec/key_debug.h \
netipsec/keysock.h \
- netipsec/xform.h \
netsmb/netbios.h \
netsmb/smb.h \
netsmb/smb_conn.h \