Description
Is your feature request related to a problem? Please describe.
While working on xmake-io/xmake-repo#7023 to add support to add a rust toolchain supporting generic cross compilation (cross plat), I needed to know the target ABI (gnueabi, gnueabihf, musleabi, musleabihf, gnu, ...) to know which rust target (precompiled standard library binaries) to install.
However I couldn't find any way, it seems only the compiler can give me the info using for example gcc -v
which gives me:
$ gcc -v
[...]
Target: arm-none-linux-gnueabihf
[...]
which I can extract to get the info, I have a working solution.
However, since the target system/ABI is a package config (required since it changes the installation steps), I need it in the package on_load callback, which means the package has to call the compiler in on_load callback which isn't ideal.
Describe the solution you'd like
I think the best way to handle this would be to have xmake gives a way to get the output of the compiler info (clang -v, GCC -v, etc.) and cache it.
Something like package:tool("cc"):info()
(or maybe "ld") that would run the appropriate info command.
A more complex approach would be to have xmake parse the target and extract the system/abi part itself.
Something like package:tool("cc"):targetsystem()
and package:tool("cc"):targetabi()
maybe.
Describe alternatives you've considered
Having the target system/abi as config for the package itself and letting the user do add_requireconfs("**.rust", { configs = { system = "unknown-linux", abi = "musleabihf" }})
but this is cumbersome for users since the compiler already has the info.
Additional context
No response