mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 19:31:08 +01:00
atf: Fix ATF_BUILD_* values when not using the bootstrap compiler
Currently, we encode the full path and compile flags for the build compiler in libatf. However, these values are not correct when cross-compiling: For example, when I build on macOS, CC is set to the host path /usr/local/Cellar/llvm/11.0.0_1/bin/clang-11. This path will not exist on the target system. Simplify this logic and use cc/cpp/c++ since those binaries will exist on the target system unless the compiler was explicitly disabled. I'm not convinced ATF needs to encode these values, but this is a minimal fix for these tests when using a non-bootstrapped compiler. Reviewed By: ngie, brooks Differential Revision: https://reviews.freebsd.org/D28414
This commit is contained in:
parent
d6f4e1a897
commit
9b131f1e51
@ -28,22 +28,6 @@
|
||||
.include <src.opts.mk>
|
||||
.include <bsd.init.mk>
|
||||
|
||||
# Store the toolchain executable in ATF_BUILD_{CC,CPP,CXX} to ensure other
|
||||
# values -- like -target, -B ..., etc -- don't get leaked into the tests.
|
||||
#
|
||||
# Be sure to omit ${CCACHE_BIN} (if specified) from the variable as it gets
|
||||
# automatically appended to the variables in bsd.compiler.mk when
|
||||
# ${MK_CCACHE_BUILD} != no.
|
||||
ATF_BUILD_CC:= ${CC:N${CCACHE_BIN}:[1]}
|
||||
ATF_BUILD_CPP:= ${CPP:N${CCACHE_BIN}:[1]}
|
||||
ATF_BUILD_CXX:= ${CXX:N${CCACHE_BIN}:[1]}
|
||||
|
||||
# Only capture defines, includes, linker flags, optimization levels, warnings
|
||||
# and preprocessor flags when building ATF_BUILD_{C,CPP,CXX}FLAGS.
|
||||
ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*}
|
||||
ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*}
|
||||
ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*}
|
||||
|
||||
PACKAGE= tests
|
||||
LIB= atf-c
|
||||
PRIVATELIB= true
|
||||
@ -54,12 +38,6 @@ ATF= ${SRCTOP}/contrib/atf
|
||||
.PATH: ${ATF}/atf-c
|
||||
.PATH: ${ATF}/atf-c/detail
|
||||
|
||||
CFLAGS+= -DATF_BUILD_CC='"${ATF_BUILD_CC}"'
|
||||
CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"'
|
||||
CFLAGS+= -DATF_BUILD_CPP='"${ATF_BUILD_CPP}"'
|
||||
CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"'
|
||||
CFLAGS+= -DATF_BUILD_CXX='"${ATF_BUILD_CXX}"'
|
||||
CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"'
|
||||
CFLAGS+= -I${ATF}
|
||||
CFLAGS+= -I${.CURDIR}
|
||||
CFLAGS+= -I.
|
||||
@ -160,5 +138,6 @@ MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility.
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
.include "Makefile.inc"
|
||||
.include "../common.mk"
|
||||
.include <bsd.lib.mk>
|
||||
|
@ -1,3 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
CFLAGS+= -DATF_BUILD_CC='"cc"'
|
||||
CFLAGS+= -DATF_BUILD_CFLAGS='"-Wall"'
|
||||
CFLAGS+= -DATF_BUILD_CPP='"cpp"'
|
||||
CFLAGS+= -DATF_BUILD_CPPFLAGS='""'
|
||||
CFLAGS+= -DATF_BUILD_CXX='"c++"'
|
||||
CFLAGS+= -DATF_BUILD_CXXFLAGS='"-Wall"'
|
||||
|
@ -35,4 +35,5 @@ SRCS.${_T}= ${_T}.c test_helpers.c
|
||||
TEST_METADATA.${_T}+= required_programs="cc"
|
||||
.endfor
|
||||
|
||||
.include "Makefile.inc"
|
||||
.include <bsd.test.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user