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"? > 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... > 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 _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net