git: 8d5d329553b3 - main - Bootstrap libz when cross-building from non-FreeBSD
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 19:17:06 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=8d5d329553b345c0887405db741750b0f728d902
commit 8d5d329553b345c0887405db741750b0f728d902
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-12-06 18:12:46 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-12-06 19:16:28 +0000
Bootstrap libz when cross-building from non-FreeBSD
This is needed now libdwarf depends on libz.
Fixes: dbf05458e3bd ("libdwarf: Support consumption of compressed ELF sections")
MFC after: 1 week
---
Makefile.inc1 | 4 ++++
lib/libz/Makefile | 7 ++++++-
tools/build/mk/Makefile.boot | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Makefile.inc1 b/Makefile.inc1
index 828de1bbbd84..2f425a6552e9 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2469,6 +2469,10 @@ _other_bootstrap_tools+=usr.bin/bmake
# Avoid dependency on host bz2 headers:
_other_bootstrap_tools+=lib/libbz2
${_bt}-usr.bin/grep: ${_bt}-lib/libbz2
+
+# libdwarf depends on libz
+_other_bootstrap_tools+=lib/libz
+${_bt}-lib/libdwarf: ${_bt}-lib/libz
.else
# All tools in _basic_bootstrap_tools have the same name as the subdirectory
# so we can use :T to get the name of the symlinks that we need to create.
diff --git a/lib/libz/Makefile b/lib/libz/Makefile
index 4ece3e3e059f..a954fee95118 100644
--- a/lib/libz/Makefile
+++ b/lib/libz/Makefile
@@ -38,9 +38,14 @@ SRCS+= inflate.c
SRCS+= inftrees.c
SRCS+= trees.c
SRCS+= uncompr.c
-SRCS+= zopen.c
SRCS+= zutil.c
+# Wrapper relies on FreeBSD-specific fpos_t representation and non-portable
+# funopen. Not needed for bootstrapping, so just disable it.
+.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
+SRCS+= zopen.c
+.endif
+
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
CFLAGS+= -DUNALIGNED_OK
.endif
diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot
index 8ac360e663c9..4e6f3508b30d 100644
--- a/tools/build/mk/Makefile.boot
+++ b/tools/build/mk/Makefile.boot
@@ -16,7 +16,6 @@ NM:= /usr/bin/nm
# Avoid stale dependecy warnings:
LIBC:=
-LIBZ:=
LIBM:=
LIBUTIL:=
LIBCPLUSPLUS:=
@@ -30,6 +29,7 @@ LIBL:=${WORLDTMP}/legacy/usr/lib/libl.a
LIBROKEN:=${WORLDTMP}/legacy/usr/lib/libroken.a
LIBDWARF:=${WORLDTMP}/legacy/usr/lib/libdwarf.a
LIBELF:=${WORLDTMP}/legacy/usr/lib/libelf.a
+LIBZ:=${WORLDTMP}/legacy/usr/lib/libz.a
# Add various -Werror flags to catch missing function declarations
CFLAGS+= -Werror=implicit-function-declaration -Werror=implicit-int \