Iād suggest doing it in a jail, as some of the GNU variants can break other operations in unexpected ways.
User will likely need to be running bash, not just in the path.
Some fancy linking will likely be needed to run binutils, dtc, and the like for development work. Same for mounting and manipulation of file systems, especially on FreeBSD 11 and prior.
Then do yourself a favor in advance and only try this on a throw-away VM or in a dedicated jail. Getting the wrong binary during a system critical operation cal lead you into a world of hurt. /rescue/ may soon become a familiar place for you.
[jeff@freebsd-12 ~/devel/openwrt]$ ./scripts/feeds update packages
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git' ...
Already up to date.
Create index file './feeds/packages.index'
Checking 'working-make'... ok.
Checking 'case-sensitive-fs'... ok.
Checking 'proper-umask'... ok.
Checking 'gcc'... ok.
Checking 'working-gcc'... ok.
Checking 'g++'... ok.
Checking 'working-g++'... ok.
Checking 'ncurses'... ok.
Checking 'perl-thread-queue'... ok.
Checking 'tar'... ok.
Checking 'find'... ok.
Checking 'bash'... ok.
Checking 'patch'... ok.
Checking 'diff'... ok.
Checking 'cp'... ok.
Checking 'seq'... ok.
Checking 'awk'... ok.
Checking 'grep'... ok.
Checking 'getopt'... ok.
Checking 'stat'... ok.
Checking 'unzip'... ok.
Checking 'bzip2'... ok.
Checking 'wget'... ok.
Checking 'perl'... ok.
Checking 'python'... ok.
Checking 'git'... ok.
Checking 'file'... ok.
Prerequisite check failed. Use FORCE=1 to override.
gmake: *** [/usr/home/jeff/devel/openwrt/include/toplevel.mk:168: staging_dir/host/.prereq-build] Error 1
/bin/sh: mkhash: not found
/bin/sh: mkhash: not found
Pretty nasty.... I think we can safely say 11 is out the window....
after mkhash....
xz is broken, xzdec ( websearch stdendian.h ) + is not happy with the automake version!
then some success;
flock <> m4macros ( 5ish )
glib iconv errors....
gconvert.c:61:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv
#error GNU libiconv not in use but included iconv.h is from libiconv
^~~~~
gmake[11]: *** [Makefile:1373: libglib_2_0_la-gconvert.lo] Error 1
Your right though.... does get the build system partly going
After getting frustrated with my TP-LINK Archer MR200 v4 being unreliable I thought I'd try installing OpenWrt on it after seeing that an image was available:-
Unfortunately I didn't notice that this is only available for v1 of the device, so I'm looking for a v4 image, which I will have to build myself, so I'm checking if my FreeBSD OpenWrt build system still works. It's over 3 years since I last tried so I'm just seeing if it needs updating.
It looks like I no longer need GNU time, although I'm not sure if mkhash.c needs patching.
One error which crept in was the check for 'getopt' failed although it was OK three years ago.
Another error was the check for 'rsync' which passed earlier today but then failed. Not sure if that could have been due to the process running in a jail.
Looks like I omitted 'rsync' from my list of required apps. I was under the impression that it was part of the standard FreeBSD installation, but it looks as though I had already installed it previously when I put my script together.
So, as @jeff pointed out, I should have originally tested in a jail environment, which I am now doing.
Unfortunately I installed Midnight Commander before anything else which pulled in diffutils which is another pkg which ought to be added to the list of pkgs in a pristine environment.
I prefer using FreeBSD whenever I can. Linux is not an OS, it's a distribution of various apps into some flavour, all of which are different from each other without some consistancy as you can see from this list:-