[Toybox] macOS sitrep
enh
enh at google.com
Tue Dec 4 17:06:36 PST 2018
okay, so now toybox builds out of the box (with a custom .config) i
added a bunch more stuff to my .config. the following were all
painless:
ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
comm count cpio crc32 cut dirname dos2unix du echo egrep env expand
factor false fgrep file flock fmt ftpget ftpput grep groups head help
hexedit hostname iconv id kill killall5 link ln logname md5sum microcom
mkdir mkfifo mktemp nc netcat nice nl nohup od paste patch printenv
printf pwd pwdx readlink realpath renice rev rm rmdir sed seq setsid
sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split strings
tac tee timeout true truncate tty uname uniq unix2dos unlink usleep
uudecode uuencode uuidgen w watch wc which who whoami xargs xxd yes
(i haven't even bothered trying anything from pending.)
On Fri, Nov 30, 2018 at 4:50 PM enh <enh at google.com> wrote:
>
> On Fri, Nov 30, 2018 at 4:41 PM Rob Landley <rob at landley.net> wrote:
> >
> > On 11/30/18 4:46 PM, enh via Toybox wrote:
> > > so, if you merge this afternoon's patches, you can build toybox for
> > > macOS. with two provisos:
> > >
> > > 1. i'm only talking about a very limited .config, that's basically
> > > "the easy parts of the subset needed by the AOSP build". specifically:
> > >
> > > CONFIG_TOYBOX_ICONV=y
> > > CONFIG_TOYBOX_UTMPX=y
> > > CONFIG_TOYBOX_FORK=y
> > > CONFIG_BASENAME=y
> > > CONFIG_CAT=y
> > > CONFIG_CHMOD=y
> > > CONFIG_CMP=y
> > > CONFIG_COMM=y
> > > CONFIG_CUT=y
> > > CONFIG_DIRNAME=y
> > > CONFIG_DU=y
> > > CONFIG_ECHO=y
> > > CONFIG_FALSE=y
> > > CONFIG_FILE=y
> > > CONFIG_GREP=y
> > > CONFIG_EGREP=y
> > > CONFIG_FGREP=y
> > > CONFIG_HEAD=y
> > > CONFIG_ID=y
> > > CONFIG_WHOAMI=y
> > > CONFIG_LN=y
> > > CONFIG_MKDIR=y
> > > CONFIG_OD=y
> > > CONFIG_PASTE=y
> > > CONFIG_PATCH=y
> > > CONFIG_PWD=y
> > > CONFIG_RM=y
> > > CONFIG_RMDIR=y
> > > CONFIG_SED=y
> > > CONFIG_SLEEP=y
> > > CONFIG_SLEEP_FLOAT=y
> > > CONFIG_SORT=y
> > > CONFIG_SORT_BIG=y
> > > CONFIG_SORT_FLOAT=y
> > > CONFIG_TAIL_SEEK=y
> > > CONFIG_TEE=y
> > > CONFIG_TRUE=y
> > > CONFIG_UNAME=y
> > > CONFIG_UNIQ=y
> > > CONFIG_WC=y
> > > CONFIG_XARGS=y
> > > CONFIG_DOS2UNIX=y
> > > CONFIG_UNIX2DOS=y
> > > CONFIG_HELP=y
> > > CONFIG_HELP_EXTRAS=y
> > > CONFIG_READLINK=y
> > > CONFIG_REALPATH=y
> > > CONFIG_SETSID=y
> > > CONFIG_TIMEOUT=y
> > > CONFIG_XXD=y
> > > CONFIG_HOSTNAME=y
> > > CONFIG_MD5SUM=y
> > > CONFIG_SHA1SUM=y
> > > CONFIG_MKTEMP=y
> > > CONFIG_TOYBOX=y
> > > CONFIG_TOYBOX_SUID=y
> > > CONFIG_TOYBOX_LSM_NONE=y
> > > CONFIG_TOYBOX_FLOAT=y
> > > CONFIG_TOYBOX_HELP=y
> > > CONFIG_TOYBOX_HELP_DASHDASH=y
> > > CONFIG_TOYBOX_I18N=y
> >
> > Easiest thing might be to put that in a file and have a "make mac_defconfig"?
>
> up to you. if i'm the only user, it doesn't even matter. i'm guessing
> it's been years since the last person tried to build for macOS, so
> it'll probably be years before the next one too.
>
> > > i'm not sure what we want to do about that long-term. add `depends on
> > > TOYBOX_LINUX` to all the stuff like dmesg that's never going to work?
> > > (and probably to the "too much work for anyone to care" stuff like ps
> > > too.)
> >
> > I might reopen the ps can of worms for bsd, or if darwin became an actual
> > runnable thing, but probably not for a proprietary OS. :)
> >
> > > 2. lib/getmountlist.c doesn't compile. i have #ifndef __APPLE__ ...
> > > #endif around the whole file locally. macos seems to have a wholly
> > > different API, getmntinfo(3).
> >
> > Thank you _ever_ so much, Posix.
> >
> > > if/when i get around to porting toybox
> > > stat(1) to macOS i might have to fix this properly, but for now i'm
> > > punting. (df isn't used by AOSP and mount/umount seem to be in the
> > > "probably not worth it" territory mentioned in #1.)
> >
> > I ranted about that in the posix section of roadmap.html. I tried to figure out
> > a proper way to do it and there isn't one. But there's a reason it _doesn't_
> > return struct mntent, and that's also why I broke commas.c out from that file
> > when it started getting more generically used.
> >
> > It might be best to just move the remaining 3 mntent functions into portability.c...
>
> oops, speaking of which i've just sent you one more patch removing
> unneeded macOS < 10.7 workarounds.
>
> i'm heading home now, but i can move these into lib/portability.c on
> monday if you don't beat me to it over the weekend.
>
> > > things like struct stat and struct statfs turn out to be quite
> > > different on macOS. but that's a problem for another day.
> > > ______________________________________________
> >
> > In theory, stat has a posix subset. Dunno if dirtree adheres to it, though. (But
> > openat() is posix-2008!) And there's a posix statvfs too:
> >
> > http://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/statvfs.h.html
> >
> > I've tried not to be _gratuitously_ linux-specific. But there are large chunks
> > of things that just haven't got portable APIs. :(
> >
> > Rob
More information about the Toybox
mailing list