aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-02-03 09:32:16 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-02-03 09:32:16 +0000
commit9b131f1e51a00c8bbbda32672fb5db88010400f6 (patch)
tree51a4ac2cc5312df1be252db85abea7651c7badee
parentd6f4e1a8973daff2ffe4480b66c973562982ffc7 (diff)
downloadsrc-9b131f1e51a00c8bbbda32672fb5db88010400f6.tar.gz
src-9b131f1e51a00c8bbbda32672fb5db88010400f6.zip
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
-rw-r--r--lib/atf/libatf-c/Makefile23
-rw-r--r--lib/atf/libatf-c/Makefile.inc7
-rw-r--r--lib/atf/libatf-c/tests/Makefile1
3 files changed, 9 insertions, 22 deletions
diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile
index 78b821b3c64d..7c9807c24ded 100644
--- a/lib/atf/libatf-c/Makefile
+++ b/lib/atf/libatf-c/Makefile
@@ -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>
diff --git a/lib/atf/libatf-c/Makefile.inc b/lib/atf/libatf-c/Makefile.inc
index 265f86d1ed55..f668e36b2d6a 100644
--- a/lib/atf/libatf-c/Makefile.inc
+++ b/lib/atf/libatf-c/Makefile.inc
@@ -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"'
diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile
index c99b2d115967..3bcdfc8f7071 100644
--- a/lib/atf/libatf-c/tests/Makefile
+++ b/lib/atf/libatf-c/tests/Makefile
@@ -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>