File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ declare -g RUST_TOOL_SYSROOT=""
5151function add_host_dependencies__add_rust_compiler() {
5252 display_alert " Adding Rust kernel build dependencies" " ${EXTENSION} " " info"
5353 # bindgen needs libclang for dlopen; available on all target distros.
54+ # NB: do NOT pre-pull llvm-dev into an earlier layer to "split" this — measured, llvm-dev is a
55+ # superset far larger than what libclang-dev needs (~+560MB total, bigger max layer). Keep
56+ # libclang-dev as a single ~633MB 'clang' layer instead.
5457 EXTRA_BUILD_DEPS+=(" clang::libclang-dev" )
5558}
5659
Original file line number Diff line number Diff line change 1414
1515function add_host_dependencies__mtkflash() {
1616 display_alert " Preparing mtkflash host-side dependencies" " ${EXTENSION} " " info"
17- EXTRA_BUILD_DEPS+=(" native-toolchain::rustc" " native-toolchain::cargo" " native-toolchain::build-essential" )
17+ # rustc/cargo pull the bulky libstd-rust-dev; keep them in their own 'rust' layer (after
18+ # native-toolchain, so the shared gcc/build-essential stay in native-toolchain).
19+ EXTRA_BUILD_DEPS+=(" rust::rustc" " rust::cargo" " native-toolchain::build-essential" )
1820}
1921
2022function extension_finish_config__900_mtkflash() {
Original file line number Diff line number Diff line change @@ -273,7 +273,11 @@ function docker_create_dockerfile_apt_install_runs() {
273273
274274 # Preferred layer order: heaviest/most-stable first, so they stay cached longest.
275275 # Any unknown (e.g. extension-defined) group is appended after, in first-seen order.
276- declare -a preferred_order=(clang qemu cross-other cross-amd64 cross-arm64 cross-armhf native-toolchain build-tools imaging python fs-tools core)
276+ # NOTE on ordering: groups that explicitly pre-install a heavy *shared* dependency of a later
277+ # group must come first, so that dependency lands in their (smaller, parallel-pullable) layer
278+ # instead of inflating the later one. Specifically: 'llvm' before 'clang' (llvm-dev is the bulk
279+ # of libclang-dev), and 'native-toolchain' before 'rust' (so gcc stays in native-toolchain).
280+ declare -a preferred_order=(llvm clang qemu cross-other cross-amd64 cross-arm64 cross-armhf native-toolchain rust build-tools imaging python fs-tools core)
277281 declare -a final_order=()
278282 for group in " ${preferred_order[@]} " ; do
279283 [[ -n " ${group_pkgs[${group}]:- } " ]] && final_order+=(" ${group} " )
Original file line number Diff line number Diff line change @@ -280,8 +280,10 @@ function adaptative_prepare_host_dependencies() {
280280 fi
281281
282282 if [[ " ${KERNEL_COMPILER} " == " clang" ]]; then
283+ # llvm goes in its own (earlier) layer; clang/lld depend on libllvm, so splitting it out
284+ # keeps the clang layer smaller and gives llvm its own parallel-pullable layer.
285+ host_dependencies+=(" llvm::llvm" )
283286 host_dependencies+=(" clang::clang" )
284- host_dependencies+=(" clang::llvm" )
285287 host_dependencies+=(" clang::lld" )
286288 fi
287289
You can’t perform that action at this time.
0 commit comments