bootstrap: support target specific config overrides

This commit is contained in:
Weihang Lo 2024-05-24 15:20:20 -04:00
parent 213ad10c8f
commit 9185ddb019
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -644,7 +644,20 @@ fn do_merge<T: Merge>(x: &mut Option<T>, y: Option<T>, replace: ReplaceOpt) {
do_merge(&mut self.llvm, llvm, replace);
do_merge(&mut self.rust, rust, replace);
do_merge(&mut self.dist, dist, replace);
assert!(target.is_none(), "merging target-specific config is not currently supported");
match (self.target.as_mut(), target) {
(_, None) => {}
(None, Some(target)) => self.target = Some(target),
(Some(original_target), Some(new_target)) => {
for (triple, new) in new_target {
if let Some(original) = original_target.get_mut(&triple) {
original.merge(new, replace);
} else {
original_target.insert(triple, new);
}
}
}
}
}
}