Anyone using FreeBSD?

@slh Thanks for the reply, although I'm not exactly sure what to make of it.

According to FreeBSD their version of getopt:

Rewrite of getopt(1) with the following features:

* It can do anything that the GNU getopt(3) routines can do.
* It can cope with spaces and shell metacharacters within arguments.
* It can parse long parameters.
* It can shuffle parameters, so you can mix options and other parameters
  on the command-line.
* It can be easily identified as an enhanced getopt(1) from within shell
  scripts.
* It can report parse errors as coming from the shell script.
* It compiles cleanly with both libc-5 and glibc-2.

Not really sure what to do in this case... however I have just noticed that renaming getopt to gnugetopt resolved the error.

If (Free)BSD getopt is sufficient, the best solution would be to modify the getopt detection to flag it as correct.

1 Like

Well, when I copy FreeBSD's getopt as gnugetopt, somewhere on the path, then things work, which suggests that it is sufficient. Although I'm not really sure what needs to be done.

@slh Unfortunately I can't understand the code in this test. Does it check for the presence of gnugetopt and fail if not present?

@slh I have just realised that FreeBSD has a builtin getopt, but there is also a FreeBSD pkg misc/getopt which is the one that needs to be used, so adding the line

/usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \

sorts things out.

If that works for you, please follow https://openwrt.org/submitting-patches, to get it merged into master.

1 Like

I'd just like to report that after running my script over and over many times, I have actually got as far an OpenWrt Configuration menu, so I'm very pleased with progress. Now to learn how to use it!

@slh I created a patch:-

--- include/prereq-build.mk<--->2021-12-03 21:03:44.406974000 +0000
+++ include/prereq-build.mk-FreeBSD-getopt<---->2021-12-03 21:56:19.603555000 +0000
@@ -130,6 +130,7 @@
 <----->Please install an extended getopt version that supports --long, \
 <----->gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
 <----->getopt -o t --long test -- --test | grep '^ *--test *--', \
+<----->/usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
 <----->/usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
.
 $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \

but submitting it is something I can't figure out, although I doubt I would be able to