166 Commits
Author SHA1 Message Date
Rob Landley 185722d30a Start of new kconfig plumbing, for now just replacing old config2help. 2025-04-09 10:04:36 -05:00
Rob Landley a51c66edb7 Switch type to long long one entry earlier so (1<<31) isn't negative
and printf("%llx\n", _PS_RGROUP|_PS_RUSER) isn't ffffffff80000000
2024-11-17 01:01:53 -06:00
Rob Landley d52e93c947 Create generated/tags.h with sed and bash instead of C. 2024-04-30 15:18:24 -05:00
Rob Landley 3101559d35 Only --start-group and --end-group when static linking.
Mac doesn't use llvm's lld linker, it uses its own producing mach-o
binaries, which barfs on --start-group.
2024-04-29 15:18:45 -05:00
Rob Landley 1b6d64ffc3 The "extra" libraries want to go in a magic order when static linking,
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.
2024-04-27 13:47:35 -05:00
Rob Landley 9f7d285af6 Copy numeric config symbols into config.h. 2024-04-05 11:51:20 -05:00
Rob Landley 567f8daac6 Build plumbing: redo compflags(), pull out $VERSION calculation,
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.
2024-03-18 07:02:14 -05:00
Rob Landley 919273caec Simplify and parallelize library probe. 2024-03-15 17:36:15 -05:00
Rob Landley 1e3708a912 Change file list collection for build.
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()
2024-02-21 17:51:37 -06:00
Rob Landley 73645dac0b Whitespace: remove unnecessary/inconsistent newline 2024-02-11 02:27:21 -06:00
Rob Landley 8a2d19bf12 Rewrite globals.h generation to only call sed twice.
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.
2024-02-09 06:21:42 -06:00
Rob Landley 316a2676cc Switch to newer sed syntax to make generated/config.h, as long as we're
using $SED instead of sed anyway (and thus gsed instead of ancient sed
on MacOS). Also, yank check and just always rebuild it.
2024-01-27 17:10:03 -06:00
Rob Landley e64f361e40 Compress help text with gzip. 2024-01-10 15:12:34 -06:00
Rob Landley dd56ea0864 Re-implement the wait $PID codepath because macos needs it. 2023-03-05 22:49:40 -06:00
Rob Landley 3dc487d989 Mac's gsed is slow to launch, so avoid one repeated call in a loop. 2023-03-05 14:05:16 -06:00
Rob Landley c5e7495fe4 Ensure make wrapper sees success return code in verbose mode (V=1) 2023-01-13 11:50:58 -06:00
Rob Landley 092b691892 Make newlines go to stdout/stderr matching most recent output. 2022-12-02 02:44:03 -06:00
Rob Landley 10325745e3 E5ten's suggestion for not truncating output when redirected to a file. 2022-10-01 16:14:22 -05:00
Rob Landley 99bfe9da41 Older versions of bash (such as the one in macos) don't understand &>>
and despite >& and &> being listed as synonyms in the bash man page,
>>& isn't supported even by the new ones.

Need to circle back to this and fix it another way, but unbreak macos for now.
2022-09-20 01:10:25 -05:00
Rob Landley 92252a2003 Don't truncate log file when stderr redirected. 2022-09-15 14:41:08 -05:00
Rob Landley 3b90857a43 Turn the "run make oldconfig" message into a warning instead of an error.
(It's interfering with the Android build's header snapshot thing.
When we rewrite kconfig from scratch we can have it call oldconfig itself,
until then just mention that we detected the need. It works without it
often enough, and the build breaks shouldn't be subtle...)
2022-06-10 23:49:25 -05:00
Rob Landley 5eae30d2a5 Fix $PREFIX=/path/that/does/not/exist builds. 2022-05-30 12:33:51 -05:00
Rob Landley 20c123b95d More work to get dependencies to handle swapping toolchains,
including detecting when Config.probed changed, requiring "make oldconfig".
2022-05-29 04:15:48 -05:00
Rob Landley 1ff4c4b140 Minor cleanup. 2022-05-22 14:25:04 -05:00
Rob Landley e1f347ef82 Fix dependency checking. 2022-05-20 10:57:13 -05:00
Rob Landley 95b79373ba Clean up build plumbing. 2022-05-15 19:39:27 -05:00
Rob Landley cecd169cde Collate ASAN setup, move generated/instlist into generated/unstripped,
use $UNSTRIPPED variable in more places and move definition to ./configure.
2022-04-12 17:22:18 -05:00
Rob Landley 83d5d7a0bb Fix "toybox command --help". 2022-03-31 16:08:56 -05:00
Rob Landley 132b7cfcd2 Update make.sh to avoid library probe when toolchain hasn't changed. 2022-03-31 13:50:11 -05:00
Rob Landley bbe709fb87 use $GENDIR variable for (some) generated/ references, and move
build binaries (config2help/mkflags/mktags) to $GENDIR/unstripped.
2022-03-22 14:21:08 -05:00
Rob Landley 7a5cb95817 Move UNSTRIPPED to configure, merge LDASNEEDED into LDFLAGS
(which comes early enough in the command line now), use shoter : ${NAME:=val}
syntax for the if-not-set-then-set variables, have CFLAGS append
to inherited instead of if-not-set (it was already doing that for
-funsigned-char so we're 8 bit clean, everything else is warnings
management and one -Werror for function with no prototype).
2022-03-04 04:11:01 -06:00
Rob Landley 4d9c2a56a0 Move config variables to configure. 2022-03-03 02:45:35 -06:00
Rob Landley ebde3b8a5b Move -Wno-string-plus-int to configure instead of probing for it.
llvm still emits "C++ programmers do not understand C" warnings unless muzzled,
but gcc versions that die when hitting -Wno-warning-you-do-not-produce
seem to have cycled out.

Oddly, gcc will still spuriously warn about unknown -Wno-thingy when generating
OTHER warnings, which seems both useless and indecisive. (If you typo a
-Wno-thingy so it doesn't suppress the warning, you presumably notice that
the warning it just generated did not get suppressed. It wasn't worth telling
you about before, so why tack on some noise to the other output?)
2022-02-12 03:18:59 -06:00
Rob Landley 679146ec35 Fix generated/build.sh 2022-02-12 03:18:55 -06:00
Rob Landley 515a1f2edd Move some of the uglier make.sh plumbing into portability.sh. 2022-02-12 03:18:48 -06:00
Rob Landley fc0fbe6788 Move lib/lib.c into main.c so make.sh doesn't have to split it out seperately. (Nothing else in lib/ has to rebuild when command list changes.) 2022-02-12 03:18:10 -06:00
Rob Landley f8883bd296 Yank -lrt linking entirely: when statically linked it pulls in pthreads for non-threaded programs, and neither bionic nor musl have it. (This means glibc always does the HASTIMERS syscall wrap.) 2021-11-05 23:46:54 -05:00
Eric Molitor f574706bb8 wget: Add OpenSSL and BoringSSL support 2021-10-29 12:23:17 -05:00
Eric Molitor df6da52cd5 wget: Add TLS Support v2 2021-10-28 12:08:46 -05:00
Elliott Hughes 81859b8a57 timeout: use the monotonic clock.
On a desktop or server the difference between the realtime and monotonic
clocks doesn't matter much, but we've seen cases on Android where
something's run under timeout(1) but killed before it's had a chance to
do anything because the device went into sleep shortly afterwards and by
the time it came back, the timeout had elapsed (as far as the realtime
clock is concerned) but the process had only had a tiny fraction of the
timeout where the system wasn't suspended.

This patch also adds an xparsetimespec() function; at this point the
only remaining users of xparsetime() are in lib, so maybe that should
become static, at least until we have another need for it?

A bigger question is whether timeout(1) needs to offer the user a choice
between the two different clocks? Although monotonic is usally the right
default choice on Android, and I don't have a specific counter-example
to hand, I can imagine that someone might actually mean "wall clock time"
rather than "cpu clock time" when setting a timeout...

Luckily, timer_create() lets us trivially choose between both clocks
if so.
2021-09-23 20:21:20 -05:00
Rob Landley a2bf4916be Minor cleanups. 2021-08-24 07:57:42 -05:00
Rob Landley f37e5bf245 People still using Centos 7 asked for some bug workarounds. 2021-08-16 03:06:08 -05:00
Rob Landley f8e28ad070 Use wait -n to keep cpus busier during parallel build.
(No guarantee children complete in the order they're launched. Ability to
wait for "next" was added in bash 4.3 which shipped Feb 2014, now over the
7 year horizon.)
2021-08-15 05:13:21 -05:00
Rob Landley 65488aff88 Minor cleanup and rephrase a comment. 2021-07-24 12:13:04 -05:00
Rob Landley efb8060a59 People have been having trouble finding the toybox web page (despite being
the first google hit for "android toybox"), and want toybox --help to
mention it. I was referred to https://github.com/landley/toybox/issues/50

So add a URL to toybox --help. While I was there, make unrecognized commands
(like toybox -?) suggest "toybox --help", move the install instructions
to the FAQ page (with a second link from toybox --help), and generally
tighten up the help text. Also, "toybox -*" is no longer a synonym for --long.

Oh, and I fixed some build dependencies when Config.in changes.
2020-08-07 02:25:50 -05:00
Elliott Hughes dc16c1161c Make ASAN=1 affect the HOSTCC-built tools too.
Bug: https://github.com/landley/toybox/issues/169
2020-02-22 06:11:48 -06:00
Rob Landley abddc3bb40 ASAN=1 implies NOSTRIP=1, and don't say strip failed for NOSTRIP. 2019-09-20 14:38:52 -05:00
Rob Landley 3356140fd2 Add cross.sh to cross compile for one or more targets, and tweak make.sh to
produce different output names for different ${TARGET}s.
2019-09-06 21:22:50 -05:00
Elliott Hughes 71bdf7a5ac Add ASAN=1 to the build system.
Just use `ASAN=1 make test_grep` or whatever.

You'll probably want to set $ASAN_SYMBOLIZER_PATH to point to
llvm-symbolizer, but Debian makes that annoying by calling the
symbolizer /usr/bin/llvm-symbolizer-4.0 or whatever, and ASan refuses to
use it:

  ==43370==ERROR: External symbolizer path is set to
  '/usr/bin/llvm-symbolizer-4.0' which isn't a known symbolizer. Please
  set the path to the llvm-symbolizer binary or other known tool.

My usual workaround for this is to drop an llvm-symbolizer symlink in
the current directory, and I'm happy to automate that in the script to
make it require no knowledge of any of this nonsense, but haven't done
so in this initial patch.

I tested that this is actually working by reverting the grep fix and
running `ASAN=1 make test_grep`.
2019-07-29 04:14:36 -05:00
Eric Molitor 78991600dd Bash Compatibility Patch
I know that you are working on toysh which I'm looking forward to. In the
meantime below is a patch to improve compatibility with older/odd versions
of bash. This fixed a minor build issue I was having on MacOS (which was
using zsh in emulated bash mode) as well as an oddball embedded SDK using
a non-gnu version of bash. I believe these changes are minimal and should
be safe to apply, if not I wanted to at least get them on the mailing list
in case others ran into these issues.
2019-06-29 12:31:22 -05:00