Open MartinHusemann opened 4 years ago
Which systems are you concerned about? Is argp the only issue to port F3 to these systems?
If we decide to go down this route, would there be any change in the way the parameters are used?
I am using NetBSD and did not do a full port yet as I was trying to find out whats the minimal change and argp kills compilation right away. NetBSD should be close enough to FreeBSD and libusb is supported, so I don't expect many other obstacles.
Completly replacing argp basically means moving the code inside the parse_opt() callback into the caller of argp_parse(), which is replaced by a loop around getopt(3) or getopt_long(3).
Are you trying to port only f3write
and f3read
? Or are you planning to port the other tools (e.g. f3probe
)? I'm asking because f3write
and f3read
do not use libusb. The other tools are more demanding to port.
Yeah, I'm aware the former two are easy and the others harder - was going to see how far I get, but definitively want to try f3probe too.
If you want, we can try a pull request to patch only f3write
and f3read
. Thus, we leave the other tools for when you have a chance to get them working. This should also simplify the review of this first pull request. If you are going to write this pull request, please remember to update the documentation as needed.
I'm also interested in this. On FreeBSD f3probe is not installed, but f3write and f3read are. It looks like f3probe uses linux/fs.h which is why.
I want to use this on armv7l and aarch64 systems using MUSL as the libc. This is really hard when you use glibc-isms. Please progress this issue.
I was able to cross-compile on x86_64-GNU for i486-musl by using this library:
https://github.com/ericonr/argp-standalone
It was a little tricky getting the library built and installed; the autotools didn't work for me so I just ran the commands manually but it's not too complicated and it worked. I can post more details if you need them.
Would a pull request that replaces the glibc specific argp functions with plain posix functions be accepted?
Alternatively, a pull request that #ifdefs them and provides alternatives for systems not implementing them (so Linux would use argp, but others getopt/strtol and what have you)?
The former would be a lot cleaner and not obfuscate the code as much.