[Toybox] Out of tree build support

Patrick Oppenlander pattyo.lists at gmail.com
Mon Dec 18 17:49:45 PST 2017


On 19/12/17 10:41, Rob Landley wrote:
> On 12/18/2017 03:57 PM, Patrick Oppenlander wrote:
>> Hi Rob,
>>
>> are you open to accepting patches for building out of tree?
>>
>> I am working on a project where Toybox will be part of an automated
>> build system, and this would make life a lot easier.
>>
>> Patrick
> 
> It's one of my todo list items, but there's backstory:
> 
> I've tried to make it so scripts/make.sh can be run separately (not via
> the Makefile, that should be an essentially cosmetic wrapper around the
> script-based build infrastructure). (In theory this means you can build
> it on systems that haven't got a functional "make" yet. I have another
> todo item to have a scripts/defconfig that populates generated/*.sh with
> absolutely minimal dependencies, working even with apple's broken sed...)

That's a nasty chicken-and-egg problem indeed. I just thought you hated make :)

> I also have a "configure" file where you can persistently set default
> values for overrideable build options. This is in shell syntax rather
> than Makefile syntax so only the shell scripts import it, if I import it
> from the Makefile it gets confused by the "[ -z "$BLAH" ] && BLAH=" syntax.

I have another project which has the same problem, but it also needs the variables available for 'ld' to use in link scripts. The only workable solution I know of is to have a config file which is processed by a script to generate config.mk, config.ld, config.sh and config.h which can be included as required.

I may be able to hack something together at some point in the future if you're at all interested in this idea.

> (The build has three conflicting use cases, which affect the
> environmental dependencies and expected command line user interface. 1)
> Conventional "configure/make/install" using gmake. 2) Portable build not
> depending on anything toybox doesn't itself provide (building on BSD and
> such). And android's doing ninja, which I should have support for but
> ninja is a moving target, the one 14.4 installs doesn't work at all for
> android...)

Nasty indeed.

I have done some hacking on the scripts. This currently works:

mkdir /tmp/toybox_build
make -C /tmp/toybox_build -f ~/src/ext/toybox/Makefile defconfig
make -C /tmp/toybox_build -f ~/src/ext/toybox/Makefile

So does this:

mkdir /tmp/toybox_build
make -C /tmp/toybox_build -f ~/src/ext/toybox/Makefile defconfig
cd /tmp/toybox_build && ~/src/ext/toybox/scripts/make.sh

So do other targets (like tests, etc). bloatcheck looks to be broken on trunk at the moment (incorrect dep on toybox_old?).

How do you intend to do the defconfig step using scripts?

I've pushed the current state of affairs to https://github.com/pattop/toybox if you're interested in taking a look. The symlinks in kconfig are a bit nasty (they really should go in the build directory to avoid polluting the source dir, but as they're always the same...). I got this working with vpaths earlier but wasn't too thrilled with the result.

CC'ing you as I don't seem to be getting list emails at the moment.

Patrick



More information about the Toybox mailing list