Actually, perhaps the best way would be to use a custom build using csm to build the components of the egg. A little bit of inventiveness might be required, but I think it should be possible.
This would make the egg depend on csm. I don't mind this for programs, but for eggs that are just libraries, isn't this a bit "opinionated" / heavy given that all the build steps (apart from the import groveling) can be done using the current chicken-install?
Perhaps the csm groveler could be extracted into a library? Perhaps it could even be shipped in chicken-core at some point, since after all Chicken has to be able to trace all imports and includes in order for the compiler and interpreter to work.
I added a "-compile-imports" to csm today to force import libs to be compiled, which may be a start. Perhaps we can cover this particular scenario without too much extra effort.
This is above my paygrade :) I'll try to understand the patch.