From 01ba1df6a7f40a8f8a1d590f0f57e0fdf9c0571a Mon Sep 17 00:00:00 2001 From: emaste Date: Thu, 20 Oct 2016 14:48:57 +0000 Subject: [PATCH] Add knobs to make GNU diff and GNU grep optional This is added to facilitate experiments building FreeBSD without copyleft software. If WITHOUT_GNU_DIFF is set no /usr/bin/diff or /usr/bin/diff3 will be built. If WITHOUT_GNU_GREP is set then BSD grep will be installed as /usr/bin/bsdgrep or /usr/bin/grep, depending on the WITH_BSD_GREP knob. Reviewed by: brooks (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: Differential Revision: https://reviews.freebsd.org/D8288 --- gnu/usr.bin/Makefile | 6 ++--- share/mk/src.opts.mk | 2 ++ tools/build/mk/OptionalObsoleteFiles.inc | 33 ++++++++++++++++++++++++ tools/build/options/WITHOUT_GNU_DIFF | 5 ++++ tools/build/options/WITHOUT_GNU_GREP | 3 +++ 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 tools/build/options/WITHOUT_GNU_DIFF create mode 100644 tools/build/options/WITHOUT_GNU_GREP diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile index a92971750691..0782ec32dfec 100644 --- a/gnu/usr.bin/Makefile +++ b/gnu/usr.bin/Makefile @@ -2,10 +2,6 @@ .include -SUBDIR= diff \ - diff3 \ - grep - SUBDIR_DEPEND_gdb= ${_binutils} .if ${MK_CXX} != "no" @@ -21,6 +17,8 @@ SUBDIR.${MK_GDB}+= gdb .endif SUBDIR.${MK_GCC}+= cc +SUBDIR.${MK_GNU_DIFF}+= diff diff3 +SUBDIR.${MK_GNU_GREP}+= grep SUBDIR.${MK_GPL_DTC}+= dtc SUBDIR.${MK_TESTS}+= tests diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 1794f3fb9954..89125d695130 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -98,6 +98,8 @@ __DEFAULT_YES_OPTIONS = \ GCOV \ GDB \ GNU \ + GNU_DIFF \ + GNU_GREP \ GNU_GREP_COMPAT \ GPIO \ GPL_DTC \ diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 6037da4766bb..e2ca4d2ff8e9 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2173,6 +2173,39 @@ OLD_FILES+=usr/share/man/man3/gpio_pin_tristate.3.gz OLD_FILES+=usr/share/man/man8/gpioctl.8.gz .endif +.if ${MK_GNU_DIFF} == no +OLD_FILES+=usr/bin/diff +OLD_FILES+=usr/bin/diff3 +OLD_FILES+=usr/share/man/man1/diff.1.gz +OLD_FILES+=usr/share/man/man1/diff3.1.gz +OLD_FILES+=usr/share/man/man7/diff.7.gz +.endif + +.if ${MK_GNU_GREP} == no +OLD_FILES+=usr/bin/gnugrep +OLD_FILES+=usr/share/man/man1/gnugrep.1.gz +.if ${MK_BSD_GREP} == no +OLD_FILES+=usr/bin/bzgrep +OLD_FILES+=usr/bin/bzegrep +OLD_FILES+=usr/bin/bzfgrep +OLD_FILES+=usr/bin/egrep +OLD_FILES+=usr/bin/fgrep +OLD_FILES+=usr/bin/grep +OLD_FILES+=usr/bin/zegrep +OLD_FILES+=usr/bin/zfgrep +OLD_FILES+=usr/bin/zgrep +OLD_FILES+=usr/share/man/man1/bzegrep.1.gz +OLD_FILES+=usr/share/man/man1/bzfgrep.1.gz +OLD_FILES+=usr/share/man/man1/bzgrep.1.gz +OLD_FILES+=usr/share/man/man1/egrep.1.gz +OLD_FILES+=usr/share/man/man1/fgrep.1.gz +OLD_FILES+=usr/share/man/man1/grep.1.gz +OLD_FILES+=usr/share/man/man1/zegrep.1.gz +OLD_FILES+=usr/share/man/man1/zfgrep.1.gz +OLD_FILES+=usr/share/man/man1/zgrep.1.gz +.endif +.endif + # Also includes vgrind(1) .if ${MK_GROFF} == no OLD_FILES+=usr/bin/addftinfo diff --git a/tools/build/options/WITHOUT_GNU_DIFF b/tools/build/options/WITHOUT_GNU_DIFF new file mode 100644 index 000000000000..de8667fe4d73 --- /dev/null +++ b/tools/build/options/WITHOUT_GNU_DIFF @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . diff --git a/tools/build/options/WITHOUT_GNU_GREP b/tools/build/options/WITHOUT_GNU_GREP new file mode 100644 index 000000000000..1bb7d4a53eba --- /dev/null +++ b/tools/build/options/WITHOUT_GNU_GREP @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr grep 1 .