Author: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon Aug 25 07:54:06 2025 +0100 feat: Add SAI_PARALLEL environment variable to build spawns This change introduces a `SAI_PARALLEL` environment variable into the build environment for both Windows and non-Windows platforms. This allows build scripts to reference this variable for parallel build operations, like `make -j ${SAI_PARALLEL}`. - The `sai_nspawn` struct is extended with an `int parallel;` member to hold the desired level of parallelism. - The build scripts (`runscript`) in `b-nspawn.c` are updated to export `SAI_PARALLEL`. - The value is determined by `ns->parallel`. If `ns->parallel` is 0, it defaults to 1 to ensure the variable is always set to a valid number. diff --git a/src/builder/b-nspawn.c b/src/builder/b-nspawn.c index 43e0a33..e60fbe8 100644 --- a/src/builder/b-nspawn.c +++ b/src/builder/b-nspawn.c @@ -269,6 +269,7 @@ fail: static const char * const runscript = "set SAI_INSTANCE_IDX=%d\n" + "set SAI_PARALLEL=%d\n" "set SAI_BUILDER_RESOURCE_PROXY=%s\n" "set SAI_LOGPROXY=%s\n" "set SAI_LOGPROXY_TTY0=%s\n" @@ -293,6 +294,7 @@ static const char * const runscript = "export SAI_PROJECT=%s\n" "export SAI_REMOTE_REF=%s\n" "export SAI_INSTANCE_IDX=%d\n" + "export SAI_PARALLEL=%d\n" "export SAI_BUILDER_RESOURCE_PROXY=%s\n" "export SAI_LOGPROXY=%s\n" "export SAI_LOGPROXY_TTY0=%s\n" @@ -411,12 +413,14 @@ saib_spawn_step(struct sai_nspawn *ns) #if defined(WIN32) n = lws_snprintf(st, sizeof(st), runscript, ns->instance_idx, + ns->parallel ? ns->parallel : 1, respath, ns->slp_control.sockpath, ns->slp[0].sockpath, ns->slp[1].sockpath, builder.home, ns->inp, one_step); #else n = lws_snprintf(st, sizeof(st), runscript, builder.home, ns->fsm.ovname, ns->project_name, ns->ref, ns->instance_idx, + ns->parallel ? ns->parallel : 1, respath, ns->slp_control.sockpath, ns->slp[0].sockpath, ns->slp[1].sockpath, builder.home, one_step); diff --git a/src/common/include/private.h b/src/common/include/private.h index 061e7cd..42fe44f 100644 --- a/src/common/include/private.h +++ b/src/common/include/private.h @@ -186,6 +186,7 @@ struct sai_nspawn { int retcode; int instance_idx; int mirror_wait_budget; + int parallel; uint8_t spins; uint8_t state; /* NSSTATE_ */