aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* make: add .PRAGMA special targetRon Yorston2022-11-181-38/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the special target .PRAGMA. This allows certain features of the POSIX standard to be disabled when POSIX mode is being enforced. This is done by setting prerequisites of .PRAGMA, as follows: - macro names containing '-' are permitted with the 'macro_name' prerequisite; - target names containing '-' or '/' are permitted with the 'target_name' prerequisite; - the '#' character isn't treated as the start of a comment in a command line with the 'command_comment' prerequisite; - an empty suffix is permitted in a macro expansion of the form $(VAR:=.c) with the 'empty_suffix' prerequisite. Additionally the 'posix_202x' prerequisite enforces the future POSIX standard instead of the current one. In this case the 'macro_name' and 'target_name' pragmas aren't required as the future standard will allow the additional characters. .PRAGMA without any prerequisites restores the default behaviour.
* build system: allow monochrome 'make menuconfig'Ron Yorston2022-11-161-0/+3
| | | | | | | | | 'make menuconfig' uses a hardcoded colour palette which may be difficult to read. Add support for the 'COLORS' environment variable. Setting this to '0' will cause 'make menuconfig' to be displayed in black and white. (GitHub issue #273)
* make: changes to suffix substitution in macro expansionRon Yorston2022-11-162-9/+29
| | | | | | | | | | | | | | The POSIX standard defines suffix substitution in macro expansion as taking the form: $(string1 [: subst1 =[ subst2 ]]) Since 'subst1' isn't bracketed a value must be supplied. Enforce this in POSIX mode. As a non-POSIX extension an empty 'subst1' is permitted with 'subst2' being added to all words unconditionally. If both 'subst1' and 'subst2' are empty the words are returned unchanged.
* make: show location of errors during buildRon Yorston2022-11-161-15/+41
| | | | | | | | | | | | | | | | | | | | | | Error messages only displayed the location of an error while the makefile was being parsed. Store the location (makefile name and line number) of each command line. This allows location information to be displayed in errors encountered while targets are being built. Take this Makefile, for example: target: @echo $(hello Previously this would display: make: unterminated variable '$(hello' Now it shows: make: (Makefile:2): unterminated variable '$(hello'
* make: fix typo in help textRon Yorston2022-11-141-2/+2
|
* win32: native make menuconfig: support searchAvi Halachmi (:avih)2022-11-131-5/+21
| | | | | | | Previously, pressing slash to search at the menu aborted the menu program ('mconf'), because regexp is not available with native mingw. Now it works, but the search is of plain string rather than regexp.
* make: use correct test for valid macro nameRon Yorston2022-11-132-1/+14
| | | | | The test for valid macro names in POSIX mode was incorrect: it shouldn't have allowed '-'.
* make: pdpmake needs long filename support in ar tooRon Yorston2022-11-131-1/+1
| | | | | | Commit f261d2d27 (make: make + sh configuration) added a 'pdpmake' alias for 'make'. It omitted to reference PDPMAKE as a dependency for FEATURE_AR_LONG_FILENAMES.
* build system: try harder to detect w64devkitRon Yorston2022-11-121-0/+11
| | | | | | | | | | | | | | | We need to build the supplied PDCurses code when using w64devkit. This was being detected by checking for the W64DEVKIT environment variable, but this is only defined if w64devkit is started via w64devkit.exe. Set W64DEVKIT ourselves if HOSTCC targets the mingw32 platform. This won't be the case when cross-compiling on Linux but will for w64devkit and MSYS2 MINGW32/64. The build won't work properly for MSYS2 MINGW32/64, but it doesn't work when using the supplied curses library either. 'make menuconfig' requires the use of MSYS2 MSYS, and HOSTCC there targets msys.
* make: make + sh configurationRon Yorston2022-11-105-1/+2456
| | | | | | Add a configuration that just includes make and a shell. Add 'pdpmake' as an alias for 'make'.
* Update README.mdRon Yorston2022-11-091-7/+3
| | | | Microsoft Windows build now uses w64devkit.
* build system: silence compiler warningFRP-4784-g5507c8744Ron Yorston2022-11-081-0/+1
| | | | | | The compiler in MSYS2 warns that strcasecmp(3) isn't declared in scripts/kconfig/lxdialog/checklist.c. Add the appropriate include to silence this warning.
* win32: fix ESC/CR handling in 'make menuconfig'Ron Yorston2022-11-071-1/+1
| | | | | | | The WIN32 code in the 'mconf' build program should truncate the exit status from dialogs as if it were passed through WEXITSTATUS. The text dialog, for example, returns a status of -1 when ESC or CR is pressed. 'mconf' expects to see this as 255.
* Provide PDCurses source for w64devkit buildRon Yorston2022-11-0740-0/+10615
| | | | | | w64devkit doesn't ship a curses library. Provide a cut-down copy of PDCurses which is sufficient to allow 'make menuconfig' to work in w64devkit.
* win32: allow 'make menuconfig' in native buildsRon Yorston2022-11-071-6/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | 'make menuconfig' is a build option to allow changes to be made to the BusyBox configuration. It's a bit friendlier than using a text editor on the .config file. Previously 'menuconfig' was only available when cross-compiling on a Linux/Unix platform. The 'mconf' build program has been ported to WIN32 so it's now able to run the 'lxdialog' program which displays the configuration dialogs. Building 'lxdialog' is somewhat awkward in MSYS2. The MINGW32/64 build environments generate WIN32 executables for 'lxdialog'. These doesn't work properly in the MSYS2 console. For 'menuconfig' to work it's necessary to run it in an MSYS build environment. This generates an MSYS binary which works in the MSYS2 console. busybox-w32 should then be built in a MINGW32/64 build environment. Doing so will generate additional copies of the build programs without a '.exe' suffix: the MSYS build environment adds '.exe' to binaries it builds. This breaks 'menuconfig'. To configure an MSYS build environment use: pacman -S gcc ncurses-devel
* make: fix typo in inference rule handlingRon Yorston2022-11-042-24/+25
| | | | | | | A typo in the previous commit caused dyndep() to process inference rules incorrectly. This didn't affect the results of the test suite when extensions were allowed but it caused the test 'Inference rule with explicit rule for prerequisite' to fail in POSIX mode.
* make: fixes to inference rulesRon Yorston2022-11-032-18/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Austin Group defect report 875 clarifies some aspects of inference rules. The crux of the issue is related to chained inference rules so it doesn't affect POSIX mode. The test makefile looks like this: .SUFFIXES: .a .b .c .a.c: @echo .a.c .b.c: @echo .b.c test.c: test.b test.a: test.b: The correct output is deemed to be '.a.c'. Additional complications are: - whether or not the prerequisite files are present; - the use of the suffixes '.a' and '.c' may result in the builtin inference rule '.c.a' being considered. In favourable circumstances pdpmake managed to give the correct result, in unfavourable it reported circular dependencies or segfaulted. Changes to fix these issues are: - When prerequisites are being recursively built the standard says: 'Upon recursion, each prerequisite shall become a target itself.' Follow this requirement. - At the end of make() the target being built should have its time (as represented by n_tim in struct name) updated when any action has been taken. - When dyndep() is looking for prerequisites it should: * skip candidates that are in the process of being built; * consider whether an explicit candidate is a target, not whether it has any commands associated with it. pdpmake now behaves similarly to GNU make when presented with makefiles like the above. bmake gives the incorrect output '.b.c'.
* make: comments in macro expansions and command linesRon Yorston2022-11-012-3/+34
| | | | | | | | | | | | | | The POSIX specification says: There are three kinds of comments: blank lines, empty lines, and a <number-sign> ('#') and all following characters up to the first unescaped <newline> character. Most implementations don't treat '#' in a macro expansion or a command line as the start of a comment. POSIX doesn't mention either of these exceptions. Permit the exceptions as a non-POSIX extension.
* make: fix test for .WAIT so bmake passesRon Yorston2022-11-011-1/+1
| | | | | Use $? instead of $^ in the test for .WAIT. bmake supports .WAIT but not $^.
* win32: remove declaration of vfork(2)Ron Yorston2022-10-311-1/+0
| | | | | | | Since vfork(2) is never used in busybox-w32 there's no need to declare it. Doing so provokes clang to issue a warning. (GitHub issue #239)
* make: different treatment for escaped NL in macro in commandRon Yorston2022-10-302-6/+37
| | | | | | | Austin Group defect report 1549 has been accepted. It requires that an escaped newline inside a macro expansion in a command is replaced by a space. Other escaped newlines in commands are left in place, as before.
* build system: fix breakage affecting MSYS2 buildRon Yorston2022-10-302-4/+4
| | | | | | | | | | Upstream changes to the embedded_scripts and mkconfigs scripts resulted in busybox-w32 failing to build with MSYS2. bzip2 in MSYS2 detects stdout redirected to /dev/null as a terminal and returns a non-zero exit status. Since the test is only for the existence of bzip2, not its functionality, even an exit status of 1 is OK. Only fail if the exit status is 127.
* build system: allow building with w64devkitRon Yorston2022-10-306-7/+43
| | | | | | | | | | | | | | | | | | | | | | | Make some adjustments to the build system to allow busybox-w32 to be built with w64devkit: - Strip drive prefix from CURDIR in Makefile to avoid confusing make with colons. - Limit file redirection to a subshell in the usage_compressed and embedded_scripts scripts. Otherwise it isn't possible to move the open generated file on Windows. - Change the option tests in Kbuild.include to allow for /dev/null not existing on Windows. - Create host binaries without a '.exe' extension. Otherwise they're rebuilt more often than necessary. - Modify split-include.c to allow for Windows' popen() not expanding wildcards. (GitHub issue #239)
* win32: revert special treatment of Unix-style absolute pathsRon Yorston2022-10-267-49/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 605972390 (win32: handle Unix-style absolute paths for executables) added special treatment of paths for executables starting with a slash. Such paths are absolute on Unix but are relative to the current drive on Windows. On reflection this commit did more than necessary. Later commits provided special treatment only for paths starting with locations traditionally used to contain binaries on Unix. This is probably sufficient. Problems introduced by commit 605972390 include: - If the current drive isn't the system drive tab completion of a command starting with a slash confusingly references the system drive. - Building busybox-w32 with w64devkit fails on drives other than the system drive. Revert the changes introduced by commit 605972390. This saves 192 bytes. (GitHub issue #239)
* win32: fix warning in timegm(3)Ron Yorston2022-10-251-1/+0
| | | | | | | | | | | Building on Windows using w64devkit resulted in a new warning in timegm(3). The compiler didn't like a reference to the unnamed temporary in: if (!is_leap) is_leap = &(int){0}; is_leap is always non-NULL in the limited version of the code used here so the offending line can simply be removed.
* win32: revise creation of resourcesRon Yorston2022-10-252-3/+5
| | | | | | | | | | | As reported in https://github.com/skeeto/w64devkit/issues/35 there's a problem creating Windows resources using the native version of `windres`. Avoid passing arguments to `windres` that it can't handle by stringizing the version string locally in resource.rc. (GitHub issue #239)
* make: add a comment, no functional changeRon Yorston2022-10-211-3/+8
|
* make: $+ should support D/F modifiersRon Yorston2022-10-201-0/+1
| | | | | The code to handle the modifiers for 'directory part' and 'filename part' has been updated to support the $+ internal macro.
* make: .NOTPARALLEL and .WAIT are special targetsRon Yorston2022-10-192-2/+16
| | | | | | | | | | | | | Austin Group defect report 1437 has been accepted. It describes the special targets .NOTPARALLEL and .WAIT which are used to influence the behaviour of parallel builds. Since parallel builds aren't implemented in here they actually don't 't have much effect. - For completeness they're flagged as special targets. - .WAIT should be allowed as a prerequisite.
* make: shell assignment is a POSIX 202X featureRon Yorston2022-10-182-16/+16
| | | | | | | | Austin Group defect report 337 has been accepted, thus making macro assignment from the output of a shell command (!=) a POSIX 202X feature. This was previously implemented as a non-POSIX extension.
* make: support $+ and $^ as POSIX 202X featuresRon Yorston2022-10-182-14/+31
| | | | | | | | | | | | | | | | | | Austin Group defect reports 514 and 1520 have both been accepted. Together these introduce the internal macros $+ and $^: - $+ lists all prerequisites, with duplicates retained; - $^ lists all prerequisites, with duplicates removed. $^ had already been implemented as a non-POSIX extension, it now becomes a POSIX 202X extension. $+ has been added as a POSIX 202X extension. Neither of the above defect reports mentions how $? should handle duplicate prerequisites. In POSIX mode duplicates are retained. Removal of duplicates is implemented as a non-POSIX extension to match existing practice in other versions of make.
* make: clarify output of testsRon Yorston2022-10-161-31/+31
|
* ash: disable the 'sleep' builtin in the default configurationRon Yorston2022-10-132-2/+2
| | | | | | The sleep applet can call xfunc_die() in a variety of circumstances. This makes the code unsuitable for use as a shell builtin. Disable it in the default configuration.
* ash: enable 'read -t N.NNN'Ron Yorston2022-10-132-2/+2
| | | | | | | | | Upstream BusyBox has supported fractional arguments to 'read -t' since 2017. For some reason it was never enabled in busybox-w32. Costs 48-80 bytes. (GitHub issue #269)
* xxd: avoid use of uninitialised variableRon Yorston2022-10-121-0/+4
| | | | | | | If xxd is run with '-r' but no '-s' the value of opt_s passed to reverse() is uninitialised. This patch has been submitted upstream but hasn't been applied yet.
* Update default configurationRon Yorston2022-10-122-2/+6
| | | | The new 'tree' applet uses scandir(3) and has been disabled by default.
* Merge branch 'busybox' into mergeRon Yorston2022-10-1246-186/+678
|\
| * tls: move definitions around, no code changesDenys Vlasenko2022-09-081-22/+12
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: include signature_algorithms extension in client hello messageDenys Vlasenko2022-09-081-18/+73
| | | | | | | | | | | | | | | | | | | | function old new delta tls_xread_record 629 645 +16 .rodata 105167 105179 +12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 28/0) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: mark stack in assembly files read-onlyLudwig Nussel2022-08-306-0/+18
| | | | | | | | | | Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fix [ --help ] and [[ --help ]]Denys Vlasenko2022-08-301-0/+3
| | | | | | | | | | | | | | function old new delta show_usage_if_dash_dash_help 72 79 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: style fixDenys Vlasenko2022-08-3013-52/+52
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: optional sleep builtinShawn Landden2022-08-274-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta sleepcmd - 10 +10 builtintab 352 360 +8 .rodata 105264 105271 +7 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes Signed-off-by: Shawn Landden <shawnlandden@tutanota.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * devmem: add 128-bit widthAaro Koskinen2022-08-261-24/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add 128-bit width if the compiler provides the needed type. function old new delta devmem_main 405 464 +59 .rodata 109025 109043 +18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tree: unicode tweak (use normal space char, 0x20)Denys Vlasenko2022-08-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tree: make it unicode-awareDenys Vlasenko2022-08-261-3/+16
| | | | | | | | | | | | | | | | | | | | | | function old new delta tree_print 396 420 +24 .rodata 105251 105266 +15 tree_main 86 91 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 44/0) Total: 44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd -r: handle offsetsDenys Vlasenko2022-08-221-8/+50
| | | | | | | | | | | | | | | | | | | | function old new delta xxd_main 1076 1439 +363 .rodata 105239 105251 +12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 375/0) Total: 375 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd: add two more testcasesDenys Vlasenko2022-08-221-2/+16
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd -r: without -p, stop at more than one whitespace, closes 14786Denys Vlasenko2022-08-222-17/+48
| | | | | | | | | | | | | | function old new delta xxd_main 888 1076 +188 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: make '--help' handling more consistentRon Yorston2022-08-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running an applet with '--help' as its only argument is treated as a special case. If additional arguments follow '--help' the behaviour is inconsistent: - applets which call single_argv() print help and do nothing else; - applets which call getopt() report "unrecognized option '--help'" and print help anyway; - expr says "expr: syntax error" and doesn't print help; - printenv silently ignores '--help', prints any other variables and doesn't print help; - realpath says "--help: No such file or directory", prints the path of any other files and doesn't print help. If the first argument is '--help' ignore any other arguments and print help. This is more consistent and most likely what the user wanted. See also commit 6bdfbc4cb (libbb: fix '--help' handling in FEATURE_SH_NOFORK=y). function old new delta show_usage_if_dash_dash_help 75 69 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-6) Total: -6 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>