From a5418d62f79f7d59f6b0a7efc88dcd7e99c8248a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Oct 2023 07:22:00 +0200 Subject: WIP: install: file_rule::reapply_impl() --- libbuild2/cc/install-rule.cxx | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'libbuild2/cc') diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx index fff3bdf..f6e6b71 100644 --- a/libbuild2/cc/install-rule.cxx +++ b/libbuild2/cc/install-rule.cxx @@ -259,7 +259,9 @@ namespace build2 } } - recipe r (file_rule::apply_impl (a, t, me)); + recipe r (file_rule::apply_impl ( + a, t, me, + me.cur_options != match_extra::all_options /* reapply */)); if (r == nullptr) { @@ -326,26 +328,34 @@ namespace build2 << ' ' << me.cur_options << ' ' << me.new_options; // @@ TMP - // If we are rematched with the buildtime option, propagate it to our - // prerequisite libraries. + me.cur_options |= me.new_options; + + // We also need to update options in install_match_data. // + t.data (a).options = me.cur_options; + if ((me.new_options & lib::option_install_buildtime) != 0) { + // If we are rematched with the buildtime option, propagate it to our + // prerequisite libraries. + // for (const target* pt: t.prerequisite_targets[a]) { if (pt != nullptr && (pt->is_a () || pt->is_a () || pt->is_a () || pt->is_a ())) - rematch_sync (a, *pt, lib::option_install_buildtime); + { + // Go for all options instead of just install_buildtime to avoid + // any further relocking/reapply (we only support runtime-only or + // everything). + // + rematch_sync (a, *pt, match_extra::all_options); + } } - } - - // @@ TODO: match additional prerequisites if required. - - me.cur_options |= me.new_options; - // We also need to update options in install_match_data. - // - t.data (a).options = me.cur_options; + // Also match any additional prerequisites (e.g., headers). + // + file_rule::reapply_impl (a, t, me); + } } bool install_rule:: -- cgit v1.1