Why the need to separately compile aarch64 and x86_64?
We are working on a project and while we were trying to create a config-wrapper we had a doubt about why it is necessary to compile both architectures separately if in the end we will have a single binary. Considering that the cosmopolitan README instructions say that cosmocc generates an APE for you, why does superconfigure compile separately and then put them together?
cosmocc generating an APE works quite well for projects that don't make too many checks about the host system: for example lang/lua can be built by setting CC=cosmocc.
However, some larger projects (for example gnutls, python) may request some specific details about the host compiler and target architecture, because they may have some architecture-specific ASM or optimizations. IIRC some of packages even compile different files depending on what architecture is being targeted.
The build steps for such packages error out if CC=cosmocc is provided (assume x86_64 at config time, but aarch64 at build time etc.). Thus we run a build for each architecture and then combine via apelink.
The process used in this repo precedes cosmocc, and is also more flexible: we can handle arch-specific differences in a straightforward manner for each step of the build process.
In case one has a project were the difference is not relevant, which recipe should take as an starting point? lang/lua/BUILD.mk ?
Is there any superconfigure subproject currently delegating all this to cosmocc?
Is there any superconfigure subproject currently delegating all this to
cosmocc?
No, every project in this repo builds x86_64 and aarch64 separately, and combines via apelink.
In case one has a project were the difference is not relevant, which recipe should take as an starting point?
I'd recommend building for each arch separately, like the recipes here, because it is easier to test.
For a build using just cosmocc, you don't need this whole repo, just cosmocc.zip. As an example, you can download the Lua source, set CC=cosmocc and run make to get a build.