From c5280c443b15491467cee09e9dc13d05cdab1f7f Mon Sep 17 00:00:00 2001 From: ngie Date: Tue, 19 Feb 2019 22:40:32 +0000 Subject: [PATCH] Add MK_GOOGLETEST option for building/installing gmock/gtest These libraries don't compile on non-C++-11 capable compilers, e.g., g++ 4.2.1 and its corresponding implementation of the c++ library, i.e., libstdc++. Blacklist compilation on all non-C++-11 capable compilers and give others the option of opting out of building/installing gmock/gtest via MK_GOOGLETEST. This option is controlled by MK_CXX and MK_TESTS, as ATF compilation is. --- lib/Makefile | 2 +- share/man/man5/src.conf.5 | 11 ++++++++++- share/mk/src.opts.mk | 3 +++ tools/build/options/WITHOUT_GOOGLETEST | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tools/build/options/WITHOUT_GOOGLETEST diff --git a/lib/Makefile b/lib/Makefile index d95150306142..f497e2c24f51 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -169,6 +169,7 @@ _libcplusplus+= libc++fs .endif SUBDIR.${MK_EFI}+= libefivar +SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s @@ -200,7 +201,6 @@ SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_TELNET}+= libtelnet SUBDIR.${MK_TESTS_SUPPORT}+= atf -SUBDIR.${MK_TESTS_SUPPORT}+= googletest SUBDIR.${MK_TESTS}+= tests SUBDIR.${MK_UNBOUND}+= libunbound SUBDIR.${MK_USB}+= libusbhid libusb diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 4f004b6718c8..37844ee18c7b 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd February 15, 2019 +.Dd February 19, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -529,6 +529,8 @@ When set, it enforces these options: .It .Va WITHOUT_GNUCXX .It +.Va WITHOUT_GOOGLETEST +.It .Va WITHOUT_LLVM_COV .It .Va WITHOUT_TESTS @@ -807,6 +809,11 @@ Set to not build GNU Set this option to include GNU extensions in .Xr bsdgrep 1 by linking against libgnuregex. +.It Va WITHOUT_GOOGLETEST +Set to not build nor install +.Lb libgmock , +.Lb libgtest , +and dependent tests. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 @@ -1784,6 +1791,8 @@ When set, it enforces these options: .Bl -item -compact .It .Va WITHOUT_DTRACE_TESTS +.It +.Va WITHOUT_GOOGLETEST .El .Pp When set, these options are also in effect: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 96d28b6cc521..70e8aacd070f 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -108,6 +108,7 @@ __DEFAULT_YES_OPTIONS = \ GDB \ GNU_DIFF \ GNU_GREP \ + GOOGLETEST \ GPIO \ HAST \ HTML \ @@ -423,6 +424,7 @@ MK_${var}:= no # Order is somewhat important. # .if !${COMPILER_FEATURES:Mc++11} +MK_GOOGLETEST:= no MK_LLVM_LIBUNWIND:= no .endif @@ -505,6 +507,7 @@ MK_FREEBSD_UPDATE:= no .if ${MK_TESTS} == "no" MK_DTRACE_TESTS:= no +MK_GOOGLETEST:= no .endif .if ${MK_ZONEINFO} == "no" diff --git a/tools/build/options/WITHOUT_GOOGLETEST b/tools/build/options/WITHOUT_GOOGLETEST new file mode 100644 index 000000000000..1ac48fbf9372 --- /dev/null +++ b/tools/build/options/WITHOUT_GOOGLETEST @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not build nor install +.Lb libgmock , +.Lb libgtest , +and dependent tests.