[Toybox] [PATCH] Generate all build files with single program.
Rob Landley
rob at landley.net
Sun Mar 18 09:55:06 PDT 2012
On 03/18/2012 11:14 AM, Georgi Chorbadzhiyski wrote:
> On 3/17/12 4:57 AM, Rob Landley wrote:
>> On 03/16/2012 05:05 PM, Georgi Chorbadzhiyski wrote:
>>> This patch removes all external tools from the build system. Now
>>> everything in generated/ directory is build with single program.
>>> The effect is that the build no longer requires sed, tr, sort and
>>> python (for rebuilding the help texts). There is no need to ship
>>> generated/help.h since it can be rebuild on the host without python.
>>
>> Cool!
>>
>> Generating help.h in C (and eliminating the need for python) is
>> something I've been meaning to do for a while. But building the list of
>> C files to compile... in C... seems unnecessarily brittle somehow.
>
> No more than the sed usage (which I was unable to simplify and this is
> was drove me to make the C version).
I'm a bit biased because I wrote the busybox sed implementation. (And
string handling in C is pretty inherently brittle...)
>>> +void generate_headers(int argc, char **argv) {
>>> + // Parse toys
>>> + strbuf_add(&newtoys_h, "NEWTOY(toybox, NULL, 0)\n");
>>> + strbuf_add(&globals_union, "extern union global_union {\n");
>>
>> It matters that these be in alphabetical order (for the binary search),
>> and we can't depend on the filesystem doing it for us. Where are you
>> sorting this?
>
> I didn't sort them. I depend on the shell doing the right thing. The
> program
> is called like this generated/genconf toys/*.c so it should be OK. Of
> course
> the parameters can be sorted but it seemed unnecessary since the shell is
> doing that for us.
Actually the shell isn't. The filesystem is. (I've hit this one
before, it's not reliable.)
Also, sorting the .c files isn't sufficient, you have to sort the
_output_ array, because one .c file can produce more than one array
entry (sh and toysh, netcat and nc...)
Rob
--
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation. Pick one.
1332089706.0
More information about the Toybox
mailing list