From 4be1ca354c7cf79c8a9d28f71782c7241332ee9f Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 25 Nov 2014 19:20:25 +0000 Subject: [PATCH] Make building/installing bhyve optional via MK_BHYVE on amd64 Disable building/installing bhyve from src.opts.mk on unsupported architectures (!amd64) --- share/examples/Makefile | 7 +++++-- share/man/man4/Makefile | 5 ++++- share/mk/src.opts.mk | 7 +++++++ tools/build/mk/OptionalObsoleteFiles.inc | 8 ++++++++ tools/build/options/WITHOUT_BHYVE | 4 ++++ tools/build/options/WITH_BHYVE | 4 ++++ usr.sbin/Makefile.amd64 | 2 ++ 7 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tools/build/options/WITHOUT_BHYVE create mode 100644 tools/build/options/WITH_BHYVE diff --git a/share/examples/Makefile b/share/examples/Makefile index 79de48eb312..609344f66e2 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -7,7 +7,6 @@ LDIRS= BSD_daemon \ FreeBSD_version \ IPv6 \ - bhyve \ bootforth \ csh \ diskless \ @@ -42,7 +41,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ FreeBSD_version/Makefile \ FreeBSD_version/README \ IPv6/USAGE \ - bhyve/vmrun.sh \ bootforth/README \ bootforth/boot.4th \ bootforth/frames.4th \ @@ -207,6 +205,11 @@ NO_OBJ= # in environments where it's not possible to keep /sys publicly readable) SHARED?= copies +.if ${MK_BHYVE} != "no" +LDIRS+= bhyve +XFILES+= bhyve/vmrun.sh +.endif + beforeinstall: ${SHARED} etc-examples .ORDER: ${SHARED} etc-examples diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 76b3d55c2c6..1aefe7a4f13 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -835,7 +835,6 @@ _xnb.4= xnb.4 .endif .if ${MACHINE_CPUARCH} == "amd64" -_bhyve.4= bhyve.4 _if_ntb.4= if_ntb.4 _ntb.4= ntb.4 _ntb_hw.4= ntb_hw.4 @@ -858,6 +857,10 @@ _nvram2env.4= nvram2env.4 SUBDIR= man4.${MACHINE_CPUARCH} .endif +.if ${MK_BHYVE} != "no" +_bhyve.4= bhyve.4 +.endif + .if ${MK_TESTS} != "no" ATF= ${.CURDIR}/../../../contrib/atf .PATH: ${ATF}/doc diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 0a469280f9d..87af499a12d 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -212,6 +212,13 @@ __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .endif +# bhyve is only supported on amd64 +.if ${__T} == "amd64" +__DEFAULT_YES_OPTIONS+=BHYVE +.else +MK_BHYVE:= no +.endif + # hyperv is only supported on amd64 and i386/i386 .if ${__T} == "amd64" || (${__T} == "i386" && ${__TT} == "i386") __DEFAULT_YES_OPTIONS+=HYPERV diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index cefaab22c64..60f2551ffe5 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -144,6 +144,14 @@ OLD_FILES+=usr/share/man/man8/authpf.8.gz OLD_FILES+=usr/share/man/man8/authpf-noip.8.gz .endif +.if ${MK_BHYVE} == no +OLD_FILES+=usr/sbin/bhyve +OLD_FILES+=usr/sbin/bhyvectl +OLD_FILES+=usr/sbin/bhyveload +OLD_FILES+=usr/share/man/man8/bhyve.8.gz +OLD_FILES+=usr/share/man/man8/bhyveload.8.gz +.endif + .if ${MK_BLUETOOTH} == no OLD_FILES+=etc/bluetooth/hcsecd.conf OLD_FILES+=etc/bluetooth/hosts diff --git a/tools/build/options/WITHOUT_BHYVE b/tools/build/options/WITHOUT_BHYVE new file mode 100644 index 00000000000..f60fd17ddba --- /dev/null +++ b/tools/build/options/WITHOUT_BHYVE @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to not build or install +.Xr bhyve 8 , +associated utilities, and examples. diff --git a/tools/build/options/WITH_BHYVE b/tools/build/options/WITH_BHYVE new file mode 100644 index 00000000000..b136928c128 --- /dev/null +++ b/tools/build/options/WITH_BHYVE @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to build and install +.Xr bhyve 8 , +associated utilities, and examples. diff --git a/usr.sbin/Makefile.amd64 b/usr.sbin/Makefile.amd64 index 2d1a3e8daad..3f40974c7a0 100644 --- a/usr.sbin/Makefile.amd64 +++ b/usr.sbin/Makefile.amd64 @@ -10,9 +10,11 @@ SUBDIR+= acpi SUBDIR+= apm .endif SUBDIR+= asf +.if ${MK_BHYVE} != "no" SUBDIR+= bhyve SUBDIR+= bhyvectl SUBDIR+= bhyveload +.endif SUBDIR+= boot0cfg .if ${MK_TOOLCHAIN} != "no" SUBDIR+= btxld