Home | History | Annotate | Download | only in src
History log of /src/build.sh
RevisionDateAuthorComments
 1.400  20-Oct-2025  nat New port: mac68ksf - Macintosh 68k softfloat.

This commit is all the Makefile glue for the new port which is the mac68k
port with MKSOFTFLOAT set to "yes".

As posted here:
https://mail-index.netbsd.org/port-mac68k/2025/10/14/msg001037.html
 1.399  08-Jul-2025  hgutch Export MKREPRO to environment when calling build.sh -P

This matches what setup_mkrepro() does when MKREPRO or
MKREPRO_TIMESTAMP are set manually.

This fixes PR toolchain/59512.
 1.398  14-Jun-2025  rillig build.sh: fix error message when validating the make params

Found by ShellCheck.
 1.397  13-May-2025  riastradh build.sh: Put back hyphen as revisionid separator for now.

The space has trouble somewhere along the way passing through make
variables, enviornment variables, and tools configure scripts, so
let's undo this for now until I have a moment to sit down and make it
work properly.
 1.396  13-May-2025  riastradh build.sh: Clarify revisionid a little bit.

1. Put the CVS tag back -- this was lost in 1.393, and I suspect it
was unintentional (martin: feel free to correct me if my suspicion
is wrong and you really meant to nix the CVS tag).

2. Identify the revision control system in the commit id so you don't
have to wonder if you are just missing this changeset id or you're
mixing up git and hg.

3. Separate with spaces rather than hyphens so there is a chance to
parse this later -- tags/branches tend to allow hyphens but not
spaces. (If there's a reason not to use spaces, it's not clear to
me.)

Evenutally I would like to change this to an even more semantically
meaningful identifier, something like

hg identify -T '{latesttag}-{changessincelatesttag}{ifeq(phase,"public","","!{phase")}-hg-{id}{dirty}'

so it would come out as something like:

netbsd-11.99.3-121-hg-0123abcd4567ef

if this is a public commit on trunk with a clean working tree, or

netbsd-11.99.3-123!draft-hg-89ab01cd23ef45+

if this is a draft commit on trunk with a dirty working tree. But
for this to be useful we have to have the tags assigned, which is not
currently done in the ongoing conversion -- to be fixed in the final
migration.
 1.395  13-May-2025  riastradh build.sh: Use `src' and `xsrc' in revision ids, not basename of pwd.

PR toolchain/59418: using the basename of the cloned source dirs
breaks reproducible builds
 1.394  10-May-2025  martin Fix git formatting for show-revisionid
 1.393  10-May-2025  martin Unify the output of "show-revisionid" between the various VCSes
and checkout/archive variants.
 1.392  10-May-2025  martin Expert hack: if you know what you are doing, allow to avoid
the tool build for some commands that might or might not need
it, like:

build.sh -VUSETOOLS=never -P mkrepro-timestamp show-revisionid

This will not need any tools when run on a new-enough NetBSD host or
if using some other VCS than CVS.
 1.391  23-Apr-2025  martin Simplify previous (from kre@)
 1.390  22-Apr-2025  martin Minor cosmetic tweaks to previous
 1.389  22-Apr-2025  martin Fix "show-revisionid" operation to include both src and xsrc
data if the -x argument is present.
 1.388  28-Dec-2024  gutteridge build.sh: fix spelling and grammar in a help string
 1.387  23-Dec-2024  kre Make sure that local var=$expansion is properly quoted as local var="$exp"
correcting some quotes incorrectly removed in the previous version, and
adding some that should have been present but never were.

This pointed out by riastradh@ -- thanks.

Also, one addition which should have been the previous update's commit
message - a couple of uses of subshells, where the only reason was to
control shell operator precedence (which works, but is costly) were changed
(in the previous rev) to use groups instead (ie: brace bracketing instead of
parentheses).
 1.386  20-Dec-2024  kre General code cleanup. No operational change intended.

Mostly fix quoting, some missing quotes added, lots of meaningless
quotes removed (no guarantee of completeness in either of those).

Also get rid of one use of the obsolete test -o operator, and several
less than ideal uses of the test ! operator ... replace all that by
shell || and ! uses.

Don't use $@ in any context where field splitting cannot occur (also
avoid it in a couple of places where it would be defined, but isn't
actually wanted:
echo "whatever: $@"
is technically OK, but is generally just a waste of everyone's time,
the shell passing a whole set of args to echo for it to combine
back into one line is pointless. But X="$@" and using $@ in a
here doc are simply wrong.

The 80-column police visited during the update (just a couple of
hard cases managed to avoid detection).

Many extraneous use of sh \ line continuations removed when better
use of sh syntax means they're not required.

General cleanup of sh coding style (prefer clarity over white space
minimization).

If these changes cause any issues (aside from a small possibility of
slight layout changes in some error messages) that anyone is able
to observe, please let me know.
 1.385  20-Dec-2024  riastradh build.sh: Make `build.sh pkg=...' bomb with -x/MKX11=yes for now.
 1.384  20-Dec-2024  martin Fix typo in previous
 1.383  20-Dec-2024  martin Add a new operation "show-revisionid" that extracts a marker usable
to recreate the source (depending on the revision controll system
in use).
 1.382  19-Dec-2024  riastradh build.sh: Use X11_TYPE=modular for build.sh pkg=... by default.

You can override it in your MAKECONF if you want to debug issues in
pkgsrc with cross-building X11_TYPE=native, but let's try to make
things work out of the box here if you don't go out of your way.
 1.381  29-Nov-2024  riastradh build.sh: Fix whitespace error introduced in previous commit.

PR toolchain/58536: build.sh should support cross-building packages
into images
 1.380  29-Nov-2024  riastradh build.sh: Experimental new target pkg=CATEGORY/PACKAGE.

Cross-builds a binary package of CATEGORY/PACKAGE from pkgsrc,
bootstrapping pkgsrc as necessary for the cross-build.

Requires pkgsrc, which can be specified by either:

- setting PKGSRCDIR with -V or in the environment
- having it at ./pkgsrc
- having it at ../pkgsrc
- having it at /usr/pkgsrc

This isn't perfect -- it'd be better if we had some kind of manifest
for the packages you want built and/or included in install images --
but I've been sitting on this for months; let's just give it a try
and see where this goes. We can take it out again if the experiment
turns out not to be fruitful.

PR toolchain/58536: build.sh should support cross-building packages
into images
 1.379  23-Jul-2024  riastradh build.sh: Adjust xsrc existence test as requested.

PR toolchain/58399
 1.378  05-Jul-2024  riastradh build.sh: Check for xsrc/Makefile, not just xsrc/.

Should make the failure mode a little more obvious when you forget to
mount xsrc.

PR toolchain/58399
 1.377  23-Apr-2024  martin branches: 1.377.2;
For consistency, check MKREPRO_TIMESTAMP always numerically (not as string)
 1.376  20-Apr-2024  rillig build.sh: fix typos in usage message
 1.375  03-Jan-2024  thorpej Add virt68k to valid_MACHINE_ARCH.
 1.374  04-Sep-2023  khorben build.sh: add support for git worktree

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
 1.373  18-Jul-2023  lukem build.sh: use mk.conf (if present) as MAKECONF

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).
 1.372  13-Jun-2023  christos fix build.sh wrong variable use that caused nbmake to be always rebult
(Jan-Benedict Glaw)
 1.371  02-Jun-2023  lukem build.sh: add show-params operation

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.)
 1.370  02-Jun-2023  lukem build.sh: fix MKUNPRIVED comment

I renamed UNPRIVED to MKUNPRIVED 20 years ago, and missed a comment.
 1.369  16-May-2023  lukem build.sh, BUILDING: consistency improvements

Consistently use "show", instead of sometimes using "display" or "print".
Fix mdoc markup (even though BUILDING is raw text).
Document help, -P, -?
 1.368  23-Apr-2023  uwe build.sh: drop -lrumpdev hack introduced in previous

The existing trick in sys/rump/librump/rumpdev/rump_dev.c was not
updated after the renames in the kernel. kudos to riastradh.

PR kern/56599
 1.367  23-Apr-2023  uwe build.sh: tweak rumptest and RUMP_LIBSETS

Use --no-whole-archive to keep us as honest as currently possible.
PR kern/56599
 1.366  13-Mar-2023  martin Avoid the dependency on a populated tooldir (or building the tools)
when simply doing mkrepro-timestamp and the current repository setups
does not actually require it.
 1.365  21-Aug-2022  lukem branches: 1.365.2;
build.sh: usage improvements

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.
 1.364  21-Aug-2022  lukem Deprecate extsrc/, EXTSRCSRCDIR, MKEXTSRC

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.
 1.363  15-Aug-2022  lukem build.sh: improve help and usage

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.
 1.362  14-Aug-2022  lukem build.sh: improve help versus usage

Rework help / usage semantics:
- send help to stdout, exit 0.
- send usage to stderr, exit 1.
 1.361  31-Dec-2021  christos Don't try to install netbsd-CONFIG.debug files build with kernel=
 1.360  29-Dec-2021  christos Enable split-debug files for kernels. Enabled by default with MKDEBUG=yes.
 1.359  04-Oct-2021  andvar remove duplicate the article in comments.
 1.358  18-Sep-2021  christos Patch the build script and toolchain to allow passing through
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
 1.357  17-Sep-2021  joerg Fix timestamp extraction logic for Mercurial repos to use UTC.
Extend logic to also cover "hg archive".
 1.356  09-Sep-2021  martin Add a new operation "mkrepro-timestamp" to extract the timestamp a
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=..
 1.355  29-Aug-2021  christos Fix rumptest target && enable separate rump target. From Damien Zammit
 1.354  06-Aug-2021  andvar fix various typos in comments.
 1.353  07-Jun-2021  christos Good bye oabi! Tested building earmv7hf.
 1.352  27-May-2021  christos kre@ does not like the subshell :-)
 1.351  26-May-2021  christos handle different flavors of date(1)
 1.350  17-May-2021  christos for mercurial, use the latest revision instead of limiting the output to 1
(requested by joerg)
 1.349  17-May-2021  christos Handle git and mercurial for reproducible builds.
 1.348  14-May-2021  christos ignore cvslatest errors in expert mode
 1.347  25-Apr-2021  christos branches: 1.347.2;
Add mipsn64e[bl] targets which use 64 bit binaries instead of n32 ones.
 1.346  28-Jan-2021  martin Modify the generated make wrapper to avoid complaints about
non-writable OBJDIR from make (which happen a lot when cross-building
kernels re-using a makewrapper build for some other user).
 1.345  20-Sep-2020  mrg add "distsets" alias for "distribution sets".
 1.344  14-Sep-2020  kim Fix typo in usage
 1.343  26-Jul-2020  rillig make(1): remove references to the removed lst.lib
 1.342  30-Jun-2020  riastradh New build.sh option: -c <compiler>

Could never remember what the incantation is to do a clang build, so
now it's just `build.sh -c clang'.
 1.341  13-Jun-2020  riastradh Nix trailing whitespace.
 1.340  13-Jun-2020  lukem nbmake bootstrap: silent configure if MAKEVERBOSE==0

Be consistent with the silencing of configure in tools/
and suppress the output in build.sh configure of nbmake
 1.339  24-May-2020  rin Add missing MACHINE_ARCH=earmv5hf{,eb} for evbarm.
 1.338  23-May-2020  jmcneill When MACHINE_ARCH is missing, give direction on how to get a list of valid options
 1.337  23-May-2020  jmcneill Remove plain "earm" targets, and require an explicit MACHINE_ARCH for
evbarm instead of selecting a default.
 1.336  23-May-2020  jmcneill Remove evbarm OABI targets
 1.335  18-May-2020  jmcneill Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.
 1.334  28-Mar-2020  jmcneill Allow path components that start with ~
 1.333  07-Jun-2019  sborrill branches: 1.333.2;
Fix long-term broken pattern match when determining if uname -p output is
valid. [^a-z] syntax isn't valid.
 1.332  02-May-2019  mrg on netbsd when defaulting to the native system, also derived MACHINE_ARCH
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.
 1.331  25-Apr-2019  pgoyette Tyop in error message...
 1.330  08-Feb-2019  mrg add aliases for evbarm without saying 'earm':
- copy all the 'evbearm' alias as 'evbarm'.
 1.329  30-Dec-2018  christos add build libs (undocumented).
 1.328  09-Aug-2018  christos Add some aliases (from phone)
 1.327  02-May-2018  pgoyette branches: 1.327.2;
Re-add files that were accidentally deleted in my previous commit.
 1.326  02-May-2018  pgoyette Synch with HEAD
 1.325  01-Apr-2018  ryo Add initial support for ARMv8 (AARCH64) (by nisimura@ and ryo@)

- sys/arch/evbarm64 is gone and integrated into sys/arch/evbarm. (by skrll@)
- add support fdt. evbarm/conf/GENERIC64 fdt (bcm2837,sunxi,tegra) based generic 64bit kernel config. (by skrll@, jmcneill@)
 1.324  24-Jan-2018  skrll branches: 1.324.2;
Remove port-acorn26

OK core@
 1.323  15-Jan-2018  uwe Restore formatting/indentation of the configure call in rebuildmake()
to what it used to be.
 1.322  15-Jan-2018  uwe Make sure nbmake is always built with the right _PATH_DEFSYSPATH.
 1.321  08-Oct-2017  kre Better validation of var name args to -V and -Z, in a way that makes
it trivial to add a list of banned var names for either of those args
should that ever be considered desireable (as the XXX suggests it might.)
I've had this mod locked in my tree for (at least) months - time to set it free.
 1.320  08-Oct-2017  kre If we're going xsrc hunting, lets's do it properly. In particular
it is not "good" just because ../xsrc or /usr/xsrc exists, if the user said
-X /no/xsrc/here ... Further, when we find it, remember it.

While here, also look in my favourite place: .../src/xsrc - src/x would be
better (or src/x11) but that's too hard given the cvs module name and src
tarball format.
 1.319  03-Oct-2017  maya Simplify.
 1.318  03-Oct-2017  maya Accept also ../xsrc in our sanity check, we use this as a default too,
if it exists.
 1.317  02-Oct-2017  maya Add sanity check: passed -x but no xsrc directory
 1.316  08-Apr-2017  christos branches: 1.316.4;
- Allow all other targets (like kernel=) to obey mkrepro (-P)
- Print the timestamp in UTC
 1.315  10-Mar-2017  sevan State the reason script bombed.
Reword recommendation.
 1.314  18-Dec-2016  christos branches: 1.314.2;
add a trailing / to force symlink resolution.
 1.313  18-Dec-2016  christos Bail out on error computing the timestamp
 1.312  18-Dec-2016  christos Add -P for reproducible builds based on the latest cvs timestamp.
 1.311  13-Nov-2016  ast With driver modulization of if_loop.c through introduction of
sys/net/if_module.h, build.sh rumptest of -lrumpnet_virtif now also
requires -lrumpdev -lrumpvfs for if_loop.c:config_cfdriver_attach()
and kern_pmf.c:do_sys_sync().
 1.310  03-Jun-2016  kre branches: 1.310.2;

When setting TOP the idea is to run the [/usr]/bin/pwd binary, and
exclude any skell builtin. There are two ways to guarantee exec'ing
a binary, using a path, or using exec. To use a path we would need to
find it first (which certainly could be done.) Using exec here is easier.
 1.309  29-Apr-2016  christos Provide the correct system Makefile path to the tools make. This is needed
because although the arch-specific make wrapper sets $MAKEFLAGS to include
the proper system Makefile path, configure clears $MAKEFLAGS before it invokes
$MAKE to figure out which dependency style to use. This made the build fail
during the gcc build.
 1.308  27-Jun-2015  matt Make evbarm64 (little endian) the default for aarch64.
 1.307  06-May-2015  wiz Fix typo in usage. From Christopher M. Fuhrman in PR 49882.
 1.306  01-Feb-2015  christos Fix the build kernels target with -n, disable temporarily runcmd while we
are fetching the allkernels variable.
 1.305  30-Nov-2014  uebayasi Add a new build make variable, CONFIGOPTS, which is passed to config(1)
when building kernels. Revert "mkernel=*" and "mkernels" in favor of
this option.

Diff posted on source-changes-d@, approved by (null).
 1.304  16-Nov-2014  uebayasi build.sh mkernels: Build all kernels in modular build
 1.303  16-Nov-2014  uebayasi Expand TABs in usage.
 1.302  16-Nov-2014  uebayasi build.sh mkernel=*: New command to build kernel in modular
 1.301  10-Nov-2014  apb Replace '.' and '-' in ${op} with '_', before setting d_${op}=true.

Also remove or simplify older code that did the same thing in a
different way. The old code handled most cases, but did not change
op=kernel.gdb to op=kernel_gdb.
 1.300  06-Nov-2014  uebayasi build.sh: New operation "kernels" to build all kernels
 1.299  05-Nov-2014  snj iso -> images
 1.298  30-Sep-2014  apb Prefer dash to bash when searching for a usable shell.
I have tested a complete build with HOST_SH=dash on NetBSD.
 1.297  19-Sep-2014  matt Add riscv32 and riscv64 platforms.
 1.296  03-Sep-2014  matt Add or1k MACHINE/MACHINE_ARCH.
 1.295  15-Aug-2014  apb Only the -m command line option, not MACHINE from the environment,
is supposed override MACHINE_ARCH from the environment with the
default MACHINE_ARCH for the requested machine.

Add and use an opt_m variable to enforce this.
 1.294  10-Aug-2014  matt branches: 1.294.2;
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
 1.293  07-Aug-2014  apb MACHINE_ARCH from the environment may be overridden by getarch (based
on the MACHINE), but MACHINE_ARCH from the -a option should not be
overridden. The previous commit accidentally removed this behaviour.
 1.292  07-Aug-2014  apb Add a list-arch operation to build.sh.

This lists all known MACHINE/MACHINE_ARCH values, optionally
filtered by glob patterns given in the "-m" and "-a" options.
For example: build.sh -a '*arm*' list-arch
 1.291  07-Aug-2014  apb In the usage message, mention that the -m arg may be an alias.
Also adjust a comment around alias processing.
 1.290  06-Aug-2014  apb When searching for a default MACHINE_ARCH for a given MACHINE,
don't break out of the loop too early.
 1.289  04-Aug-2014  apb Synchronise several shell_quote implementations, and:
* Elide some unnecessary pairs of quotation marks, to improve readability.
For example, shell_quote "''" is now \'\' instead of ''\'''\'''.
* Don't add quotes around words that contain only safe characters,
to improve readability.
* LC_COLLATE=C to prevent [a-zA-Z] from matching non-ASCII characters.
* Use ${SED} if defined.
 1.288  03-Aug-2014  riz hpcarm wants earmv4 because some models only have v4 CPUs.
 1.287  03-Aug-2014  apb BUILDINFO part 4: build.sh

Add BUILDINFO to the list of variables saved in the makewrapper script,
and print any non-blank BUILDINFO lines near the beginning of the output
from build.sh.
Index: build.sh
 1.286  03-Aug-2014  riz Make EABI the default for arm ports, as discussed on current-users
and port-arm.
 1.285  06-Jul-2014  apb Make the makewrapper script robust against variables with
embedded special characters.
* Add a shell_quote function, identical to that in postinstall(1)
and etcupdate(1).
* In the variable=value lines emitted to the wrapper script,
quote the values, because they may contain special characters.
* Sort the variable names, not the variable=value lines, in case the
value contains newlines.
 1.284  06-Jul-2014  apb Set USETOOLS and MAKEWRAPPERMACHINE in parseoptions(), where
several other make variables are set, insteadof in special
case code in createmakewrapper().
 1.283  06-Jul-2014  apb Fix two incorrect attempts to skip blank lines or comment lines.
They failed to account for the space that is appended to ${line}
before comparison.
 1.282  14-Jun-2014  apb Print BUILDID near the beginning of build.sh.
 1.281  05-May-2014  martin Add a new action kernel.gdb=MYCONF to build a kernel with debuginfo
(and generate netbsd.gdb)
 1.280  29-Apr-2014  uebayasi Revert previous for now; resolvepath() has to work for file paths too.
 1.279  29-Apr-2014  uebayasi resolvepath: Resolve .. in absolute paths.
 1.278  31-Mar-2014  martin branches: 1.278.2;
Typo
 1.277  31-Mar-2014  martin Bring back the playstation2 port - now that a toolchain for it is
available again.
 1.276  24-Feb-2014  skrll Rename NetBSD/hp700 to NetBSD/hppa.

Unfortunately our VCS isn't very helpful here.
 1.275  10-Feb-2014  apb Move the "-U or -E must be set for build as an unprivileged user."
test from sanitycheck() to validatemakeparams(). If MKUNPRIVED is set
in mk.conf (and not on the build.sh command line) then it's not yet
available for use in the sanitycheck function.

Also move some other code for consistency.
 1.274  13-Jan-2014  apb In the sanitycheck function, treat undefined MKUNPRIVED like "no".

Other uses of MKUNPRIVED should not need this treatment, because
bsd.own.mk sets it to "no" by default, and build.sh uses getmakevar to
pick up that default (but that happens too late for the sanitycheck
function to take advantage of it).
 1.273  30-Aug-2013  pooka Rename RUMPTEST_BUILDSH to RUMPKERN_ONLY. Turns out not building any
POSIX implementations of hypercalls is useful beyond the build.sh test,
such as when building rump kernels for non-POSIX hosts.
 1.272  06-Aug-2013  matt Use earmv4 for ecats enetwinder eshark
Add evbearm variants for earmv{4,5}{,eb} earmv7{,hf} earmv6{,hf}{,eb}
 1.271  05-Aug-2013  matt Add evbearmv7-eb and evbearmv7hf-eb aliases for evbarm.
These are because cortex (armv7a) cores uses a different big-endian binary
format that previous big-endian arm systems.
 1.270  18-Jul-2013  matt Add stub port for evbcf which has enough to do a distribution build.
 1.269  28-Jun-2013  msaitoh branches: 1.269.2;
The default of hpcarm's MACHINE_ARCH is arm.
 1.268  27-Jun-2013  matt Add earm aliases for various arm ports (ecats, hpcearm, eshark, etc.)
 1.267  01-May-2013  kiyohara Support to build for epoc32 userland.
 1.266  28-Apr-2013  pooka fix "build.sh rumptest" wrt private hypercalls
 1.265  07-Mar-2013  oki fixed typo on comment.
 1.264  13-Feb-2013  christos add a disk-image=target option
 1.263  03-Feb-2013  matt Add
MACHINE=evbarm MACHINE_ARCH=earmhf ALIAS=evbearmhf-el
MACHINE=evbarm MACHINE_ARCH=earmhfeb ALIAS=evbearmhf-eb
 1.262  02-Feb-2013  hubertf If the initial build of nbmake fails, make the configure logfile
available (and tell where it is).
 1.261  14-Jan-2013  pooka Scrub TERMINFO from host env lest it leaks into libterminfo build.
 1.260  02-Dec-2012  apb Move some tests from validatemakeparams() to sanitycheck(), so the
related error messages can be printed before build.sh builds
a new version of make.

Also make some sanity tests unconditional, instead of conditional on
${do_build} || ${do_distribution} || ${do_release} || ${do_install}.
 1.259  15-Nov-2012  joerg Move the build_install logic from lib/Makefile into share/mk and re-use
it for tools. The existing logic broke for the LLVM build with the
recent .ORDER changes in make.
 1.258  31-Oct-2012  apb Replace getarch and validatearch with table-driven implementations.
 1.257  18-Oct-2012  apb Print the value of MAKECONF.
 1.256  29-Sep-2012  tsutsui Fix build.sh "modules" target build which has been broken since
do-sys-modules target was removed from src/Makefile in rev 1.299.
Fixes PR/46994.
Also remove a redundant bomb message which is already handled by
make_in_dir().
 1.255  05-Aug-2012  matt branches: 1.255.2;
Add support for MACHINE_ARCH matching earm or earmeb
Make evbearm-e[bl] a shortcut for evbarm and earmeb or earm.
Allow cats, iyonic, netwiner, shark, zaurus to specify earm though they
still default to arm.
 1.254  26-Feb-2012  tsutsui Add sanity checks for live-image and install-image targets
(which require mtree spec files built with MKUNPRIVED=yes)
to avoid unexpected makefs(8) error during image builds:
- if release op is specified with live-image or install-image
at the same time, make sure -U is also specified for the image builds
- before perform live-image and install-image ops check METALOG file
in DESTDIR to see if the build have been performed with MKUNPRIVED

XXX: Probably toolchain should create consistent spec files in
XXX: DESTDIR/etc/mtree dir regardless of MKUNPRIVED settings.
 1.253  22-Jan-2012  tsutsui branches: 1.253.2;
Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.
 1.252  05-Dec-2011  jym do_sys_sync() is part of vfs, hence rumpvfs. Used by pmf(9) during
device suspend, so explicitly link against rumpvfs to resolve that
symbol when linking rumpdev.

Unbreaks "rumptest" target.
 1.251  17-Oct-2011  mbalmer branches: 1.251.2;
wheher -> whether
 1.250  14-Sep-2011  apb When using random versions of make to try to find the TOOLDIR,
redirect 2>/dev/null. This should hide error messages like
"*** missing separator. Stop." when GNU make doesn't
understand ".include".
 1.249  09-Sep-2011  apb Add tests for the shell under which build.sh is run. If the
shell fails the tests, then build.sh tries to re-exec itself
under a more suitable shell.
 1.248  09-Sep-2011  apb Allow MAKEFLAGS to be set via build.sh -V. Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.
 1.247  30-Aug-2011  apb Escape '$' in double quotes.
 1.246  15-Aug-2011  wiz Add `-h' and `-y' to `Usage' (which were missing there);
synchronize the options list from `Usage' with its own summary,
and re-outline that list;
two corrections in the order of the options in (parseoptions) list;
a small punctuation change;
remove trailing whitespace in one line.

From Snader_LB.
 1.245  08-Aug-2011  jmcneill add an installmodules=<dir> command to build.sh
 1.244  26-Jan-2011  pooka Add support for the Extensible MIPS ("eMIPS") platform. The
NetBSD/emips port runs on Xilinx and Beecube FPGA systems and the
Giano system simulator.

eMIPS is a platform developed at Microsoft Research for researching
reconfigurable computing. eMIPS allows dynamic loading and scheduling
of application-specific circuits for the purpose of accelerating
computations based on the current workload.

NetBSD eMIPS support for NetBSD 4.x was written at Microsoft Research
by Alessandro Forin and Neil Pittman. Microsoft Corporation has
donated full copyright to The NetBSD Foundation.

Platform support for eMIPS is the first part of Microsoft's
contribution. The second part includes the hardware accelerator
framework and will be proposed on tech-kern soon.
 1.243  23-Jan-2011  matt Add arc64 alias
 1.242  06-Dec-2010  pooka branches: 1.242.2;
* test librumpdev_dm
* update rumpcrypto name
 1.241  23-Nov-2010  pooka ld wants to create a 0-byte file before it starts linking, with
the default being ./a.out. If we run build.sh rumptest from a r/o
fs, linking fails before it gets to the parts that interest us and
the whole test silently fails.

So:
1) use -o /tmp/rumptest.$$ (objdir might be better, but I couldn't
determine with a high confidence how to obtain the definite one
in build.sh)
2) catch "cannot open output file" error from ld
 1.240  24-Aug-2010  pgoyette Replace a couple uses of '$@' with '$*'
In statusmsg2() make the msg variable local.

More thanks to Robert Elz.
 1.239  24-Aug-2010  pgoyette Quote the $msg variable to ensure that leading/trailing spaces get counted.

Thanks to Robert Elz.
 1.238  24-Aug-2010  pgoyette Improve formatting of column-aligned output, as discussed on current-users.
 1.237  17-Jun-2010  pooka add tty to rumptest
 1.236  27-May-2010  pgoyette Minor grammar improvement in status message.
 1.235  11-May-2010  pooka Test for barebones rump network config (i.e. just rumpnet and kernel base).
 1.234  09-May-2010  morr Don't try to build xldscripts during build.sh modules
 1.233  30-Mar-2010  cegger move change from rev 1.232 to the initialization part.
This fixes the problem 'nbconfig: cannot create /GENERIC'
when KERNOBJDIR has a relative path and is defined as env variable.
Problem reported and fix proposed on tech-toolchain@.

'commit it then' christos@
 1.232  26-Mar-2010  christos make kernobjdir absolute.
 1.231  07-Mar-2010  hans Make build.sh work again with /usr/xpg4/bin/sh on Solaris. Ok by pooka.
 1.230  07-Mar-2010  pooka * detect missing libraries (such as -lrumpfs_msdosfs)
* fix spelling of -lrumpfs_msdos
* update linklists
 1.229  26-Feb-2010  pooka Don't need to set NORUMPUSER since rumpuser isn't built from sys
anymore.
 1.228  13-Jan-2010  pooka need object directory for etc/mtree to run distrib-dirs
 1.227  13-Jan-2010  pooka In rumptest, create obj dirs before distrib dirs. Fail if distrib dir
creation fails.

per clue-by-4 from mrg
 1.226  26-Dec-2009  mbalmer 'build.sh ... modules' only builds modules, but does not install them,
reflect that in the scripts output. While here, fix the past form of build.
 1.225  17-Dec-2009  matt Add cobalt64 alias and indicte cobalt can be mips64el too.
 1.224  14-Dec-2009  matt Merge from matt-nb5-mips64
 1.223  05-Dec-2009  pooka Remove support for NetBSD/playstation2.
 1.222  30-Nov-2009  uebayasi Support "extsrc", externally added programs and libraries. Users can write
their own reach-overs, cross-build, install, and get set files just like base
and X11 / X.org. (These sets are not included as TNF releases.)
 1.221  24-Nov-2009  pooka For rumptest, ignore unresolved symbols which are in the
toolchain namespace:
1) anything starting with __
2) MD quirks as defined by sys/rump/Makefile.rump
 1.220  23-Nov-2009  pooka Add more rumpdev configurations to rumptest.
 1.219  18-Nov-2009  pooka Add rumptest command for testing rump linkage.
 1.218  17-Nov-2009  apb Set LC_ALL=C before we try to parse the output from any command.
This will ensure that awk is not invoked in a way that tickles
the bug described in PR 42320.
 1.217  04-Nov-2009  apb If do_expertmode is false, then add DESTDIR and RELEASEDIR to makeenv.
This reinstates behaviour that was accidentally lost in revision 1.215.
 1.216  15-Oct-2009  enami There is no variable called __SRC_TOP_OBJ__. Use the correct one instead.
 1.215  14-Oct-2009  apb Bomb if TOOLDIR, DESTDIR, or RELEASEDIR changes after we have created the
top level object directory. This can happen if /etc/mk.conf overrides
values passed to build.sh in the environment or on the command line.
 1.214  03-Oct-2009  apb Add an additional check for whether to rebuild make. This fixes a problem
I saw where building first without and then with OBJMACHINE confused
build.sh into not building a new nbmake in the new TOOLDIR.
 1.213  27-Sep-2009  apb Replace try_set_TOOLDIR with a new function, print_tooldir_make,
which does much of the same work but prints a result instead of
setting a global variable. Adjust the rebuildmake function to suit.
Improve the comments describing how we try to figure out whether
the existing tooldir make needs to be rebuilt.
 1.212  27-Sep-2009  apb * Use a more robust method of creating the top level object directory.
Use getmakevar to expand MAKEOBJDIRPREFIX or MAKEOBJDIR, or (if
neither of those variables is set) use a non-recursive "make obj" in
the top level source directory.

* Do not let TOP_objdir default to ${TOP}. It's now set only by the
-M or -O command line options, or after using getmakevar to expand
MAKEOBJDIRPREFIX or MAKEOBJDIR.

* Make try_set_TOOLDIR handle MAKEOBJDIRPERFIX passed from the
environment. It runs too early to use getmakevar, so it will not work
if the value contains embedded '${...}' variable references.

* Use '$TOOLDIR' (with a literal '$') instead of 'nonexistent' in
a message when rebuilding make when TOOLDIR is not yet known.
 1.211  27-Sep-2009  apb Introduce a done_rebuildmake variable, instead of abusing do_rebuildmake
to mean both "must rebuild make" and "have already rebuilt make".
 1.210  27-Sep-2009  apb Rename raw_getmakevar to bomb_getmakevar. It wasn't "raw" at all; it
was (and is) a wrapper around nobomb_getmakevar.
 1.209  27-Sep-2009  apb Allow build.sh "-C cdextra" option to be specified multiple times.
 1.208  27-Sep-2009  apb Make resolvepath and resolvepaths slightly less magic. They now take
a variable name as an arg unstead of always working on $OPTARG,
and resolveepaths is now a wrapper around resolvepath instead of
duplicating code.
 1.207  07-Sep-2009  jnemeth Add a modules operation to build.sh, which builds and installs kernel modules
into DESTDIR.

This is based on the patch provided by tsutsui@ on tech-toolchain@.
 1.206  13-Mar-2009  perry Add a MKARZERO flag, which invokes ar(1) with the new D flag when it
is set to "yes" -- defaults to "no" except for build.sh builds. This
results in a deterministic .a file rather than one that reflects
timestamps and permissions on the source files.

Also, clean up the ar flags we're using, and remove a redundant use of
ranlib that on a modern POSIX ar can be done with the "s" flag.

Discussed on tech-toolchain
 1.205  09-Mar-2009  apb Add "-", "_", and "A-Z" to the set of allowed characters in the
result from `uname -p`. We already have a platform with an underline
("x86_64"), and the other chars seem harmless.
 1.204  06-Mar-2009  apb In build.sh and bsd.own.mk, if uname -p fails, or prints "unknown", or
prints something that does not look like an identifier, then use uname
-m instead. (Cygwin prints "unknown", and OpenBSD prints a long string
containing several spaces; this code should handle both.)
 1.203  25-Feb-2009  lukem Implement make_in_dir <dir> <op> to simplify various operations
 1.202  24-Feb-2009  sketch Make 'build.sh tools' work with the Sun Studio compiler, although bugs in
some of the generated tools still prevent building a full release using them.
 1.201  21-Feb-2009  plunky update usage message for -x to "build X11" rather than "build X11R6"
 1.200  03-Jan-2009  apb branches: 1.200.2;
"\t" does not represent a tab in sed regular expressions,
so use a ${tab} variable instead. This bug was found by
Jeremy C. Reed.
 1.199  13-Nov-2008  apb Add support for new MAKEVERBOSE levels 3 and 4. The complete list is now:

0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
3 Ignore the effect of the "@" prefix in make commands
4 Trace shell commands using the shell's -x flag

The default remains MAKEVERBOSE=2.
 1.198  26-Oct-2008  apb branches: 1.198.2;
Try harder to guess the correct TOOLDIR.
Adapted from a proposal by Izumi Tsutsui in tech-toolchain.
 1.197  22-Aug-2008  lukem Remove support for printing "'-x' has been replaced by 'xxxxx'".
The old option hasn't worked since 2003/01/23 (before NetBSD 2.0.)
 1.196  18-Aug-2008  lukem Fix "-n releasekernel=..."
Patch from Jukka Salmi in PR 33096.
 1.195  18-Aug-2008  lukem Implement "cleandir". Inspired by PR 39362.
Consistently expand tabs in the usage.
 1.194  16-Aug-2008  lukem Determine top-level objdir from the environment $MAKEOBJDIRPREFIX early on,
and store in the (non-exported) $TOP_objdir.
(We can't do the same for the environment $MAKEOBJDIR since it may contain
make(1) expressions that aren't easily parseable by sh(1))
Remember appropriate variations of '-M modp' and '-O mod' in $TOP_objdir
(replacing $makeobjdir misuse).
Use $TOP_objdir when trying to guess the TOOLDIR,
and when detecting if the top-level objdir needs to be created.
Fixes problems observed when testing fixes for PR 39360 and 39361.

Fix the TOOLDIR path used when guessing the TOOLDIR.
PR 39360 from Andrew Cagney <cagney@gnu.org>

Use stricter result checking from make(1) when guessing the TOOLDIR.
PR 39361 from Andrew Cagney <cagney@gnu.org>
 1.193  15-Aug-2008  lukem crank copyright
 1.192  08-Aug-2008  apb Don't bomb if we can't detect the top level obj directory name.
Apparently there are things you can do in the environment or mk.conf
to set your object directory in a way that the previous code couldn't
detect. (This is an interim measure until we can properly detect and
create the top level object directory in all cases.)
 1.191  05-Aug-2008  apb If neither -M nor -O was specified, but the source directory is
/usr/src, then try to figure out what object directory would be chosen
by bsd.obj.mk, and pre-create it.
 1.190  05-Aug-2008  perry Builds now use "BUILDSEED" so that c++ binaries are reproduceable.
By default BUILDSEED is set to NetBSD-{majorversion} -- a -S flag may
be used to change it.

Discussed on tech-toolchain.
 1.189  27-Jun-2008  dyoung Make build.sh -C work as advertised.
 1.188  30-Apr-2008  martin branches: 1.188.2;
Convert TNF licenses to new 2 clause variant
 1.187  28-Mar-2008  dholland branches: 1.187.2;
The phase of the build that -u prevents is "make cleandir", not merely
"make clean"; adjust build.sh's usage message to reflect this.
 1.186  16-Mar-2008  lukem Obtain RELEASEMACHINEDIR from the make environment.
Display the path to the binary set dir upon completion of "sets".
 1.185  25-Feb-2008  apb * Installing as non-root is a bad idea. Print a warning in expert mode,
or bomb in non-expert mode.
* If a previous build.sh run with the -U (unprivileged) flag created a
METALOG, then subsequent build.sh runs must also specify the -U flag.
In expert mode, this is just a warning.
* While I was here, changed spaces to tabs in one existing line.
 1.184  03-Feb-2008  matt branches: 1.184.2;
sh5 is dead. sh[35]e[bl] -> sh3e[bl]
 1.183  18-Jan-2008  jmmv Add ofppc64 as a machine target for the tools alongside evbppc64 and macppc64
that are already there (even if not useful for anything else, AFAIK).
 1.182  09-Jan-2008  simonb Remove support for NetBSD/pc532.
 1.181  17-Dec-2007  garbled Add rs6000 to this file so it can be easily cross-built.
 1.180  23-Nov-2007  jnemeth Delete mention of 'iso-dir=cdextras'. This was a leftover from
the original implementation of cdextra as an operation instead of
a being paramater.
 1.179  23-Nov-2007  sborrill Add support for CDBUILDEXTRA which acts like CDEXTRA to add extra items
to the CD-ROM image.
Make CDEXTRA and CDBUILDEXTRA be able to contain lists of files and directories
which are added in turn.
Add support for CDEXTRA_SKIP which contains a list of fnmatch(3) items to
skip during the copy. This is _very_ useful for skipping CVS dirs for example.
CDBUILDEXTRA and CDEXTRA_SKIP are to be used in Makefiles creating the images,
CDEXTRA remains to be used from build.sh.
Update documentation and build.sh help text to show that -C can be used to
specify a list of files and directories rather than just a single dir.
 1.178  20-Nov-2007  uebayasi Indent.
 1.177  20-Nov-2007  uebayasi Sort variable definitions. No functional change expected.
 1.176  17-Oct-2007  garbled remove pmppc as a target
 1.175  18-Sep-2007  agc Fix a tyop and align properly
 1.174  01-Sep-2007  jnemeth Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.
 1.173  01-Sep-2007  jnemeth Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.
 1.172  30-Aug-2007  jnemeth Add an iso-image-source option which does the same thing as iso-image but
includes source sets as well. The infrastructure for this was already
there, although it needed a bug fix. Will look at adding arbitrary
directories next.
 1.171  26-Jun-2007  apb branches: 1.171.4;
Move several variable initialisations to the beginning of
initdefaults(). This should fix a bug reported by Valeriy E. Ushakov
in which we called setmakevar() before instead of after
initialising makeenv.
 1.170  14-Apr-2007  apb Fix some problems with the change from revision 1.167:
* Allow "" or "." as the last component of PATH, but do not
allow arbitrary single-character components.
* Make a comment match the code.
 1.169  08-Apr-2007  scw Remove support for NetBSD/{,evb}sh5.
 1.168  07-Apr-2007  apb Try not to rebuild nbmake so often:

* Add a try_set_TOOLDIR function which tries to be clever about setting
TOOLDIR if possible;
* Call try_set_TOOLDIR from rebuildmake;
* Add nobomb_getmakevar, which works like raw_getmakevar except
never bombs;
* Reimplement raw_getmakevar in terms of nobomb_getmakevar;
* Add a second arg to find_in_PATH to control the result when the
program cannot be found.
 1.167  05-Apr-2007  dsl Don't abort the build if teh last component of $PATH is .
 1.166  02-Apr-2007  apb The "${progname} started: ${build_start}" message will appear in the
"Summary of results", so don't print it again just before that.
 1.165  02-Apr-2007  apb * Report the NetBSD version being built.
* Report the host platform.
* Print more of the initial messages in the same part of the code.
 1.164  25-Mar-2007  apb s/PATH/PATH environment variable" in an error message.
 1.163  25-Mar-2007  apb If the PATH contains any components that are not absolute
directory names, print a message and abort. In expert mode,
downgrade this error to a warning.

Fixes PR 36048
 1.162  19-Feb-2007  briggs Don't treat -m evbarm like the other arm-based platforms. Set
MACHINE_ARCH only if it's not already set. This prevents
build.sh -m evbarm-eb
from ending up with MACHINE_ARCH=arm instead of =armeb (since MACHINE is
stripped of the -eb suffix just above).
 1.161  05-Feb-2007  apb Whenever we try to parse the output from make, run make with the -B
flag. This ensures that -j<N> isn't accidentally inherited from the
environment, because the "--- foo ---" headers printed with -j<N> would
interfere with parsing the output.
 1.160  29-Jan-2007  matt Remove duplicate evbarm-e[bl] cases. Add evbppc64 and macppc64.
 1.159  28-Jan-2007  matt Add evbarm-e[bl] machine aliases for evbarm/armeb and evbarm/arm,
respectively.
 1.158  27-Jan-2007  apb Add aliases evbarm-eb and evbarm-el, for consistency with several
existing *-e[bl] aliases. build.sh -m MACHINE_ALIAS is (almost)
equivalent to build.sh -m MACHINE -a MACHINE_ARCH.
 1.157  17-Jan-2007  rillig Added a friendly error message in case the user forgot to "build.sh tools".
 1.156  14-Jan-2007  dsl Only cd "$(dirname $0)" when usr.bin/make doesn't exist. This caused grief
when I make my wrapper script source build.sh. I can also think of other
times when it would be a PITA.
Abort the build if make fails in raw_getmakevar() - as tends to happen when
make itself is badly broken.
 1.155  16-Dec-2006  ober Updated to include the new Zaurus port for ARM.
OK'd by gimpy
 1.154  09-Dec-2006  dyoung Change the name of the host disklabel to nbdisklabel-${MAKEWRAPPERMACHINE},
where ${MAKEWRAPPERMACHINE} is the suffix XXX on the target's make
wrapper, nbmake-XXX.

Fixes toolchain/30673, "single arch host disklabel isn't enough".
 1.153  29-Sep-2006  apb branches: 1.153.2;
Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* Try to guess a suitable value for HOST_SH, if it was not set in
the environment. First try host-specific heuristics (Solaris has
/usr/xpg4/bin/sh); then try to find the name of the shell that was used
to run build.sh itself (by parsing the output from ps -p $$ -o comm);
then fall back to "sh".

* Having found a value for HOST_SH, copy it to BSHELL and CONFIG_SHELL.

* Use ${HOST_SH} instead of /bin/sh when creating the make wrapper.

* Use ${HOST_SH} instead of unqualified sh when running shell scripts.
 1.152  01-Sep-2006  uwe Recognize MACHINE=landisk (sh3el).
 1.151  27-Aug-2006  matt When going from -m {evb,sb}mips64-e[bl] to MACHINE,
make sure to remove 64-e[bl] so we wind up with just evbmips or sbmips.
 1.150  25-Aug-2006  matt Add enough configury glue so that src/tools can build a N64 mips toolchain.
 1.149  09-Aug-2006  jnemeth PR/30842 -- compatibility issue with mksh from Thorsten Glaser
 1.148  22-Jun-2006  mrg preliminary support for powerpc64 toolchain:
- allow "-m macppc/evbppc" to also take "-a powerpc64" to build a
powerpc64 toolchain.

XXX this may change, as an evbppc64 port may be required.
XXX deal with that when we have some code...
 1.147  19-Jun-2006  dogcow Huzzah. /bin/pwd -P, instead of silently failing, now returns an error code
on many linuces I've tried. If so, bail and invoke /bin/pwd sans argument.
 1.146  03-Feb-2006  apb Fix the iso-image action. These changes were accidentally omitted
from the previous commit.
 1.145  28-Jan-2006  apb * Add an "iso-image" target in the top level Makefile,
which invokes make iso-image in the etc directory.
* Add an "iso-image" action in build.sh, which
invokes make iso-image.
* Document the above in doc/BUILDING.mdoc.
* Re-generate BUILDING.

Approved by christos
 1.144  08-Jan-2006  dsl Use separate invocations of make for cleandir dependall and install of
tools so that a parallel make doesn't start running dependall before
cleandir has finished.
Unfortunately make doesn't support .WAIT on the command line :-(
 1.143  07-Jan-2006  dsl Use parallel makes more often.
 1.142  04-Jan-2006  apb Add a new "syspkgs" target, which simply chains to the "syspkgs" target
in the top level Makefile.

Reviewed by agc
 1.141  29-Dec-2005  tsutsui Add ews4800mips to mipseb ports.

Build for ews4800mips might fail (yet),
but please don't complain for now.
 1.140  12-Dec-2005  jmc Nuke LESSCHARSET as well since it affects the output character set of groff
 1.139  25-Sep-2005  isaki It needs the braceexpand option for PD KSH, regardless of
whether the host system is OpenBSD.
from Wim Lewis. reviewed by sjg@.
 1.138  17-Aug-2005  skrll Initial pass at an in-tree ia64 toolchain. From PR 29141 with some fixes
from me.
 1.137  29-May-2005  bouyer Remove support for build.sh -m xen, this has been merged in the i386
build. Pointed out by Chuck Silvers.
 1.136  19-May-2005  lukem Unset INFODIR in the makewrapper.
Should fix a build problem observed when installing .info files
when the build user's environment has INFODIR set.
 1.135  26-Mar-2005  isaki Avoid the brace expansion on OpenBSD.
approved by sjg@.
 1.134  13-Oct-2004  gavan branches: 1.134.2;
Initial import of iyonix port.

The Iyonix is a desktop machine from Castle Technology, based on a 600MHz
XScale[tm] 80321 processor.

* Uses the bootloader from NetBSD/acorn32, which is now 32-bit compatible.
* Currently boots multiuser with a serial console.
* Device support is not yet complete.

With help from abs.
 1.133  11-Oct-2004  martin Backout previous on request from mrg - it breaks cross compilation for
sparc64. Matt will recommit a fixed version later.
 1.132  09-Oct-2004  mrg add new ${uname_p} (as `uname -p`).
set ${arches} to "sparc64 sparc" for MACHINE=sparc64.
for 32 bit sparc64 host, default to building 32 bit world (same as native).
 1.131  17-Aug-2004  junyoung Remove trailing / in pathname.

From Alan Barrett. See tech-toolchain@ for related discussion.
 1.130  02-Jul-2004  jmc Add a change requested in PR#15548 and append the args passed to build.sh
into the comments in the make wrapper.
 1.129  25-Jun-2004  wiz Document -h. From Karsten Kruse in PR 25974.
 1.128  12-May-2004  cl ``build.sh -m xen-i386 release'' now builds a release for NetBSD/xen
for i386. The resulting release consists of:
- NetBSD/xen for i386 kernel, loader and docuemntation
- NetBSD/i386 userland sets
 1.127  06-Feb-2004  lukem branches: 1.127.2;
Add
-x set MKX11=yes
-X x11src set X11SRCDIR to x11src
 1.126  04-Feb-2004  lukem highlight that the noisyless level is the MAKEVERBOSE level
 1.125  14-Nov-2003  lukem tweak usage message.
when performing "sets", highlight that DESTDIR should be
pre-populated. suggested by glen mccready.
 1.124  12-Nov-2003  lukem Now that MKUPDATE and MKUNPRIVED are "normalized" with getmakevar(),
test with "${MKxxx}" = "no" instead of -z "${MKxxx}"

Ignore errors when running pwd -P. (GNU coreutils incorrectly complains)


Both problems pointed out in private email from Christian Limpach.
 1.123  31-Oct-2003  lukem Always use `/bin/pwd -P` to get the "TOP" of the source tree, so that
MAKEOBJDIR (and other parameters) work correctly with symlinks, amd(8), etc.
Should fix PR [bin/23313], and possibly others.
 1.122  26-Oct-2003  lukem Explain why make is being rebuilt.
Patch from Hubert Feyrer in [toolchain/23156].
 1.121  26-Oct-2003  lukem Improve how build.sh -N and MAKEVERBOSE interoperate;
rather than adding '-s' to make's command line in the makewrapper,
use the .SILENT target based on MAKEVERBOSE's value.

This means that you can do:
./build.sh -N 1 makewrapper

$TOOLDIR/bin/nbmake-$MACHINE
# runs at MAKEVERBOSE==1, with command lines suppressed

$TOOLDIR/bin/nbmake-$MACHINE MAKEVERBOSE=2
# runs at MAKEVERBOSE==2 for this invocation, with command lines shown
 1.120  26-Oct-2003  lukem "Normalise" MKOBJDIRS MKUPDATE MKUNPRIVED with getmakevar() before
trying to use them internally to build.sh.
Fixes issue where build.sh would run "make cleandir" if MKUPDATE=yes was
set in mk.conf and -u wasn't given to build.sh.
 1.119  25-Oct-2003  lukem Implement build -N noisy, which sets MAKEVERBOSE to noisy and adds
`-s' to MAKEFLAGS for noisy < 2.
 1.118  19-Oct-2003  matt Teach build.sh about the ibmnws port.
 1.117  24-Sep-2003  lukem Revert part of previous commit and do NOT explicitly set BSDSRCDIR in the
makewrapper, as doing so can break various builds.

(Setting NETBSDSRCDIR isn't strictly necessary either, but AFAICT, it
shouldn't hurt)
 1.116  20-Sep-2003  jmmv Set BSDSRCDIR and NETBSDSRCDIR in the make wrapper, so we always get the
right source directories (in case they are defined in mk.conf using '?=').
 1.115  10-Sep-2003  jmmv Pass '-de' to make(1) to get the expected behavior ("failed target" and
"failed command" messages).
 1.114  16-Aug-2003  lukem in getkernelconf(), remove check for non-empty $makeobjdir, as it's not
performed elsewhere in similar code, and causes problems if you run "kernel="
without an operation that performs "make obj" in sys/ beforehand.
 1.113  11-Aug-2003  jmc Fix 2 remaining places items are depending on execute permissions coming out
from a cvs checkout on scripts.
 1.112  10-Aug-2003  sommerfeld Improve usage for -U so others won't make the mistake I just made.
 1.111  29-Jul-2003  lukem Add build.sh -Z var, to unset a variable and ensure it's unset in makewrapper.
For -M MAKEOBJDIRPREFIX, unset MAKEOBJDIR.
For -O MAKEOBJDIR, unset MAKEOBJDIRPREFIX.
 1.110  28-Jul-2003  lukem Add missing "cd ${TOP}" to buildtools(). Problem identified by John Nemeth
in private mail.

Remove some debugging messages that crept in a little while ago.
 1.109  20-Jul-2003  lukem * set & export LC_ALL=C, so that end-user use of non `C' LC_COLLATE locales
won't cause expressions such as `echo [0-9a-z]*` to match "CVS"
* add getmakeenv(var, value), and use appropriatly.
 1.108  18-Jul-2003  lukem Replace UNPRIVED=yes with MKUNPRIVED=yes.
Replace UPDATE=yes with MKUPDATE=yes.
 1.107  16-Jul-2003  lukem add "params" operation
 1.106  26-May-2003  lukem Broaden the scope of when "make obj NOSUBDIR=" will be run in tools/
to be at any time that build.sh is run without -o, because we need
the objdir of the top-level to exist if build.sh is going to provide
a default DESTDIR/RELEASEDIR, and with the previous code, if
MAKEOBJDIRPREFIX was used and the objdir of the source tree didn't
exist, build.sh would incorrectly determine the DESTDIR.
(mmm, obscure bugs).
 1.105  25-May-2003  lukem all:
* add "releasekernel=conf", to install a gzipped copy of the kernels
built by "kernel=conf" to RELEASEDIR/MACHINE/binary/kernel

build.sh:
* be more consistent in various status messages
* move the {release,}kernel=conf conf parsing code into getkernelconf()
and use in both buildkernel() and releasekernel()
* only warn once when building multiple kernels without updating the tools
 1.104  18-May-2003  lukem * Display the start time again just before the end time, to make it
easier to work out how long things took. Suggested by Alistair Crooks.
* Explicitly display the makewrapper path
 1.103  17-May-2003  lukem Change evbsh3 to be like evbmips, in that a default MACHINE_ARCH
won't be provided for a MACHINE of "evbsh3"; the user has to explicitly
use "evbsh3-eb" or "evbsh3-el"
 1.102  12-May-2003  lukem * Display default DESTDIR & RELEASEDIR. (Well, they're actually in
the .OBJDIR of the top of the source tree, but expressing that in 1
line or less starts to get complicated). Requested by Hubert.
* When using a -el or -eb MACHINE "shortcut", use that original value
as the MACHINE for the default makewrapper filename. Requested by Simon.
 1.101  12-May-2003  lukem * Add support for MACHINEs: evbmips-eb evbmips-el sbmips-eb sbmips-el
which sets the appropriate MACHINE_ARCH and rewrites MACHINE to lose
the -e[bl] suffix.
* Don't default to a MACHINE_ARCH for evbmips or sbmips.

Per discussion wth Simon Burge.
 1.100  10-May-2003  lukem Add "sourcesets" argument/target, which builds source sets into
RELEASEDIR/source/sets
 1.99  09-May-2003  lukem When providing a default DESTDIR & RELEASEDIR in non-expert mode, add
these to makeenv so that the generated makewrapper contains these settings...
 1.98  08-May-2003  lukem New features:
* If not expert mode, provide defaults for:
DESTDIR /top/of/obj/destdir.${MACHINE}
RELEASEDIR /top/of/obj/releasedir
* Collate the various status messages output during the run
and display them at the end in a "summary report".
* Cross-check the validity of MACHINE against MACHINE_ARCH.
Fixes PR [toolchain/20193] from David Maxwell.
* Highlight that the tools will be rebuilt if UPDATE isn't set.
* Add stronger language recommending against -E unless you
* Improve whitespace use in usage()

Code stuff:
* Be consistent about using "${var}"
* Be more consistent how [ tests ] are run
* Improve some comments
* Rename getmakevar() to raw_getmakevar()
* Rename safe_getmakevar() to getmakevar()
* cd back to ${TOP} after a kernel build.
* Always keep the tmpdir around for the build (it's where the
status messages are collated, for one).
 1.97  08-May-2003  christos CYGWIN needs -X too (John Gordon)
 1.96  26-Apr-2003  fvdl Adapt for x86_64 -> amd64 rename.
 1.95  14-Mar-2003  thorpej Put -X into MAKEFLAGS on FreeBSD and Mac OS X; they have a small ARG_MAX.
 1.94  07-Mar-2003  lukem remove unnecessary message
 1.93  04-Mar-2003  lukem don't print the command & start time until after the options are parsed...
 1.92  18-Feb-2003  lukem Display the build.sh command line and the start & end times.
Based on suggestion from Andrew Brown <atatat@netbsd.org>.
 1.91  16-Feb-2003  lukem Enhance "kernel=" to print pathnames of newly built kernels for cut & paste.
(Previously we just printed the build directory.)
 1.90  06-Feb-2003  enami Consistently, don't expand ${MACHINE} in help message.
 1.89  31-Jan-2003  lukem another DESTDIR clarification
 1.88  26-Jan-2003  lukem add missing usage for "sets"
 1.87  26-Jan-2003  lukem - Add "sets" top-level Makefile target and build.sh operation.
[Latter suggested by Julio Merino in private email]
- Add "help" build.sh operation.
 1.86  26-Jan-2003  lukem Change build.sh so that at least one operation is required.
Add "makewrapper" operation to build.sh.
[The above changes were suggested by Alan Barrett on current-users@]

Fail if building as non-root unless: UNPRIVED is set, -U is given, or -E
(expert mode) is given.
[Suggested by James Wetterau in private email]

Improve the examples in BUILDING.
 1.85  24-Jan-2003  lukem Can't check if cross building with "install=" until after $MACHINE has
been validated. Noted by Anthony Mallet on current-users@
 1.84  23-Jan-2003  lukem Rework how build.sh functions, so that command line options set various
parameters, and a list of "operations" defines what to do.
The full usage is show below. Notes:
`-b' has been deprecated (it always occurs now)
`-d' is replaced by "distribution"
`-R rel' onlys sets RELEASEDIR; use "release" to build a release
`-k kern' has been replaced by "kernel=kern"
`-i idir' has been replaced by "install=idir"
-r now occurs before nbmake is rebuilt

Add a copyright (long due!). Rework the code to (a KNF inspired) ShellNF.
Use functions appropriately. Allow `nb' prefix to be easily changed to
something else. Solve world peace (just kidding)

This is part of the (never achievable) goal of attempting to make
NetBSD easier to build...


--8<-- new usage follows --8<--

Usage: build.sh [-EnorUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-M obj]
[-m mach] [-O obj] [-R release] [-T tools] [-V var=[value]]
[-w wrapper] [operation [...] ]

System build operations (all imply "obj" and "tools"):
build Run "make build"
distribution Run "make distribution" (includes etc/ files)
release Run "make release" (includes kernels & distrib media)

Other operations:
obj Run "make obj" (default unless -o)
tools Build and install tools
kernel=conf Build kernel with config file `conf'
install=idir Run "make installworld" to `idir'
(useful after 'distribution' or 'release')

Options:
-a arch Set MACHINE_ARCH to arch (otherwise deduced from MACHINE)
-B buildId Set BUILDID to buildId
-D dest Set DESTDIR to dest
-E Set "expert" mode; disables some DESTDIR checks
-j njob Run up to njob jobs in parallel; see make(1)
-M obj Set obj root directory to obj (sets MAKEOBJDIRPREFIX)
-m mach Set MACHINE to mach (not required if NetBSD native)
-n Show commands that would be executed, but do not execute them
-O obj Set obj root directory to obj (sets a MAKEOBJDIR pattern)
-o Set MKOBJDIRS=no (do not create objdirs at start of build)
-R release Set RELEASEDIR to release
-r Remove contents of TOOLDIR and DESTDIR before building
-T tools Set TOOLDIR to tools. If unset, and TOOLDIR is not set in
the environment, nbmake will be (re)built unconditionally.
-U Set UNPRIVED
-u Set UPDATE
-V v=[val] Set variable `v' to `val'
-w wrapper Create nbmake script as wrapper
(default: ${TOOLDIR}/bin/nbmake-${MACHINE})
 1.83  22-Jan-2003  lukem reorder usage so that "mutually exclusive build" operations are listed
separately from "set variable" operations, in an attempt to make
build.sh easier to use
 1.82  15-Jan-2003  lukem Improvements from Alan Barrett (in private email), with minor tweaking:
(Thanks Alan!)

* Before attempting to use KERNOBJDIR, we now need to "make obj" in
${KERNSRCDIR}/${KERNARCHDIR}/compile, not in ${TOP}/etc as used to be
the case.

* Fix one place where getmakevar was invoked unconditionally. It needs
to be conditional on $runcmd != "echo", so that we can rely on the
existence of the new $make executable.

* Add a sanity check to getmakevar, to bomb if a similar error is
introduced in the future.

* Changed the bomb function to print to stderr instead of to stdout, and
to kill the top level shell process. Without this, an attempted bomb
from inside getmakevar did not work properly.

* Moved some duplicated code into a new safe_getmakevar function, which
calls getmakevar if that is safe, or else emits a literal '$' followed
by the variable name.


Improvements from me:

* Always 'trap "exit 1" 1 2 3 15', so the kill in bomb() doesn't cause ugly
output.
 1.81  04-Jan-2003  lukem improve usage
 1.80  04-Jan-2003  lukem Add "-V var=[value]", for setting arbitrary variables which will also
be added to the nbmake-${MACHINE} wrapper.
Useful for setting RELEASEDIR, without -R's habit of building a release.
 1.79  02-Jan-2003  lukem some cleanups and tweaks to my preferred "sh KNF" (SNF ? :)
 1.78  02-Jan-2003  lukem cd `dirname $0` so that this runs from the directory that build.sh is in.
Per discussion with Andrew Brown.
 1.77  25-Dec-2002  lukem - Implement "-i installworlddir", which runs
make INSTALLWORLDDIR=installworlddir installworld
after every other operation has completed.
If you want to run this target without rebuilding, use -b as well...
- Cache the output of `uname -s` and `uname -m` for future use.
 1.76  09-Dec-2002  scw The walnut port has been subsumed by evbppc.
 1.75  09-Dec-2002  lukem improve message. suggestion from Scott Reynolds
 1.74  08-Dec-2002  lukem Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are
not permitted.
By using this flag, you are taking responsibility for any issues that
may occur because of this...
 1.73  08-Dec-2002  lukem - be consistent about option ordering in build.sh usage display
- use Fl and Ar instead of Sy and Em to format options
 1.72  17-Nov-2002  lukem Apply fixes & enhancements from Alan Barrett. (Thanks Alan!)

* When building a kernel with the -k option, make obj in $TOP/etc to
ensure that the correct KERNOBJDIR is created and used. Previously,
KERNOBJDIR could sometimes be an objdir outside the source tree
and sometimes $TOP/sys/arch/$ARCH/compile inside the source tree,
depending on whether or not a complete build had beed done before
the kernel build.

* Renamed KERNCONFNAME to kernconfname, for consistency with what
seems to be a convention that variables local to build.sh (as
opposed to make or environment variables) have lowercase names.

* Renamed the do_buildonlytools and do_buildonlykernel variables to
do_buildtools and do_buildkernel, because the word "only" is no
longer appropriate now that more than one of them can be active
simultaneously.

* Changed a few '|| exit 1' tests to '|| bomb "message"', and added a
few more similar tests.

* Changed all 'echo "===> ..."' to use $runcmd, and added a few more
similar echos. Previously, some used $runcmd and some did not.
 1.71  05-Nov-2002  enami In the function usage(),
- The -n and -t option was missing in sample command line.
- Indent the description of -r option correctly.
- Use `basename $0` instead of $0.
 1.70  20-Oct-2002  lukem - Add support for ./build.sh -k kern, which configures and builds the named
kernel using the $TOOLDIR toolchain. If kern doesn't contain `/', it will
be searched for in ${KERNCONFDIR} (typically, sys/arch/${MACHINE}/conf).
- Improve ./build.sh usage.
- Add some examples to the documentation.

This is heavily based on [toolchain/18739] from Alan Barrett <apb@cequrux.com>,
with improvements by me.
 1.69  02-Oct-2002  thorpej Add sh5 cases.
 1.68  18-Sep-2002  thorpej Remove USE_NEW_TOOLCHAIN, replacing it with similar logic using
TOOLCHAIN_MISSING and EXTERNAL_TOOLCHAIN.
 1.67  13-Sep-2002  thorpej * Use /usr/bin/env to invoke the real interpreter. This allows us to
get the POSIX shell on more systems.
* Deal with a broken "pwd" on Solaris (suggested by Christos).
 1.66  13-Sep-2002  thorpej Back out previous; I'll figure out another way.
 1.65  13-Sep-2002  thorpej Use /bin/test explicitly in one place, rather than [ or test (which
might be a shell built-in). This allows this script to work otherwise
unchanged with Solaris 8's /bin/sh.
 1.64  03-Sep-2002  bjh21 Unset PWD so that pwd is guaranteed to return a physical path.
This fixes PR 17313. Thanks to Ian Dall for providing the fix.
 1.63  09-Jul-2002  pooka fix pasto in error message

reported by Andrew Freedman in toolchain/17530
 1.62  10-Jun-2002  fredette Add hppa as a supported MACHINE_ARCH.
 1.61  05-Jun-2002  augustss Remove redundant pattern in case.
 1.60  05-Jun-2002  thorpej Allow ns32k.
 1.59  24-May-2002  msaitoh add armeb as valid MACHINE_ARCH
 1.58  13-May-2002  lukem branches: 1.58.2;
add "-M makeobjdirprefix" to build.sh
 1.57  02-May-2002  sommerfeld Correct BUGS in BUILDING.mdoc now that most ports are USE_NEW_TOOLCHAIN

Obsolete NBUILDJOBS; build.sh just passes -jN through to make(1),
which inherits it cooperatively through the build tree. Fix
documentation so that it's shown to be deprecated.

If you use build -jN, please save full build logs so that errors due
to missing dependancies can be analyzed and corrected.
 1.56  18-Apr-2002  tv Bomb if share/mk/bsd.own.mk is missing.
 1.55  02-Apr-2002  thorpej Switch remaining ARM ports (acorn32, cats, shark) to ELF.
 1.54  24-Mar-2002  bjh21 Rename arm26 -> acorn26.
 1.53  21-Mar-2002  pk Crank up robustness.
 1.52  14-Mar-2002  thorpej Add a -B option to set the BUILDID for the build. This also causes
the make(1) wrapper script to be named "nbmake-MACHINE-BUILDID".
 1.51  07-Mar-2002  simonb Add evbmips.
XXX: This is hard-coded to little-endian here, but there's not reason for
some this. The MALTA can be used with either-endianness.
 1.50  06-Mar-2002  simonb Add sbmips.
 1.49  02-Mar-2002  tv Nuke my "mkdirp" hack. "mkdir -p" is used so liberally throughout the
tree that the hack is just a maintenance annoyance here.
 1.48  02-Mar-2002  mjl powerpc is a valid MACHINE_ARCH too.
 1.47  01-Mar-2002  tv Related to PR toolchain/15780, sanity check MACHINE_ARCH.
 1.46  01-Mar-2002  tv Related to PR 15781, explain better in a comment why it is not possible
to grovel mk.conf using sed/awk/etc. before nbmake is available.
 1.45  27-Feb-2002  scw Add mvmeppc to powerpc case.
 1.44  27-Feb-2002  lukem add -U; set UNPRIVED=
 1.43  10-Feb-2002  thorpej Shark is not yet MACHINE_ARCH=arm.
 1.42  10-Feb-2002  wiz s/dnard/shark/
 1.41  29-Jan-2002  tv chdir out of $tmpdir before removing it; some vendors' rm(1) programs will
not remove cwd....
 1.40  19-Jan-2002  tv Honor HOST_{CC,CFLAGS,CPPFLAGS,LDFLAGS} passed in from the environment
when building nbmake. Use the correct defaults if not set (HOST_CC=cc,
HOST_CFLAGS=-O).
 1.39  15-Jan-2002  tv Make sure buildmake.sh is run with "sh", rather than depending on executable
status. (XXX we should probably come up with a HOST_SH variable for these
instances....)
 1.38  15-Jan-2002  tv Make use of new make(1) bootstrap in src/tools/make.
 1.37  19-Dec-2001  tv Apply workaround for some Bourne shells not handling IFS in the POSIX way.
Based on the change suggested by <david@l8s.co.uk> on current-users.
 1.36  17-Dec-2001  wiz Sort options in usage in default order (AaBb...).
 1.35  12-Dec-2001  jmc Change check for USE_NEW_TOOLCHAIN to just looking for it being defined.
 1.34  11-Dec-2001  lukem as -m mach is optional, indicate this in the usage
 1.33  11-Dec-2001  tv Honor HOST_LDFLAGS in environment.
Add bash to the suggestions of alternative shells if /bin/sh isn't enough.
 1.32  11-Dec-2001  tv Revert part of rev. 1.28. DO NOT set MAKE_MACHINE, since "nbmake" is a
platform-independent binary. It should have no default. Setting MACHINE
is the purpose of the wrapper script.
 1.31  09-Dec-2001  jmc Make -t and -u behave together so a -t doesn't always force a cleandir in the
tools directory.
 1.30  04-Dec-2001  jmc Check if this platform is supported for USE_NEW_TOOLCHAIN and exit with a
complaint if it's not. Point out to run a traditional make and also how to
force a new toolchain build if one wants to test
 1.29  03-Dec-2001  jmc Make sure the makes running before the make build rule include
-m <top dir>/share/mk
 1.28  30-Nov-2001  thorpej - Define MAKE_MACHINE reasonably for the bootstrap make.
- Don't unset IFS; some shells don't like that. Instead save, and
restore IFS.
 1.27  26-Nov-2001  jmc If using objdirs make sure the objdir root is made before starting the build.
Otherwise problems with bsd.own.mk and _SRC_TOP_OBJ can result.
 1.26  25-Nov-2001  thorpej Add a "-d" option that uses the "distribution" target, rather than
the "build" target.
 1.25  15-Nov-2001  thorpej If using -t, do a "cleandir" before building/installing the
tools. This is something the old "build" hack used to do.
 1.24  13-Nov-2001  tv Revert part of rev. 1.20 -- $DESTDIR and $TOOLDIR are deliberately shown
symbolically with "-n", as these may come from mk.conf after building the
bootstrap make. Add a comment to that effect.
 1.23  12-Nov-2001  tv Major overhaul of src/tools and host toolchain. Summary of changes:

* Rewrite src/tools Make logic to work like the rest of the tree wrt
"dependall" and "install". The old "make build" hack is gone.

* Remove the MKTOOLS logic. This was linked to the "make build" hack,
and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
BSD make wrapper. Use new ${.ALLTARGETS} variable to scan for
targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
src/usr.* and src/gnu/usr.* that would do target filename rewriting
(improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.
 1.22  12-Nov-2001  msaitoh change MACHINE_ARCH of evbsh3 from sh3el to sh3eb because all config files
for evbsh3 defaults to big endian.
 1.21  11-Nov-2001  jmc Always rebuild the nbmake wrapper script. Otherwise the options passed to
build.sh just get lost if they differ from a previous invocation (i.e. letting
MKOBJDIRS get set the first time, -o will get ignored after this unless a
rebuild of the script happens). It's low overhead so this adds little burden
to getting it right.
 1.20  09-Nov-2001  thorpej * Fix a quoting error so that when using -n, we actually see
$TOOLDIR and $DESTDIR in their expanded form.
* Set USETOOLS=yes in the make wrapper script; it's pretty pointless
using the make wrapper unless you're using the host tools.
* In the -t case, make sure to only echo the "make obj" command if -n.
 1.19  05-Nov-2001  dillo export DESTDIR when set via -D.
 1.18  02-Nov-2001  tv * Always use the makewrapper when starting a build phase.

* Set stuff mostly in the environment, not on make(1)'s command line.
This is needed for MACHINE and MACHINE_ARCH (noted by bjh21), and keeps
the mk.conf-overriding-env behavior (suggested by several people).

* Use MAKEFLAGS to make the wrapper script more readable.

* When prepping objdir in tools for the default TOOLDIR value, just make
that objdir; leave the recursive "make obj" for later.
 1.17  01-Nov-2001  thorpej When doing an only-tools build, don't use the makewrapper.
 1.16  01-Nov-2001  thorpej Add a -t option that builds and installs the toolchain only
(and thus implies -b). To make this work, we also check do_buildsystem
when doing the DESTDIR sanity check.
 1.15  31-Oct-2001  tv Major cleanup and overhaul:

* Allow MACHINE to be set automatically on NetBSD native builds.
Require -m only if the host is not NetBSD.

* Fail if DESTDIR is set to root (/) and the build is not NetBSD native,
or the build is attempting a "make release" (option -R).

* Warn the user if DESTDIR is set to root (/) that the kernel must be up
to date, or else the build might hose the system. Also, do not remove
DESTDIR on -r if it is set to root.

* Fail if TOOLDIR is set to / or empty after checking with nbmake.

* Allow DESTDIR and TOOLDIR to be set in mk.conf and/or by the new default
from <bsd.own.mk>. Note that if -T is not used to set TOOLDIR, and
TOOLDIR is not set in the environment, then nbmake will always be
bootstrapped (rather than looking at nbmake's timestamp). This is
because /bin/sh doesn't know how to get TOOLDIR from mk.conf without
first having nbmake (...which lives in TOOLDIR).

* Do a pass of "make obj" through src/tools before installing nbmake (so
long as -o/MKOBJDIRS=no is not specified). This ensures that objdirs
exist if they are desired, and paves the way for using build.sh to
build all the src/tools without building everything else.

* Add "-w" option, which allows the builder to specify where the nbmake
wrapper shell script should be created. If not specified,
$TOOLDIR/bin/nbmake-$MACHINE is still created as a default.

* Print the values of DESTDIR and TOOLDIR after bootstrapping nbmake,
for informational purposes.

It should now be possible to type just "./build.sh" on a NetBSD-current
host and get a new build in / for the appropriate architecture.
However, building in-place like this has *not* been extensively tested
yet, so be careful.
 1.14  31-Oct-2001  jmc Add a sanity check. Don't rm -rf / if TOOLDIR or DESTDIR got set to / and -r
was an option
 1.13  31-Oct-2001  reinoud Rollback
 1.12  31-Oct-2001  tv * Fix brokenness created by the -n option additions ("eval" still kept
quoting, so the commands were thought to be one big word with embedded
whitespace)

* New options:
-O obj Set root of an obj tree; sets MAKEOBJDIR to an appropriate
substitution pattern.
-o Sets MKOBJDIRS=no (otherwise sets MKOBJDIRS=yes)
-u Sets UPDATE
 1.11  31-Oct-2001  reinoud Acorn's MACHINE_ARFCH is now arm, not arm32 ... moving it effectively to
ELF (Yay!)
 1.10  30-Oct-2001  tv * Clean up a bit; always use [] for comparison tests.

* Don't require DESTDIR when -b is set.

* Add -n option, which prints the commands that would be run by build.sh,
but doesn't run them (much like make's -n option).

* Auto-resolve relative paths for -D, -R, and -T (but not for the
corresponding environment variables).

* Explicitly declare defaults of all shell variables used where feasible,
rather than sprinkling ${varname-value} expansions.

* Prefix shell true/false variables with "do_" to indicate their use as
actual values in shell expressions (like "$do_buildsystem && echo foo").
 1.9  30-Oct-2001  jmc Add -b option. Bootstrap only. i.e. build and install nbmake and then exit
 1.8  29-Oct-2001  tv Set TOOLDIR in the nbmake-MACHINE wrapper script.
 1.7  26-Oct-2001  matt Netwinder's MACHINE_ARCH is arm, not arm32
 1.6  24-Oct-2001  bjh21 Re-instate MACHINE -> MACHINE_ARCH entry for arm26, which I left out of the
last change.
 1.5  24-Oct-2001  bjh21 Sync the MACHINE -> MACHINE_ARCH mapping for ARM platforms with
sys/arch/*/param.h. While not necessarily correct, param.h is at least
definitively incorrect.
 1.4  24-Oct-2001  tv - Supply full list of MACHINEs for implicit MACHINE_ARCH evaluation.
If a machine is not known, abort.

- Emulate "mkdir -p" for Old "mkdir" programs on some host OS's.

- Add "-a" option to provide MACHINE_ARCH explicitly (for MACHINEs
that are capable of having more than one MACHINE_ARCH, such as sh3
and sparc64)

- Where "getopts" is not available in the shell, try using "getopt".
It's not whitespace compatible, but works in most cases.

- Rename "bmake" to "nbmake" per suggestions.

- When building nbmake, create a temporary directory for the purpose
of holding host compiler objects that might be created in the cwd.
Delete this directory if aborted via sh's "trap".

- Create a wrapper script in $TOOLDIR/bin called "nbmake-$MACHINE",
which can be run by hand for building parts of a cross tree easily.
Use this script when finally starting the build.
 1.3  19-Oct-2001  tv Move mkdir of TOOLDIR/bin to after removing TOOLDIR as specified by -r.
Add -R option to specify RELEASEDIR directory and flag using "make release"
instead of "make build" (inverted logic from removed -n option).
 1.2  19-Oct-2001  tv Add error handling to bmake build, and add "-j" option to set NBUILDJOBS.
 1.1  19-Oct-2001  tv Script to automate bootstrapping a build on any host platform. Creates
a bmake (rebuilds, if necessary) and invokes that to start the build.
 1.58.2.9  12-Dec-2005  tron Apply patch (requested by jmc in ticket #5972):
Clean up environment to avoid side effects on builds.
 1.58.2.8  14-Jun-2004  tron Apply patch (requested by jmc in ticket #1712):
Print out starttime, endtime and various other paramaters after
finishing a build. This fixes PR toolchain/25872.
 1.58.2.7  12-Mar-2004  jmc Pullup via patch (requested by jmmv in ticket #1550)

Set NETBSDSRCDIR explicitly to avoid build lossage
 1.58.2.6  12-Aug-2003  tron Pull up revision 1.113 via patch (requested by jmc in ticket #1404):
Fix 2 remaining places items are depending on execute permissions coming out
from a cvs checkout on scripts.
 1.58.2.5  03-Nov-2002  he Pull up revision 1.67 (via patch, requested by thorpej in ticket #800):
Use /usr/bin/env to invoke the real interpreter; this gets
us a POSIX shell on more systems.
Deal with a broken "pwd" on Solaris.
 1.58.2.4  03-Nov-2002  he Pull up revision 1.66 (requested by thorpej in ticket #799):
Back out previous, needs to be re-thought.
 1.58.2.3  03-Nov-2002  he Pull up revision 1.65 (requested by thorpej in ticket #796):
Use /bin/test explicitly in one place, rather than [ or
test (which might be a shell built-in). This allows this
script to work otherwise unchanged with Solaris 8's /bin/sh.
 1.58.2.2  09-Jul-2002  lukem Pull up revision 1.63 (requested by pooka in ticket #449):
fix pasto in error message
reported by Andrew Freedman in toolchain/17530
 1.58.2.1  29-May-2002  tv Pull up revision 1.59 (requested by msaitoh in ticket #64):
add armeb as valid MACHINE_ARCH
(tv: Not relevant to 1.6, but cosmetic to keep build.sh more in sync.)
 1.127.2.2  12-Dec-2005  tron Apply patch (requested by jmc in ticket #10194):
Clean up environment to avoid side effects on builds.
 1.127.2.1  22-Aug-2004  tron branches: 1.127.2.1.2; 1.127.2.1.4;
Pull up revision 1.131 (requested by junyoung in ticket #771):
Remove trailing / in pathname.
From Alan Barrett. See tech-toolchain@ for related discussion.
 1.127.2.1.4.1  12-Dec-2005  tron Apply patch (requested by jmc in ticket #10194):
Clean up environment to avoid side effects on builds.
 1.127.2.1.2.1  12-Dec-2005  tron Apply patch (requested by jmc in ticket #10194):
Clean up environment to avoid side effects on builds.
 1.134.2.2  15-Dec-2005  tron Pull up following revision(s) (requested by jmc in ticket #1048):
build.sh: revision 1.140
Nuke LESSCHARSET as well since it affects the output character set of groff
 1.134.2.1  07-Jul-2005  tron Pull up revision 1.136 (requested by lukem in ticket #564):
Unset INFODIR in the makewrapper.
Should fix a build problem observed when installing .info files
when the build user's environment has INFODIR set.
 1.153.2.6  15-Jan-2009  bouyer Pull up following revision(s) (requested by apb in ticket #1259):
build.sh: revision 1.200
"\t" does not represent a tab in sed regular expressions,
so use a ${tab} variable instead.
 1.153.2.5  26-Nov-2007  xtraeme Pull up following revision(s) (requested by jnemeth in ticket #999):
build.sh: revision 1.180
Delete mention of 'iso-dir=cdextras'. This was a leftover from
the original implementation of cdextra as an operation instead of
a being paramater.
 1.153.2.4  29-Sep-2007  xtraeme Pull up following revision(s) (requested by jnemeth in ticket #864):
distrib/common/Makefile.bootcd: revision 1.9
distrib/common/Makefile.bootcd: revision 1.10
distrib/common/Makefile.bootcd: revision 1.11
doc/BUILDING.mdoc: revision 1.51
doc/BUILDING.mdoc: revision 1.52
doc/BUILDING.mdoc: revision 1.53
build.sh: revision 1.172
build.sh: revision 1.173
build.sh: revision 1.174
build.sh: revision 1.175
BUILDING: revision 1.64
BUILDING: revision 1.65
BUILDING: revision 1.66
share/man/man7/release.7: revision 1.23
share/man/man7/release.7: revision 1.24
Makefile: revision 1.248

Add an iso-dir=directory option. When combined with iso-image or
iso-image-source, it will cause directory to be added to the CD-ROM image.

Convert build.sh iso-dir=directory option to -C cddir as per jmmv@ on
source-changes.
 1.153.2.3  19-Jul-2007  liamjfoy Pull up following revision(s) (requested by soren in ticket #774):
build.sh: revision 1.169
gnu/usr.bin/gcc4/backend/Makefile: revision 1.9
sys/arch/evbsh5/README: revision 1.1
distrib/notes/common/contents: revision 1.124
usr.sbin/ndbootd/ndbootd.c: revision 1.12
gnu/lib/libopcodes/arch/sh3eb/defs.mk: revision 1.4
gnu/lib/libbfd/arch/sh3eb/defs.mk: revision 1.8
libexec/ld.elf_so/Makefile: revision 1.78
gnu/dist/binutils/bfd/config.bfd: revision 1.14
doc/HACKS: revision 1.93
distrib/cdrom/current.conf: revision 1.8
gnu/lib/libgcc4/Makefile.inc: revision 1.6
share/mk/sys.mk: revision 1.90
distrib/sets/lists/base/mi: revision 1.700
libexec/ld.elf_so/rtld.c: revision 1.112
distrib/sets/lists/base/mi: revision 1.702
sys/arch/sh5/README: revision 1.1
gnu/lib/libbfd/arch/sh3el/bfd.h: revision 1.7
usr.sbin/traceroute/traceroute.c: revision 1.69
distrib/notes/common/main: revision 1.330
distrib/notes/common/list-setsizes.sh: revision 1.2
sys/arch/Makefile: revision 1.35
gnu/lib/libopcodes/arch/sh3el/defs.mk: revision 1.4
gnu/lib/libbfd/arch/sh3el/defs.mk: revision 1.8
share/mk/bsd.own.mk: revision 1.495
gnu/lib/libbfd/arch/sh3eb/bfd.h: revision 1.7
x11/lib/OSmesa/Makefile: revision 1.20
sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.13
gnu/dist/binutils/opcodes/configure.in: revision 1.2
gnu/dist/binutils/opcodes/configure: revision 1.2
gnu/usr.bin/send-pr/categories: revision 1.53
etc/mtree/NetBSD.dist: revision 1.339
sys/arch/README: revision 1.42
lib/libc/gdtoa/Makefile.inc: revision 1.6
usr.bin/crunch/crunchide/Makefile: revision 1.16
sys/lkm/net/bsdcomp/Makefile: revision 1.5
regress/sys/uvm/Makefile: revision 1.6
etc/MAKEDEV.awk: revision 1.18
x11/Xserver/GL/GLcore/Makefile.GLcore: revision 1.10
sys/contrib/dev/ath/netbsd/Makefile.ath.inc: revision 1.14
gnu/lib/libbfd/Makefile: revision 1.42
doc/RESPONSIBLE: revision 1.78
Remove evbsh5.
 1.153.2.2  16-Apr-2007  bouyer branches: 1.153.2.2.2;
Pull up following revision(s) (requested by apb in ticket #574):
build.sh: revision 1.165 - 1.166
build.sh: report both the version of NetBSD being built and the build
platform.
 1.153.2.1  06-Mar-2007  bouyer Pull up following revision(s) (requested by apb in ticket #491):
distrib/sets/regpkg: revision 1.15
tools/gcc/mknative.common: revision 1.9
distrib/sets/sets.subr: revision 1.56
distrib/sets/regpkgset: revision 1.9
build.sh: revision 1.161 via patch
Whenever we try to parse the output from make, run make with the -B
flag. This ensures that -j<N> isn't accidentally inherited from the
environment, because the "--- foo ---" headers printed with -j<N> would
interfere with parsing the output.
 1.153.2.2.2.3  06-Jan-2008  wrstuden Catch up to netbsd-4.0 release.
 1.153.2.2.2.2  30-Sep-2007  wrstuden Catch up w/ last night's netbsd-4
 1.153.2.2.2.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.171.4.3  23-Mar-2008  matt sync with HEAD
 1.171.4.2  09-Jan-2008  matt sync with HEAD
 1.171.4.1  06-Nov-2007  matt sync with HEAD
 1.184.2.1  24-Mar-2008  keiichi sync with head.
 1.187.2.1  18-May-2008  yamt sync with head.
 1.188.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.198.2.3  18-Mar-2009  snj branches: 1.198.2.3.4;
Pull up following revision(s) (requested by apb in ticket #578):
build.sh: revision 1.205
share/mk/bsd.own.mk: revision 1.559
Add "-", "_", and "A-Z" to the set of allowed characters in the
result from `uname -p`. We already have a platform with an underline
("x86_64"), and the other chars seem harmless.
 1.198.2.2  18-Mar-2009  snj Pull up following revision(s) (requested by apb in ticket #578):
build.sh: revision 1.204
share/mk/bsd.own.mk: revision 1.558
In build.sh and bsd.own.mk, if uname -p fails, or prints "unknown", or
prints something that does not look like an identifier, then use uname
-m instead. (Cygwin prints "unknown", and OpenBSD prints a long string
containing several spaces; this code should handle both.)
 1.198.2.1  09-Jan-2009  snj Pull up following revision(s) (requested by apb in ticket #232):
build.sh: revision 1.200
"\t" does not represent a tab in sed regular expressions,
so use a ${tab} variable instead. This bug was found by
Jeremy C. Reed.
 1.198.2.3.4.4  18-Dec-2013  matt Allow arch of armv7/armv7eb for evbarm. Add evbarmv7-e[bl] alias
 1.198.2.3.4.3  28-Feb-2010  matt Enable cobalt64 (cobalt/mips64el) and arc64 (arc/mips64el).
 1.198.2.3.4.2  09-Sep-2009  matt For pmap64, algor64, and sgimips64 use *64 as the makewrapper name
 1.198.2.3.4.1  26-Aug-2009  matt Add recognition of algor64, pmax64, and sgimips64
 1.200.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.242.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.251.2.5  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.251.2.4  23-Jan-2013  yamt sync with head
 1.251.2.3  16-Jan-2013  yamt sync with (a bit old) head
 1.251.2.2  30-Oct-2012  yamt sync with head
 1.251.2.1  17-Apr-2012  yamt sync with head
 1.253.2.1  02-Mar-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #68):
doc/BUILDING.mdoc: revision 1.88
BUILDING: revision 1.99
build.sh: revision 1.254
Add a missing period.
Add sanity checks for live-image and install-image targets
(which require mtree spec files built with MKUNPRIVED=yes)
to avoid unexpected makefs(8) error during image builds:
- if release op is specified with live-image or install-image
at the same time, make sure -U is also specified for the image builds
- before perform live-image and install-image ops check METALOG file
in DESTDIR to see if the build have been performed with MKUNPRIVED
XXX: Probably toolchain should create consistent spec files in
XXX: DESTDIR/etc/mtree dir regardless of MKUNPRIVED settings.
 1.255.2.4  19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.255.2.3  23-Jun-2013  tls resync from head
 1.255.2.2  25-Feb-2013  tls resync with head
 1.255.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.269.2.1  23-Jul-2013  riastradh sync with HEAD
 1.278.2.1  10-Aug-2014  tls Rebase.
 1.294.2.3  14-Nov-2014  martin Pull up following revision(s) (requested by snj in ticket #227):
Makefile: revision 1.311
build.sh: revision 1.299
doc/BUILDING.mdoc: revision 1.105
distrib/notes/macppc/prep.OPENFIRMWARE: revision 1.16
distrib/notes/macppc/prep.OPENFIRMWARE: revision 1.17
BUILDING: revision 1.110
distrib/notes/arc/prep: revision 1.3
distrib/notes/arc/prep: revision 1.4
distrib/notes/cats/prep: revision 1.12
distrib/notes/cats/prep: revision 1.13
distrib/notes/sparc/install: revision 1.58
distrib/notes/common/main: revision 1.512
share/man/man8/man8.macppc/ofwboot.8: revision 1.13
Update path to release ISOs.
 1.294.2.2  14-Nov-2014  martin Pull up following revision(s) (requested by apb in ticket #219):
build.sh: revision 1.301
Replace '.' and '-' in ${op} with '_', before setting d_${op}=true.
Also remove or simplify older code that did the same thing in a
different way. The old code handled most cases, but did not change
op=kernel.gdb to op=kernel_gdb.
 1.294.2.1  15-Aug-2014  riz Pull up following revision(s) (requested by apb in ticket #27):
build.sh: revision 1.295
Only the -m command line option, not MACHINE from the environment,
is supposed override MACHINE_ARCH from the environment with the
default MACHINE_ARCH for the requested machine.
Add and use an opt_m variable to enforce this.
 1.310.2.3  26-Apr-2017  pgoyette Sync with HEAD
 1.310.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.310.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.314.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.316.4.4  13-Mar-2023  jdc Pull up the following revision (requested by martin in ticket #1807):

build.sh: revision 1.366 via patch

Avoid the dependency on a populated tooldir (or building the tools)
when simply doing mkrepro-timestamp and the current repository setups
does not actually require it.
 1.316.4.3  15-Sep-2021  msaitoh Pull up following revision(s) (requested by martin in ticket #1695):
build.sh: revision 1.348
build.sh: revision 1.349
build.sh: revision 1.350
build.sh: revision 1.351
build.sh: revision 1.352
build.sh: revision 1.356
ignore cvslatest errors in expert mode
Handle git and mercurial for reproducible builds.
for mercurial, use the latest revision instead of limiting the output to 1
(requested by joerg)
handle different flavors of date(1)
kre@ does not like the subshell :-)
Add a new operation "mkrepro-timestamp" to extract the timestamp a
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=..
 1.316.4.2  26-Feb-2018  martin Pull up following revision(s) (requested by maya in ticket #591):
build.sh: revision 1.317-1.320

Add sanity check: passed -x but no xsrc directory

Accept also ../xsrc in our sanity check, we use this as a default too,
if it exists.

Simplify.

If we're going xsrc hunting, lets's do it properly. In particular
it is not "good" just because ../xsrc or /usr/xsrc exists, if the user said
-X /no/xsrc/here ... Further, when we find it, remember it.

While here, also look in my favourite place: .../src/xsrc - src/x would be
better (or src/x11) but that's too hard given the cvs module name and src
tarball format.
 1.316.4.1  19-Feb-2018  snj Pull up following revision(s) (requested by uwe in ticket #555):
build.sh: 1.322-1.323
tools/make/buildmake.sh.in: 1.9-1.12
Make sure nbmake is always built with the right _PATH_DEFSYSPATH.
--
Restore formatting/indentation of the configure call in rebuildmake()
to what it used to be.
--
G/c unused runcmd.
--
Do not use HOST_CFLAGS to link the make binary.
--
Do not use HOST_CFLAGS and others. build.sh calls configure with
CFLAGS set to HOST_CFLAGS, etc - so HOST_* environment variables are
already taken into account if set.
OTOH, if configure were to add anything to CFLAGS etc, the old code
would happily ignore those changes, picking up original environment
variables instead.
 1.324.2.4  18-Jan-2019  pgoyette Synch with HEAD
 1.324.2.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.324.2.2  21-May-2018  pgoyette Sync with HEAD
 1.324.2.1  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.327.2.4  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.327.2.3  21-Apr-2020  martin Sync with HEAD
 1.327.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.327.2.1  10-Jun-2019  christos Sync with HEAD
 1.333.2.10  08-Jul-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1963):

build.sh: revision 1.399

Export MKREPRO to environment when calling build.sh -P

This matches what setup_mkrepro() does when MKREPRO or
MKREPRO_TIMESTAMP are set manually.

This fixes PR toolchain/59512.
 1.333.2.9  10-May-2025  bouyer Pull up following revision(s) (requested by martin in ticket #1951):
build.sh: revision 1.393 via patch
build.sh: revision 1.394 via patch
Unify the output of "show-revisionid" between the various VCSes
and checkout/archive variants.
Fix git formatting for show-revisionid
 1.333.2.8  10-May-2025  bouyer Pull up following revision(s) (requested by martin in ticket #1950):
build.sh: revision 1.392 via patch
Expert hack: if you know what you are doing, allow to avoid
the tool build for some commands that might or might not need
it, like:
build.sh -VUSETOOLS=never -P mkrepro-timestamp show-revisionid
This will not need any tools when run on a new-enough NetBSD host or
if using some other VCS than CVS.
 1.333.2.7  24-Apr-2025  snj Pull up following revision(s) (requested by martin in ticket #1945):
build.sh: revision 1.389-1.391 via patch
Fix "show-revisionid" operation to include both src and xsrc
data if the -x argument is present.
--
Minor cosmetic tweaks to previous
--
Simplify previous (from kre@)
 1.333.2.6  31-Dec-2024  snj Pull up following revision(s) (requested by martin in ticket #1931):
build.sh: 1.383, 1.384, 1.388 via patch
Add a new operation "show-revisionid" that extracts a marker usable
to recreate the source (depending on the revision control system
in use).
Fix typo in previous
build.sh: fix spelling and grammar in a help string
 1.333.2.5  13-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1907):

build.sh: revision 1.378
build.sh: revision 1.379

build.sh: Check for xsrc/Makefile, not just xsrc/.
Should make the failure mode a little more obvious when you forget to
mount xsrc.
PR toolchain/58399

build.sh: Adjust xsrc existence test as requested.
PR toolchain/58399
 1.333.2.4  11-Sep-2023  martin Pull up following revision(s) (requested by khorben in ticket #1730):

build.sh: revision 1.374

build.sh: add support for git worktree

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/'
 1.333.2.3  13-Mar-2023  jdc Pull up the following revision (requested by martin in ticket #1611):

build.sh: revision 1.366 via patch

Avoid the dependency on a populated tooldir (or building the tools)
when simply doing mkrepro-timestamp and the current repository setups
does not actually require it.
 1.333.2.2  02-Feb-2022  martin Pull up following revision(s) (requested by mrg in ticket #1423):

build.sh: revision 1.345

add "distsets" alias for "distribution sets".
 1.333.2.1  14-Sep-2021  msaitoh Pull up following revision(s) (requested by martin in ticket #1345):
build.sh: revision 1.348
build.sh: revision 1.349
build.sh: revision 1.350
build.sh: revision 1.351
build.sh: revision 1.352
build.sh: revision 1.356
ignore cvslatest errors in expert mode
Handle git and mercurial for reproducible builds.
for mercurial, use the latest revision instead of limiting the output to 1
(requested by joerg)
handle different flavors of date(1)
kre@ does not like the subshell :-)
Add a new operation "mkrepro-timestamp" to extract the timestamp a
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=..
 1.347.2.1  31-May-2021  cjep sync with head
 1.365.2.8  08-Jul-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1132):

build.sh: revision 1.399

Export MKREPRO to environment when calling build.sh -P

This matches what setup_mkrepro() does when MKREPRO or
MKREPRO_TIMESTAMP are set manually.

This fixes PR toolchain/59512.
 1.365.2.7  10-May-2025  bouyer Pull up following revision(s) (requested by martin in ticket #1114):
build.sh: revision 1.393 via patch
build.sh: revision 1.394 via patch
Unify the output of "show-revisionid" between the various VCSes
and checkout/archive variants.
Fix git formatting for show-revisionid
 1.365.2.6  10-May-2025  bouyer Pull up following revision(s) (requested by martin in ticket #1113):
build.sh: revision 1.392
Expert hack: if you know what you are doing, allow to avoid
the tool build for some commands that might or might not need
it, like:
build.sh -VUSETOOLS=never -P mkrepro-timestamp show-revisionid
This will not need any tools when run on a new-enough NetBSD host or
if using some other VCS than CVS.
 1.365.2.5  24-Apr-2025  snj Pull up following revision(s) (requested by martin in ticket #1102):
build.sh: revision 1.389-1.391 via patch
Fix "show-revisionid" operation to include both src and xsrc
data if the -x argument is present.
--
Minor cosmetic tweaks to previous
--
Simplify previous (from kre@)
 1.365.2.4  31-Dec-2024  snj Pull up following revision(s) (requested by martin in ticket #1031):
build.sh: 1.383, 1.384, 1.388
Add a new operation "show-revisionid" that extracts a marker usable
to recreate the source (depending on the revision control system
in use).
Fix typo in previous
build.sh: fix spelling and grammar in a help string
 1.365.2.3  13-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #964):

build.sh: revision 1.378
build.sh: revision 1.379

build.sh: Check for xsrc/Makefile, not just xsrc/.
Should make the failure mode a little more obvious when you forget to
mount xsrc.
PR toolchain/58399

build.sh: Adjust xsrc existence test as requested.
PR toolchain/58399
 1.365.2.2  11-Sep-2023  martin Pull up following revision(s) (requested by khorben in ticket #367):

build.sh: revision 1.374

build.sh: add support for git worktree

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/'
 1.365.2.1  13-Mar-2023  jdc Pull up the following revision (requested by martin in ticket #117):

build.sh: revision 1.366 via patch

Avoid the dependency on a populated tooldir (or building the tools)
when simply doing mkrepro-timestamp and the current repository setups
does not actually require it.
 1.377.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed