From 73c8c339c5c8fb468c4ddb1632d87d1aeb1cd497 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 24 Jun 2022 05:21:21 +0200 Subject: Match libraries before update for install prerequisites in cc::link_rule --- libbuild2/cc/link-rule.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 604d5b8..fff8716 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -914,7 +914,7 @@ namespace build2 // We do libraries first in order to indicate that we will execute these // targets before matching any of the obj/bmi{}. This makes it safe for // compile::apply() to unmatch them and therefore not to hinder - // parallelism. + // parallelism (or mess up for-install'ness). // // We also create obj/bmi{} chain targets because we need to add // (similar to lib{}) all the bmi{} as prerequisites to all the other @@ -1014,6 +1014,7 @@ namespace build2 const target*& pt (pto); // Mark (2 bits): + // // 0 - lib or update during match // 1 - src // 2 - mod @@ -1234,10 +1235,16 @@ namespace build2 mark (pt, m); } - // Match lib{} and update during match (the only unmarked) in parallel - // and wait for completion. + // Match lib{} first and then update during match (the only unmarked) in + // parallel and wait for completion. We need to match libraries first + // because matching generated headers/sources may lead to matching some + // of the libraries (for example, if generation requires some of the + // metadata; think poptions needed by Qt moc). // - match_members (a, t, pts, start); + match_members (a, t, pts, start, {2 /* mask */, 0 /* value */}); + + if (update_match) + match_members (a, t, pts, start, {2, 2}); // Check if we have any binful utility libraries. // -- cgit v1.1