How to clone submodule during build?

You need the submodules to be available before the make phase, so you must initialize them during the configure phase. addSystemCommand creates a step that executes during the make phase of the build process, not during the configure phase. Fortunately, there is b.run which runs during the configure phase.