Using download.mk to handle compilation artifacts?

I am working on rust-lang toolchain package that generates distribution .xz files, that I then .xz into a HOST and TARGET.

The rust-1.57.0.tar.xz is the repo, with the other two being the generated artifacts.

I need to figure out a way to:

  1. Check to see if rustc and cargo are installed, Have the build system detect the presence of the artifacts for the given HOST/TARGET and use those (extracting to $(STAGING_DIR_HOST) rather than run the re-compile (which takes a stupid long time).

  2. Provisions for validating the archives using download.mk?

  3. Other things that I'm overlooking or don't know to ask about?

I feel like this is being more difficult than it should be, so I'm assuming I'm just missing the easy way.

Isn't this the same situation for llvm-bpf-13.0.0.Linux-x86_64.tar.xz (and its other target variants)? There clang can be dropped into the build toolchain manually (instead of relying on your distribution's, potentially outdated or missing, clang/ llvm toolchain needed for building bpf/ quosify).

The eBPF LLVM isn't the same, and the one that ships with rust-lang has additional enhancements. Plus, the entire build system is setup to use the built-in one, I'm not sure how easy it would be to point it elsewhere, and change the eBPF package to be correct.

This question came up earlier on and the grand consensus was to keep it separate. So, I went in that direction. I am open to suggestions, as always.

Edit: Ideally, the way I have it setup makes rust-lang modular, which is important for those who run multiple arches and targets. Separating the Host from the Target lets me extract the HOST distro artifacts into STAGING_DIR_HOST and then layer whatever the target arch is on top. Multiple targets can be layered without needing to recompile unless the rust-lang package changes. It'll just see if the TARGET file is there, and build it if not, store, install, and the next time, it just extracts.