Skip to content

Commit f3783d8

Browse files
committed
build: remove certctl requirement for host OpenSSL libs
MK_OPENSSL is indicative of what we expect to build, not of what we have available on the host. Some platforms, like macOS, do not expose headers for the system's libcrypto for public consumption. libcrypto isn't very heavy and won't persist past the host tools, so just add it to our bootstrap set to fix the build on macOS. Reported by: jrtc27 Fixes: 81d8827 ("certctl: Reimplement in C")
1 parent dd22a68 commit f3783d8

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

Makefile.inc1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,8 +2708,16 @@ _basic_bootstrap_tools+=sbin/md5
27082708
_basic_bootstrap_tools+=usr.sbin/tzsetup
27092709
.endif
27102710

2711-
# certctl is needed as an install tool
2711+
# certctl is needed as an install tool. libcrypto is rather light, so we'll
2712+
# build that alongside it for platforms that don't expose headers for OpenSSL,
2713+
# like macOS.
27122714
.if ${MK_CAROOT} != "no" && ${MK_OPENSSL} != "no"
2715+
.if ${.MAKE.OS} == "Darwin" || ${.MAKE.OS} == "FreeBSD"
2716+
BSTOOL_ARGS+= -DLIBCRYPTO_WITHOUT_SUBDIRS
2717+
BSTOOL_ARGS+= -DWITHOUT_AUTO_ASM
2718+
_bootstrap_libcrypto=secure/lib/libcrypto
2719+
${_bt}-usr.sbin/certctl: ${_bt}-secure/lib/libcrypto
2720+
.endif
27132721
_certctl=usr.sbin/certctl
27142722
.endif
27152723

@@ -2776,6 +2784,7 @@ bootstrap-tools: ${_bt}-links .PHONY
27762784
${_strfile} \
27772785
usr.bin/dtc \
27782786
${_cat} \
2787+
${_bootstrap_libcrypto} \
27792788
${_certctl} \
27802789
${_kbdcontrol} \
27812790
${_elftoolchain_libs} \
@@ -2813,8 +2822,9 @@ ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE
28132822
if [ "${_tool}" = "usr.bin/lex" ]; then \
28142823
${MAKE} DIRPRFX=${_tool}/ bootstrap; \
28152824
fi; \
2816-
${MAKE} DIRPRFX=${_tool}/ all; \
2817-
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install
2825+
${MAKE} DIRPRFX=${_tool}/ ${BSTOOL_ARGS} all; \
2826+
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy \
2827+
${BSTOOL_ARGS} install
28182828

28192829
bootstrap-tools: ${_bt}-${_tool}
28202830
.endfor

share/mk/bsd.endian.mk

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ LOCALEDEF_ENDIAN= -b
2020
#
2121
# During bootstrapping on !FreeBSD OSes, we need to define some value. Short of
2222
# having an exhaustive list for all variants of Linux and MacOS we simply do not
23-
# set TARGET_ENDIANNESS and poison the other variables. They should be unused
24-
# during the bootstrap phases (apart from one place that's adequately protected
25-
# in bsd.compiler.mk) where we're building the bootstrap tools.
23+
# set TARGET_ENDIANNESS (on Linux) and poison the other variables. They should
24+
# be unused during the bootstrap phases (apart from one place that's adequately
25+
# protected in bsd.compiler.mk) where we're building the bootstrap tools.
2626
#
27+
.if ${.MAKE.OS} == "Darwin"
28+
# We do assume the endianness on macOS because Apple's modern hardware is all
29+
# little-endian. This might need revisited in the far future, but for the time
30+
# being Apple Silicon's reign of terror continues. We only set this one up
31+
# because libcrypto is now built in bootstrap.
32+
TARGET_ENDIANNESS= 1234
33+
.endif
2734
CAP_MKDB_ENDIAN= -B # Poisoned value, invalid flags for both cap_mkdb
2835
LOCALEDEF_ENDIAN= -B # and localedef.
2936
.endif

tools/build/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ INSTALLDIR_LIST= \
495495
bin \
496496
lib/geom \
497497
usr/include/casper \
498+
usr/include/openssl \
498499
usr/include/private/ucl \
499500
usr/include/private/zstd \
500501
usr/lib \

0 commit comments

Comments
 (0)