Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108976574
D39541.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
22 KB
Referenced Files
None
Subscribers
None
D39541.diff
View Options
diff --git a/contrib/libc-vis/vis.c b/contrib/libc-vis/vis.c
--- a/contrib/libc-vis/vis.c
+++ b/contrib/libc-vis/vis.c
@@ -135,25 +135,27 @@
#if !HAVE_NBTOOL_CONFIG_H
#ifndef __NetBSD__
-/*
- * On NetBSD MB_LEN_MAX is currently 32 which does not fit on any integer
- * integral type and it is probably wrong, since currently the maximum
- * number of bytes and character needs is 6. Until this is fixed, the
- * loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and
- * the assertion is commented out.
- */
-#ifdef __FreeBSD__
/*
* On FreeBSD including <sys/systm.h> for CTASSERT only works in kernel
* mode.
+ * On Linux and macOS there is no notion of CTASSERT at all.
*/
#ifndef CTASSERT
#define CTASSERT(x) _CTASSERT(x, __LINE__)
#define _CTASSERT(x, y) __CTASSERT(x, y)
#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1]
#endif
-#endif /* __FreeBSD__ */
+/*
+ * On NetBSD MB_LEN_MAX is currently 32 which does not fit on any integer
+ * integral type and it is probably wrong, since currently the maximum
+ * number of bytes and character needs is 6. Likewise, glibc (Linux) defines
+ * MB_LEN_MAX as 16 which does not fit on any integer integral type. Until
+ * these are fixed, the loops below are using sizeof(wmsk <aka, uint64_t>) - 1
+ * instead of MB_LEN_MAX, and the assertion is commented out.
+ */
+#if defined(__FreeBSD__) || defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
CTASSERT(MB_LEN_MAX <= sizeof(uint64_t));
+#endif /* __FreeBSD__ || macOS */
#endif /* !__NetBSD__ */
#endif
diff --git a/contrib/mtree/extern.h b/contrib/mtree/extern.h
--- a/contrib/mtree/extern.h
+++ b/contrib/mtree/extern.h
@@ -35,10 +35,12 @@
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
-#else
+#else
+#ifndef HAVE_STRUCT_STAT_ST_FLAGS
#define HAVE_STRUCT_STAT_ST_FLAGS 1
#endif
-
+#endif
+
#include <err.h>
#include <fts.h>
#include <util.h>
diff --git a/lib/libarchive/Makefile.inc b/lib/libarchive/Makefile.inc
--- a/lib/libarchive/Makefile.inc
+++ b/lib/libarchive/Makefile.inc
@@ -6,7 +6,7 @@
LIBADD= z bz2 lzma bsdxml zstd
CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 \
-DHAVE_ZSTD_H=1 -DHAVE_LIBZSTD=1 -DHAVE_LIBZSTD_COMPRESSOR=1
-CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\"
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_${.MAKE.OS:tl}.h\"
.if ${MK_OPENSSL} != "no"
CFLAGS+= -DWITH_OPENSSL
diff --git a/lib/libarchive/config_linux.h b/lib/libarchive/config_linux.h
new file mode 100644
--- /dev/null
+++ b/lib/libarchive/config_linux.h
@@ -0,0 +1,244 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * 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(S) ``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(S) 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.
+ *
+ * $FreeBSD$
+ */
+#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
+
+#include <osreldate.h>
+
+/* This is a total wag for Linux (Ubuntu 20) */
+#define HAVE_ACL_GET_PERM_NP 1
+#define HAVE_ARC4RANDOM_BUF 1
+#define HAVE_STRUCT_XVFSCONF 1
+#define HAVE_SYS_ACL_H 1
+#define HAVE_SYS_EXTATTR_H 1
+#define HAVE_ACL_GET_LINK_NP 1
+#define HAVE_ACL_IS_TRIVIAL_NP 1
+#define HAVE_ACL_SET_LINK_NP 1
+
+#ifdef WITH_OPENSSL
+#define HAVE_LIBCRYPTO 1
+#define HAVE_OPENSSL_EVP_H 1
+#define HAVE_OPENSSL_MD5_H 1
+#define HAVE_OPENSSL_RIPEMD_H 1
+#define HAVE_OPENSSL_SHA_H 1
+#define HAVE_OPENSSL_SHA256_INIT 1
+#define HAVE_OPENSSL_SHA384_INIT 1
+#define HAVE_OPENSSL_SHA512_INIT 1
+#define HAVE_PKCS5_PBKDF2_HMAC_SHA1 1
+#define HAVE_SHA256 1
+#define HAVE_SHA384 1
+#define HAVE_SHA512 1
+#else
+#define HAVE_LIBMD 1
+#define HAVE_MD5_H 1
+#define HAVE_MD5INIT 1
+#define HAVE_RIPEMD_H 1
+#define HAVE_SHA_H 1
+#define HAVE_SHA1 1
+#define HAVE_SHA1_INIT 1
+#define HAVE_SHA256 1
+#define HAVE_SHA256_H 1
+#define HAVE_SHA256_INIT 1
+#define HAVE_SHA512 1
+#define HAVE_SHA512_H 1
+#define HAVE_SHA512_INIT 1
+#endif
+
+#define HAVE_BSDXML_H 1
+#define HAVE_BZLIB_H 1
+#define HAVE_CHFLAGS 1
+#define HAVE_CHOWN 1
+#define HAVE_CHROOT 1
+#define HAVE_CTIME_R 1
+#define HAVE_CTYPE_H 1
+#define HAVE_DECL_EXTATTR_NAMESPACE_USER 1
+#define HAVE_DECL_INT32_MAX 1
+#define HAVE_DECL_INT32_MIN 1
+#define HAVE_DECL_INT64_MAX 1
+#define HAVE_DECL_INT64_MIN 1
+#define HAVE_DECL_INTMAX_MAX 1
+#define HAVE_DECL_INTMAX_MIN 1
+#define HAVE_DECL_SIZE_MAX 1
+#define HAVE_DECL_SSIZE_MAX 1
+#define HAVE_DECL_STRERROR_R 1
+#define HAVE_DECL_UINT32_MAX 1
+#define HAVE_DECL_UINT64_MAX 1
+#define HAVE_DECL_UINTMAX_MAX 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DIRFD 1
+#define HAVE_DLFCN_H 1
+#define HAVE_EILSEQ 1
+#define HAVE_ERRNO_H 1
+#define HAVE_FCHDIR 1
+#define HAVE_FCHFLAGS 1
+#define HAVE_FCHMOD 1
+#define HAVE_FCHOWN 1
+#define HAVE_FCNTL 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FDOPENDIR 1
+#define HAVE_FORK 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSTAT 1
+#define HAVE_FSTATAT 1
+#define HAVE_FSTATFS 1
+#define HAVE_FSTATVFS 1
+#define HAVE_FTRUNCATE 1
+#define HAVE_FUTIMES 1
+#define HAVE_FUTIMESAT 1
+#define HAVE_GETEUID 1
+#define HAVE_GETGRGID_R 1
+#define HAVE_GETGRNAM_R 1
+#define HAVE_GETPID 1
+#define HAVE_GETPWNAM_R 1
+#define HAVE_GETPWUID_R 1
+#define HAVE_GETVFSBYNAME 1
+#define HAVE_GMTIME_R 1
+#define HAVE_GRP_H 1
+#define HAVE_INTMAX_T 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LANGINFO_H 1
+#define HAVE_LCHFLAGS 1
+#define HAVE_LCHMOD 1
+#define HAVE_LCHOWN 1
+#define HAVE_LIBZ 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LINK 1
+#define HAVE_LINKAT 1
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALTIME_R 1
+#define HAVE_LONG_LONG_INT 1
+#define HAVE_LSTAT 1
+#define HAVE_LUTIMES 1
+#define HAVE_MBRTOWC 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMORY_H 1
+#define HAVE_MEMSET 1
+#define HAVE_MKDIR 1
+#define HAVE_MKFIFO 1
+#define HAVE_MKNOD 1
+#define HAVE_MKSTEMP 1
+#define HAVE_NL_LANGINFO 1
+#define HAVE_OPENAT 1
+#define HAVE_PATHS_H 1
+#define HAVE_PIPE 1
+#define HAVE_POLL 1
+#define HAVE_POLL_H 1
+#define HAVE_POSIX_SPAWNP 1
+#define HAVE_PTHREAD_H 1
+#define HAVE_PWD_H 1
+#define HAVE_READDIR_R 1
+#define HAVE_READLINK 1
+#define HAVE_READLINKAT 1
+#define HAVE_READPASSPHRASE 1
+#define HAVE_READPASSPHRASE_H 1
+#define HAVE_REGEX_H 1
+#define HAVE_SELECT 1
+#define HAVE_SETENV 1
+#define HAVE_SETLOCALE 1
+#define HAVE_SIGACTION 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_SPAWN_H 1
+#define HAVE_STATFS 1
+#define HAVE_STATVFS 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCHR 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRERROR_R 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRNLEN 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRUCT_STATFS_F_NAMEMAX 1
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
+#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+#define HAVE_SYMLINK 1
+#define HAVE_SYS_CDEFS_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_MOUNT_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_POLL_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_STATVFS_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_UTSNAME_H 1
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_TIMEGM 1
+#define HAVE_TIME_H 1
+#define HAVE_TZSET 1
+#define HAVE_UINTMAX_T 1
+#define HAVE_UNISTD_H 1
+#define HAVE_UNLINKAT 1
+#define HAVE_UNSETENV 1
+#define HAVE_UNSIGNED_LONG_LONG 1
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+#define HAVE_UTIME 1
+#define HAVE_UTIMES 1
+#define HAVE_UTIME_H 1
+#define HAVE_VFORK 1
+#define HAVE_VPRINTF 1
+#define HAVE_WCHAR_H 1
+#define HAVE_WCHAR_T 1
+#define HAVE_WCRTOMB 1
+#define HAVE_WCSCMP 1
+#define HAVE_WCSCPY 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCTOMB 1
+#define HAVE_WCTYPE_H 1
+#define HAVE_WMEMCMP 1
+#define HAVE_WMEMCPY 1
+#define HAVE_WMEMMOVE 1
+#define HAVE_ZLIB_H 1
+#define TIME_WITH_SYS_TIME 1
+#define HAVE_FUTIMENS 1
+#define HAVE_UTIMENSAT 1
+
+/* FreeBSD defines for archive_hash.h */
+#ifdef WITH_OPENSSL
+#define ARCHIVE_CRYPTO_MD5_OPENSSL 1
+#define ARCHIVE_CRYPTO_RMD160_OPENSSL 1
+#define ARCHIVE_CRYPTO_SHA1_OPENSSL
+#define ARCHIVE_CRYPTO_SHA256_OPENSSL 1
+#define ARCHIVE_CRYPTO_SHA384_OPENSSL 1
+#define ARCHIVE_CRYPTO_SHA512_OPENSSL 1
+#else
+#define ARCHIVE_CRYPTO_MD5_LIBMD 1
+#define ARCHIVE_CRYPTO_SHA1_LIBMD 1
+#define ARCHIVE_CRYPTO_SHA256_LIBMD 1
+#define ARCHIVE_CRYPTO_SHA512_LIBMD 1
+#endif
diff --git a/lib/libc/db/Makefile.inc b/lib/libc/db/Makefile.inc
--- a/lib/libc/db/Makefile.inc
+++ b/lib/libc/db/Makefile.inc
@@ -3,11 +3,15 @@
#
CFLAGS+=-D__DBINTERFACE_PRIVATE
+.if ${MACHINE:Nhost*} != "" || ${.MAKE.OS} == "FreeBSD"
.include "${LIBC_SRCTOP}/db/btree/Makefile.inc"
+.endif
.include "${LIBC_SRCTOP}/db/db/Makefile.inc"
.include "${LIBC_SRCTOP}/db/hash/Makefile.inc"
.include "${LIBC_SRCTOP}/db/man/Makefile.inc"
+.if ${MACHINE:Nhost*} != "" || ${.MAKE.OS} == "FreeBSD"
.include "${LIBC_SRCTOP}/db/mpool/Makefile.inc"
.include "${LIBC_SRCTOP}/db/recno/Makefile.inc"
+.endif
SYM_MAPS+=${LIBC_SRCTOP}/db/Symbol.map
diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk
--- a/share/mk/local.dirdeps.mk
+++ b/share/mk/local.dirdeps.mk
@@ -60,7 +60,17 @@
rm -rf ${OBJTOP}/tmp
beforedirdeps: cleanup_worldtmp
.endif
+
+# pseudo option for building host tools on old or non-FreeBSD host
+# allows us to leverage Makefile.depend.options with
+# DIRDEPS_OPTIONS = host_egacy
+.if ${.MAKE.OS} != "FreeBSD" || ${_HOST_OSREL:R} < ${OS_REVISION:R}
+MK_host_egacy.host= yes
.endif
+# this will apply otherwise
+MK_host_egacy= no
+
+.endif # !target(_DIRDEP_USE)
# reset this each time
DIRDEPS_FILTER.xtras=
@@ -71,6 +81,7 @@
.if ${DEP_MACHINE} != "host"
# this is how we can handle optional dependencies
+# actually Makefile.depend.options is better
.if ${DEP_RELDIR} == "lib/libc"
DIRDEPS += lib/libc_nonshared
.if ${MK_SSP:Uno} != "no"
diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk
--- a/share/mk/local.init.mk
+++ b/share/mk/local.init.mk
@@ -19,7 +19,8 @@
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
LDADD+= --sysroot=${SYSROOT}
.elif ${MK_STAGING} == "yes"
-CFLAGS+= -isystem ${STAGE_INCLUDEDIR}
+ISYSTEM?= ${STAGE_INCLUDEDIR}
+CFLAGS+= -isystem${ISYSTEM}
# XXX: May be needed for GCC to build with libc++ rather than libstdc++. See Makefile.inc1
#CXXFLAGS+= -std=gnu++11
#LDADD+= -L${STAGE_LIBDIR}/libc++
@@ -38,4 +39,8 @@
.-include "src.init.mk"
.-include <site.init.mk>
.-include "${.CURDIR}/local.init.mk"
+
+.if !empty(HAVE_FLAGS)
+CFLAGS+= ${HAVE_FLAGS:U:@F@-D${F}=${$F:U1}@}
+.endif
.endif
diff --git a/share/mk/src.init.linux.mk b/share/mk/src.init.linux.mk
new file mode 100644
--- /dev/null
+++ b/share/mk/src.init.linux.mk
@@ -0,0 +1,34 @@
+# We want to build some host tools (eg makefs, mkimg) for Linux
+
+.if ${MACHINE:Nhost*} == ""
+
+CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
+
+WARNS= 0
+
+CFLAGS+= -DEFTYPE=EINVAL
+
+.ifdef PROG
+LOCAL_LIBRARIES+= bsd egacy
+LIBADD+= egacy m
+# static linking does not work
+NO_SHARED= no
+.endif
+
+MK_TESTS= no
+MK_MAN= no
+
+# override some HAVE_FLAGS
+HAVE_STRUCT_DINODE_DI_SHORTLINK= 0
+HAVE_STRUCT_STAT_ST_FLAGS= 0
+
+# someone used __unused for struct padding on Linux
+# we don't care enough about linux/sysctl.h to work around it
+CFLAGS+= -D__unused= -D_LINUX_SYSCTL_H
+
+# avoid type conflicts
+CFLAGS+= -D__va_list=__builtin_va_list
+
+CFLAGS+= -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_XOPEN_SOURCE
+
+.endif
diff --git a/share/mk/src.init.mk b/share/mk/src.init.mk
--- a/share/mk/src.init.mk
+++ b/share/mk/src.init.mk
@@ -8,4 +8,20 @@
${_+_}@env BUILDENV_DIR=${.CURDIR} ${MAKE} -C ${SRCTOP} buildenv
.endif
+.if ${MACHINE:Nhost*} == ""
+.-include <src.init.${.MAKE.OS:tl}.mk>
+
+.if ${.MAKE.OS} == "FreeBSD" && ${_HOST_OSREL:R} < ${OS_REVISION:R}
+.ifdef PROG
+LOCAL_LIBRARIES+= egacy
+LIBADD+= egacy
+.endif
+.endif
+
+.if ${MK_STAGING} == "yes"
+ISYSTEM= /usr/include
+CFLAGS+= -I${STAGE_INCLUDEDIR}
+.endif
+.endif
+
.endif # !target(__<src.init.mk>__)
diff --git a/share/mk/src.sys.env.mk b/share/mk/src.sys.env.mk
--- a/share/mk/src.sys.env.mk
+++ b/share/mk/src.sys.env.mk
@@ -24,7 +24,7 @@
RELSRCTOP?= ${RELTOP}
.if !defined(OS_REVISION)
-OS_REVISION!=eval `sh ${SRCTOP}/sys/conf/newvers.sh -V REVISION` && echo $$REVISION || echo
+OS_REVISION!=eval `sh ${SRCTOP}/sys/conf/newvers.sh -V REVISION 2> /dev/null` && echo $$REVISION || echo
.export OS_REVISION
.endif
diff --git a/targets/pseudo/host-tools/Makefile b/targets/pseudo/host-tools/Makefile
new file mode 100644
--- /dev/null
+++ b/targets/pseudo/host-tools/Makefile
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/targets/pseudo/host-tools/Makefile.depend.host b/targets/pseudo/host-tools/Makefile.depend.host
new file mode 100644
--- /dev/null
+++ b/targets/pseudo/host-tools/Makefile.depend.host
@@ -0,0 +1,7 @@
+DIRDEPS= \
+ tools/build/cross-build/mkimg \
+ usr.bin/tar \
+ usr.sbin/makefs \
+
+.include <dirdeps.mk>
+
diff --git a/targets/pseudo/stage/Makefile b/targets/pseudo/stage/Makefile
--- a/targets/pseudo/stage/Makefile
+++ b/targets/pseudo/stage/Makefile
@@ -4,6 +4,7 @@
# distrib-dirs can be done in STAGE_OBJTOP
all:
+.if ${.MAKE.OS} == "FreeBSD"
# mtree makes a lot of noise if we are not root,
# we don't need to see it.
stage-distrib-dirs: .META ${META_DEPS}
@@ -11,6 +12,21 @@
INSTALL="sh ${SRCTOP}/tools/install.sh" ${.MAKE} -C ${SRCTOP}/etc \
distrib-dirs -DNO_FSCHG -DWITH_TESTS DESTDIR=${STAGE_OBJTOP}
+.else
+std_dirs= \
+ /bin \
+ /etc \
+ /sbin \
+ /usr/bin \
+ /usr/include/sys \
+ /usr/lib \
+ /usr/sbin \
+
+stage-distrib-dirs: .META
+ mkdir -p ${std_dirs:@d@${STAGE_OBJTOP}$d@}
+
+.endif
+
.include <bsd.prog.mk>
.if ${.MAKE.LEVEL} > 0 && ${MK_STAGING} == "yes"
diff --git a/tools/build/Makefile b/tools/build/Makefile
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -50,6 +50,9 @@
.PATH: ${.CURDIR}/../../contrib/libc-pwcache
CFLAGS.pwcache.c+= -I${.CURDIR}/../../contrib/libc-pwcache
SRCS+= pwcache.c
+INCS+= ${.CURDIR}/cross-build/include/common/grp.h
+# static inline does not work for this
+CFLAGS.pwcache.c+= -DSETGROUPENT_IMPL
.endif
_WITH_STRSVIS!= grep -c strsvis ${HOST_INCLUDE_ROOT}/vis.h 2>/dev/null || true
@@ -125,7 +128,11 @@
CHACHA20INCS+= ${SRCTOP}/sys/crypto/chacha20/_chacha.h \
${SRCTOP}/sys/crypto/chacha20/chacha.h
+.if ${MACHINE:Nhost*} == ""
+_host_arch= ${_HOST_ARCH}
+.else
_host_arch=${MACHINE}
+.endif
.if ${_host_arch} == "x86_64"
# bmake on Linux/mac often prints that instead of amd64
_host_arch=amd64
@@ -163,6 +170,15 @@
.if ${.MAKE.OS} != "FreeBSD"
.PATH: ${.CURDIR}/cross-build
+INCS+= \
+ ${.CURDIR}/cross-build/include/common/osreldate.h \
+ ${SRCTOP}/include/readpassphrase.h \
+
+SYSINCS+= \
+ ${.CURDIR}/cross-build/include/common/sys/cdefs.h \
+ ${.CURDIR}/cross-build/include/common/sys/param.h \
+ ${.CURDIR}/cross-build/include/common/sys/types.h \
+
# Needed by our sys/types.h wrapper
SYSINCS+= ${SRCTOP}/sys/sys/bitcount.h
@@ -191,10 +207,10 @@
SRCS+= rpmatch.c
.if ${.MAKE.OS} == "Linux"
-# On Linux, glibc does not provide strlcpy,strlcat or strmode.
+# glibc does not provide strlcpy, strlcat, or strmode.
.PATH: ${LIBC_SRCTOP}/string
SRCS+= strlcpy.c strlcat.c strmode.c
-# On Linux, glibc provides ffs* but not fls*
+# glibc provides ffs*, but not fls*
SRCS+= fls.c flsl.c flsll.c
# Compile the fgetln/fgetwln/closefrom fallback code from libbsd:
SRCS+= fgetln_fallback.c fgetwln_fallback.c closefrom.c
diff --git a/tools/build/cross-build/fflags.c b/tools/build/cross-build/fflags.c
--- a/tools/build/cross-build/fflags.c
+++ b/tools/build/cross-build/fflags.c
@@ -37,6 +37,7 @@
* SUCH DAMAGE.
*/
+#include <sys/types.h>
#include <string.h>
#include <unistd.h>
diff --git a/tools/build/cross-build/include/common/grp.h b/tools/build/cross-build/include/common/grp.h
--- a/tools/build/cross-build/include/common/grp.h
+++ b/tools/build/cross-build/include/common/grp.h
@@ -50,10 +50,29 @@
const char *group_from_gid(gid_t gid, int noname);
#ifdef __linux__
+
+#ifdef SETGROUPENT_IMPL
+int setgroupent(int);
+int
+#else
static inline int
+#endif
setgroupent(int stayopen __unused)
{
setgrent();
return (1);
}
+
+#ifdef SETGROUPENT_IMPL
+int setpassent(int);
+int
+#else
+static inline int
+#endif
+setpassent(int stayopen __unused)
+{
+ setgrent();
+ return (1);
+}
+
#endif
diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h
--- a/tools/build/cross-build/include/common/sys/cdefs.h
+++ b/tools/build/cross-build/include/common/sys/cdefs.h
@@ -259,6 +259,35 @@
#define __ISO_C_VISIBLE 2011
#define __EXT1_VISIBLE 1
+/*
+ * Nullability qualifiers: currently only supported by Clang.
+ */
+#if !(defined(__clang__) && __has_feature(nullability))
+#ifndef _Nonnull
+#define _Nonnull
+#endif
+#ifndef _Nullable
+#define _Nullable
+#endif
+#ifndef _Null_unspecified
+#define _Null_unspecified
+#endif
+#ifndef __NULLABILITY_PRAGMA_PUSH
+#define __NULLABILITY_PRAGMA_PUSH
+#endif
+#ifndef __NULLABILITY_PRAGMA_POP
+#define __NULLABILITY_PRAGMA_POP
+#endif
+#else
+#ifndef __NULLABILITY_PRAGMA_PUSH
+#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
+#endif
+#ifndef __NULLABILITY_PRAGMA_POP
+#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
+#endif
+#endif
+
/* Alignment builtins for better type checking and improved code generation. */
/* Provide fallback versions for other compilers (GCC/Clang < 10): */
#if !__has_builtin(__builtin_is_aligned)
diff --git a/tools/build/cross-build/include/linux/sys/_types.h b/tools/build/cross-build/include/linux/sys/_types.h
new file mode 100644
--- /dev/null
+++ b/tools/build/cross-build/include/linux/sys/_types.h
@@ -0,0 +1,2 @@
+#include <bits/types.h>
+
diff --git a/tools/build/cross-build/mkimg/Makefile b/tools/build/cross-build/mkimg/Makefile
--- a/tools/build/cross-build/mkimg/Makefile
+++ b/tools/build/cross-build/mkimg/Makefile
@@ -17,7 +17,6 @@
.endif
-MK_STAGING=no
MK_TESTS= no
.include <${MKIMG_SRC}/Makefile>
diff --git a/tools/build/cross-build/mkimg/Makefile.depend.host b/tools/build/cross-build/mkimg/Makefile.depend.host
new file mode 100644
--- /dev/null
+++ b/tools/build/cross-build/mkimg/Makefile.depend.host
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile
--- a/usr.bin/tar/Makefile
+++ b/usr.bin/tar/Makefile
@@ -29,12 +29,17 @@
.endif
CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\"
-CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_${.MAKE.OS:tl}.h\"
CFLAGS+= -I${_LIBARCHIVEDIR}/tar -I${_LIBARCHIVEDIR}/libarchive
CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe
SYMLINKS= bsdtar ${BINDIR}/tar
MLINKS= bsdtar.1 tar.1
+.if ${.MAKE.OS} == "Linux"
+LIBADD+= bsd
+MK_TESTS= no
+.endif
+
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -34,7 +34,9 @@
.include "${SRCDIR}/ffs/Makefile.inc"
.include "${SRCDIR}/msdos/Makefile.inc"
-CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1
+HAVE_FLAGS+= \
+ HAVE_STRUCT_DINODE_DI_SHORTLINK \
+ HAVE_STRUCT_STAT_ST_FLAGS \
.PATH: ${SRCTOP}/contrib/mtree
CFLAGS+=-I${SRCTOP}/contrib/mtree
diff --git a/usr.sbin/makefs/Makefile.depend.host b/usr.sbin/makefs/Makefile.depend.host
new file mode 100644
--- /dev/null
+++ b/usr.sbin/makefs/Makefile.depend.host
@@ -0,0 +1,12 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ lib/libnetbsd \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.sbin/makefs/Makefile.depend.options b/usr.sbin/makefs/Makefile.depend.options
new file mode 100644
--- /dev/null
+++ b/usr.sbin/makefs/Makefile.depend.options
@@ -0,0 +1,6 @@
+DIRDEPS_OPTIONS = host_egacy
+
+DIRDEPS.host_egacy.yes = tools/build
+
+.include <dirdeps-options.mk>
+
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -714,7 +714,11 @@
} else if (S_ISLNK(cur->type)) { /* symlink */
slen = strlen(cur->symlink);
if (slen < UFS1_MAXSYMLINKLEN) { /* short link */
+#ifdef HAVE_STRUCT_DINODE_DI_SHORTLINK
memcpy(dinp->di_shortlink, cur->symlink, slen);
+#else
+ memcpy(dinp->di_db, cur->symlink, slen);
+#endif
} else
membuf = cur->symlink;
dinp->di_size = slen;
@@ -773,7 +777,11 @@
} else if (S_ISLNK(cur->type)) { /* symlink */
slen = strlen(cur->symlink);
if (slen < UFS2_MAXSYMLINKLEN) { /* short link */
+#ifdef HAVE_STRUCT_DINODE_DI_SHORTLINK
memcpy(dinp->di_shortlink, cur->symlink, slen);
+#else
+ memcpy(dinp->di_db, cur->symlink, slen);
+#endif
} else
membuf = cur->symlink;
dinp->di_size = slen;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 5:13 AM (8 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16354863
Default Alt Text
D39541.diff (22 KB)
Attached To
Mode
D39541: Simplify building host tools for non-FreeBSD hosts
Attached
Detach File
Event Timeline
Log In to Comment