[Toybox] FreeBSD porting, removing bashisms

Ed Maste emaste at freebsd.org
Tue Jan 8 12:17:21 PST 2019


On Tue, 29 Mar 2016 at 15:58, Ed Maste <emaste at freebsd.org> wrote:
>
> I'm interested in seeing a FreeBSD port of toybox. I see in the
> archives that this has been discussed in the past but I didn't find
> any real progress. I wonder if others are (still) interested in a
> FreeBSD port?

A quick update, I opened a pull request against landley/toybox for
initial FreeBSD support -- https://github.com/landley/toybox/pull/113.

This has four changes:
b791437c Use #!/usr/bin/env so bash does not need to be in /bin
In practice env is universally available as /usr/bin/env, while bash
is not always /bin/bash.

063d1ffe Add FreeBSD endianness support
Use FreeBSD endian.h header location and constants

b7af709b FreeBSD will use the getmntinfo API as with Apple
gntmntinfo isn't implemented for __APPLE__ yet, but when it is FreeBSD
should use the same path

88450840 Workarounds for building on FreeBSD
Two quick "#ifndef __FreeBSD__" hacks around a header and constant not
available on FreeBSD - to be revisited if/when adding some of the
other toys.

With those changes these POSIX toys will build:

basename cal cat catv chgrp chmod chown cksum cmp comm cpio crc32
cut date dirname du egrep expand false fgrep file find grep groups
head iconv id kill killall5 link logger logname ls mkdir mkfifo nice
nl nohup od paste patch printf pwd renice rm rmdir sed sleep sort
split strings tee test time touch true tty uname uniq unlink uudecode
uuencode wc who whoami xargs

These POSIX toys are mssing:

cp mv install df getconf ln ps top iotop pgrep pkill tail

I haven't looked at non-POSIX toys again (since the previous FreeBSD
discussion some years ago).


More information about the Toybox mailing list