[Toybox] FreeBSD support.
Rob Landley
rob at landley.net
Tue Jan 8 17:46:16 PST 2019
On 1/8/19 7:25 PM, Ed Maste wrote:
> On Tue, 8 Jan 2019 at 20:07, Rob Landley <rob at landley.net> wrote:
>>
>> The 5th is expecting /usr/bin/env to be at an absolute
>> path but not /bin/bash, which... how is one more trustworthy than the other?
>
> Yep, I don't have a very convincing answer for why /usr/bin/env is
> better than /bin/bash, other than in practice it seems all relevant
> systems have /usr/bin/env, and not all have /bin/bash.
(Assuming you're not going to run bloatcheck.)
> I'm not sure of a great way to handle this, other than renaming files
> to .sh.in and having a build step that replaces some sort of @BASH@
> sentinel with #!/bin/bash or #!/usr/local/bin/bash as appropriate.
sed -i '1s@^#!/bin/bash$@#!/path/to/bash@' scripts/*.sh
(Assuming you're not going to run bloatcheck, which doesn't have an sh extension
for historical reasons, which would be trivial to fix...)
>> Other than that, Ed says:
>>
>>> With this change I can build these posix toys:
>>> ...
>>
>> Which sounds a bit like where MacOS left off. I think I need some sort of "make
>> macos_defconfig" and "make freebsd_defconfig" targets pulling in relevant
>> default configurations. (Which should be separate files rather than trying to
>> annotate every command with which targets can build it; that way lies madness,
>> as gentoo discovered)...
>
> Yeah, that sounds good to me - I'm happy to put together a default
> config file for FreeBSD (.config.FreeBSD?), and then update it along
> with other future changes that improve FreeBSD support.
Possibly kconfig/freebsd_miniconfig and I can add some makefile plumbing...
(Sigh, config's design is a mess. I need to rewrite the kconfig plumbing to not
use the kernel stuff and then wean more stuff off of "make"... Endless todo
items and I spent most of my holiday break watching netflix and playing merge
dragons. I may have had a backlog of stress...)
> In addition to the #!/bin/bash workaround I have another local change
> now, in order to get tests to start running: in scripts/single.sh and
> scripts/test.sh I changed 'make' to 'gmake' and 'sed' to 'gsed' to get
> the GNU versions.
There's already a $SED variable, the problem is calling the test at a common
place and propagating it down to the users. (Right now it's at the top of
scripts/make.sh which scripts/runtest.sh doesn't use...) I should factor that
out into a scripts/portability.sh...
>> but I've _almost_ got working BSD versions on more than one occasion. (With help
>> from Randi Harper and Kirk McKusick over the years, and it still didn't _quite_
>> work, but I can try again...)
>
> I'm happy to help get your VM set up as well - and the FreeBSD project
> makes prebuilt VM images available if you like.
I'm happy to follow instructions here.
Rob
More information about the Toybox
mailing list