Skip to content

Commit 39e41d1

Browse files
authored
[Runner] Set CARGO_BUILD_JOBS environment variable to nproc (#190)
1 parent 15d8ce0 commit 39e41d1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Runner.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
575575
"NM" => "$(host_target)-nm",
576576
"OBJC" => "$(host_target)-cc",
577577
"RANLIB" => "$(host_target)-ranlib",
578-
# Needed to find pkg-config files for the host: https://mesonbuild.com/Reference-tables.html#environment-variables-per-machine
578+
# Needed to find pkg-config files for the host: https://mesonbuild.com/Reference-tables.html#environment-variables-per-machine
579579
"PKG_CONFIG_PATH_FOR_BUILD" => "$(host_prefix)/lib/pkgconfig:$(host_prefix)/lib64/pkgconfig:$(host_prefix)/share/pkgconfig",
580580
)
581581
wrapper(io, "/usr/bin/meson"; allow_ccache=false, env=meson_env)
@@ -889,6 +889,9 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
889889
PS1 = raw"sandbox:${PWD//$WORKSPACE/$\{WORKSPACE\}} $ "
890890
end
891891

892+
# Number of parallel jobs to use for builds
893+
nproc = "$(get(ENV, "BINARYBUILDER_NPROC", Sys.CPU_THREADS))"
894+
892895
# Base mappings
893896
mapping = Dict(
894897
# Platform information (we save a `bb_target` because sometimes `target` gets
@@ -899,7 +902,7 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
899902
"bb_full_target" => triplet(platform),
900903
"rust_target" => map_rust_target(platform),
901904
"rust_host" => map_rust_target(host_platform),
902-
"nproc" => "$(get(ENV, "BINARYBUILDER_NPROC", Sys.CPU_THREADS))",
905+
"nproc" => nproc,
903906
"nbits" => string(nbits(platform)),
904907
"proc_family" => string(proc_family(platform)),
905908
"dlext" => platform_dlext(platform),
@@ -950,7 +953,6 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
950953
end
951954
end
952955

953-
954956
# Go stuff
955957
if :go in compilers
956958
merge!(mapping, Dict(
@@ -966,6 +968,7 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
966968
merge!(mapping, Dict(
967969
"RUSTC" => "rustc",
968970
"CARGO" => "cargo",
971+
"CARGO_BUILD_JOBS" => nproc,
969972
"CARGO_BUILD_TARGET" => map_rust_target(platform),
970973
"CARGO_HOME" => "/opt/$(host_target)",
971974
"RUSTUP_HOME" => "/opt/$(host_target)",

0 commit comments

Comments
 (0)