Git supports multiple working trees attached to the same repository,
with the git-worktree(1) subcommand.
When building from a Git working tree, the repository metadata in .git
from the top source directory is a file (containing the actual location
of the metadata) instead of the usual directory structure. With this
change, build.sh allows .git to be a directory or a regular file
instead, therefore letting the sources build as expected from a Git
working tree.
To test: (without this patch)
src$ git worktree add ../src-clean-tree
[...]
src$ (cd ../src-clean-tree && ./build.sh tools)
[...]
ERROR: Cannot determine VCS for '.../src-clean-tree/'
XXX: pullup-10 pullup-9
Set MAKECONF to mk.conf in the same directory as build.sh
(i.e., the top of the source tree) if mk.conf is present.
This means unprivileged users can benefit from mk.conf(5)
semantics without write privileges to /etc/mk.conf, and
also simplifies per-source-directory configuration.
Fail early if $MAKECONF is empty, since build.sh will fail
anyway after rebuilding nbmake.
Ensure that the computed MAKECONF isn't empty, and then
always set MAKECONF in the makewrapper (nbmake-$MACHINE).
Improve some formatting consistency in BUILDING.mdoc,
(even if BUILDING is generated without markup).
Add show-params operation to the makefile target, and reword
params operation to describe what it's done since 2012.
(In 2012-11-04 the Makefile's previous params target was renamed
to show-params and a new params target was added to save a 'params'
file, and build.sh wasn't adapted.)
Use UPPERCASE as the convention to describe an option argument,
as it's more noticable than lowercase in the help description.
Expand tabs in the help.
Editorial improvements.
Remove support for building extsrc/:
1. Makefile: remove do-extsrc target.
2. build.sh: remove options -y and -Y extsrcdir.
3. distrib/sets: remove support for extsrc in various tools
including the options -L ext and -y, and the extsrc sets.
4. doc/BUILDING.mdoc: remove docs for extsrc/, EXTSRCSRCDIR, MKEXTSRC (etc)
5. bsd.own.mk and various Makefiles: remove support for extsrc/,
EXTSRCSRCDIR, MKEXTSRC.
As proposed on tech-kern and tech-userlevel on 2022-01-07
and followed up on 2022-08-21.
Split help into synopsis and help.
Only display the synopsis for usage errors (not the full help).
Print usage errors to stderr not stdout.
Don't print a usage error for -? before the help message.
Improve error messages for unknown options and missing arguments.
Remove trailing "." present in some error messages.
Alway use 'quote' instead of `quote' in some error messages.
HOST_CPPFLAGS, HOST_CXXFLAGS, but not LIBRARY_PATH because it breaks
the build. These variables are necessary to support building NetBSD
from a GNU Guix or NixOS host, where /usr/include, /lib, and all
but /bin/sh do not exist. In many cases, support for HOST_CPPFLAGS
was incomplete. From Ryan Sundberg
build with -P would use. Example usage:
./build.sh -T /usr/tools -P mkrepro-timestamp
This allows us to extract this information once, make other use of it,
and replicate it on other machines with -V MKREPRO=yes -V MKREPRO_TIMESTAMP=..
from the uname -p value already fetched.
this means eg, build.sh on evbarm will build the native platform rather
than "earm" (armv5) -- which was the default even on arm64 hosts.