git: 976ba7f02a21 - main - Enable building tar for non-FreeBSD host
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 24 Apr 2023 17:21:19 UTC
The branch main has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=976ba7f02a211c57709301782e710c5b38a3f272
commit 976ba7f02a211c57709301782e710c5b38a3f272
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-04-24 17:20:17 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-04-24 17:20:17 +0000
Enable building tar for non-FreeBSD host
For DIRDEPS_BUILD we need Makefile.depend.options to
force libegacy to be built on older FreeBSD and non-FreeBSD hosts.
Add readpassphrase to libegacy to avoid the need for libbsd on Linux
src.opts.mk disable TESTS for host if MK_host_egacy is yes
Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39766
---
lib/libarchive/config_freebsd.h | 2 ++
share/mk/src.opts.mk | 6 ++++++
tools/build/Makefile | 12 ++++++++++++
tools/build/cross-build/include/linux/includes.h | 4 ++++
usr.bin/tar/Makefile.depend.host | 11 +++++++++++
usr.bin/tar/Makefile.depend.options | 6 ++++++
6 files changed, 41 insertions(+)
diff --git a/lib/libarchive/config_freebsd.h b/lib/libarchive/config_freebsd.h
index 20230ca26adf..dabc84d17ee6 100644
--- a/lib/libarchive/config_freebsd.h
+++ b/lib/libarchive/config_freebsd.h
@@ -100,7 +100,9 @@
#define HAVE_DIRENT_H 1
#define HAVE_DIRFD 1
#define HAVE_DLFCN_H 1
+#ifndef __linux__
#define HAVE_D_MD_ORDER 1
+#endif
#define HAVE_EFTYPE 1
#define HAVE_EILSEQ 1
#define HAVE_ERRNO_H 1
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 8f56f757b60b..62d3936ded20 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -360,6 +360,12 @@ __DEFAULT_YES_OPTIONS+=NETLINK_SUPPORT
__DEFAULT_NO_OPTIONS+=NETLINK_SUPPORT
.endif
+# MK_host_egacy is set by local.sys.mk so is valid here
+.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
+# we cannot expect tests to work
+BROKEN_OPTIONS+= TESTS
+.endif
+
.-include <site.src.opts.mk>
.include <bsd.mkopt.mk>
diff --git a/tools/build/Makefile b/tools/build/Makefile
index a1b8bbb8b2aa..1dc6e9fc189b 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -208,6 +208,18 @@ CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \
SRCS+= progname.c
# Stub implementations of fflagstostr/strtofflags
SRCS+= fflags.c
+
+# tar needs readpassphrase
+# the version from openssh is already "portable"
+# but we need to take care with .PATH as we
+# do not want getopt_long.c from crypto/openssh/openbsd-compat
+# and we do not want readpassphrase.c from libc/gen
+.PATH: ${SRCTOP}/crypto/openssh
+OBJS_SRCS_FILTER= T R
+SRCS+= openbsd-compat/readpassphrase.c
+
+INCS+= ${SRCTOP}/crypto/openssh/openbsd-compat/readpassphrase.h
+
.endif # ${MAKE.OS} == "Linux"
.if ${.MAKE.OS} == "Darwin"
diff --git a/tools/build/cross-build/include/linux/includes.h b/tools/build/cross-build/include/linux/includes.h
new file mode 100644
index 000000000000..ed9ea212ee10
--- /dev/null
+++ b/tools/build/cross-build/include/linux/includes.h
@@ -0,0 +1,4 @@
+#include <sys/cdefs.h>
+#include <paths.h>
+
+#define DEF_WEAK(a)
diff --git a/usr.bin/tar/Makefile.depend.host b/usr.bin/tar/Makefile.depend.host
new file mode 100644
index 000000000000..f80275d86ab1
--- /dev/null
+++ b/usr.bin/tar/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.depend.options b/usr.bin/tar/Makefile.depend.options
new file mode 100644
index 000000000000..4dcc6c412671
--- /dev/null
+++ b/usr.bin/tar/Makefile.depend.options
@@ -0,0 +1,6 @@
+DIRDEPS_OPTIONS = host_egacy
+
+DIRDEPS.host_egacy.yes = tools/build
+
+.include <dirdeps-options.mk>
+