Even building standalone hello world complains "ASan runtime does
not come first in initial library list" and says to use LD_PRELOAD
without saying WHAT to set it to. This avoids that. (It breaks llvm,
but https://github.com/llvm/llvm-project/pull/98194 fixes it.)
and probing them in parallel makes that awkward, so if there are any
pass --start-group and --end-group to the linker so it actually
resolves crosstalk between them.
in -type so use parentheses and -o, 2) change semantics (sourcing changes
variables) so running with no arguments sets up a persistent wrapper
and outputs an export line to update variables.
scripts/portability.sh already has two fallbacks (sysctl -n hw.nproc for
mac/bsd and if that doesn't work either it sets CPUS=1).
With this, I built on mac outside of homebrew, albeit cheating to get .config:
$ homebrew
$ make macos_defconfig
$ make clean
$ exit
$ scripts/prereq/build.sh #ignoring SO many warnings
$ mkdir prereq; mv toybox-prereq prereq/
$ for i in $(prereq/toybox-prereq); do ln -s toybox-prereq prereq/$i; done
$ PATH=$PWD/prereq:$PATH scripts/make.sh
$ ./toybox
to provide the toybox commands used by the full scripts/make.sh,
with minimal dependencies and using whatever #!/bin/sh you've got.
Run scripts/prereq/build.sh to make a first stage toybox.
Run scripts/recreate-prereq.sh to enumerate the commands a "defconfig" build
uses out of the $PATH and populate the scripts/prereq directory
with a minimal build.sh and stripped down headers.
Does not yet include the shell: you still need #!/bin/bash for that.
Does not yet include make. You can call scripts/make.sh directly
(and scripts/test.sh and scripts/single.sh) if you've got a .config,
but until kconfig/ is replaced defconfig/menuconfig still need make.
Yes, I am shipping generated files. Seemed an appropriate date for it.
allow $VERSION override without the -DTOYBOX_VERSION=\"blah\" wrapper,
remove magic sed line ranges for dependency checking (tag lines with #d
instead), split out FILES= in generated build.sh and wordwrap it to
be more legible, make PATH= a comment for dependency checking instead of
a variable override on the target system.
Oliver Webb noticed that selecting allnoconfig then enabling just sh
(instead of "make sh" singleconfig) build breaks because test.c isn't
build but it tries to pull in test_main().
So search for files to compile using unintented USE() macros wrapping NEW()
This version runs every time (much faster), and only includes enabled
structures so the union's size is the enabled high water mark rather than
pending: scripts/probes/GLOBALS now says that ps is the largest one,
setting the sizeof(this) to 336 bytes.
Because we statically link the binaries against musl-libc, we need a musl-libc
toolchain for the host. (Static linking is broken on modern glibc.)
The -host toolchain we build first has various shortcuts to remove
incestuous dependencies, and the result is mostly good for building the
full toolchain. (Because gcc is rickety and overcomplicated. Yes there's
a pattern here: "If it starts with g, scream and flee...")
Thus non-host toolchains need the full host toolchain to (reliably) build,
and if you did a fresh clone and built a specific toolchain ala
"~/toybox/scripts/mcm-buildall.sh or1k::" it needs both host toolchains,
so add it as a dependency when you specify toolchains to build on the command
line. (In theory, if the toolchain exists it shouldn't rebuild it. You have
to rm -rf the corresponding dir/sqf out of ccc to force a rebuild.)
select package versions. This means it now builds arm hosted toolchains on
arm, builds x86-64 (not i686) on x86-64, and you should just be able to
clone and copy a "sources" directory in and build without net access.
Also backported a bugfix patch for the x86-64 host build.