[Toybox] Out of tree build support

Rob Landley rob at landley.net
Tue Dec 19 14:24:53 PST 2017


On 12/18/2017 07:49 PM, Patrick Oppenlander wrote:
> On 19/12/17 10:41, Rob Landley wrote:
> That's a nasty chicken-and-egg problem indeed. I just thought you hated
> make :)

Oh I do. But I tend to have programming opinions for a reason. :)

>> 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.

Which is more build dependencies, and the parsing gets nontrivial.

Really what I need to do is come up with a way to build toybox sed and
toysh standalone from a canned script with no config step, and then
build the rest with that.

(See also "make install_airlock".)

Speaking of which, did I ever point you at the cp -s trick?

  $ cp -rs "$PWD"/toybox walrus
  $ cd walrus
  $ make distclean && make defconfig && make

(I taught toybox to work with relative rather than absolute paths. The
gnu/dammit version complains about relative paths, and yes that means
even "cp -rs toybox walrus" won't work unless you're using toybox cp.
It's because they don't bother to calculate the dynamic ../ stack.)

> 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?).

Blah, "make baseline" is putting it in generated/unstripped but it looks
like "make bloatcheck" is still expecting it at the top level. [fixed]

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

One of my todo items is writing a new kconfig to replace the kernel
plumbing I borrowed way back when. (Which is from 2.6.12.)

> I've pushed the current state of affairs to
> https://github.com/pattop/toybox if you're interested in taking a look.

Hmmmm... I see what you're doing, but you're adding complexity to the
Makefile and I want to strip it out and move it into the scripts.

> 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.

I seem to be, but I think I've been cc'd on everything the past couple
days anyway?

Rob



More information about the Toybox mailing list