aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-02-22 08:28:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-02-22 08:28:35 +0200
commit13840225f01b5000e726b27ad2cca1f4837e0a4d (patch)
tree0ac43a1496c2ecfb27912165d11dae293e58268c /libbuild2
parent73386de65fd49e7690da5203074a5ea603551db6 (diff)
Deal with libs{} being member of group in windows_rpath_timestamp()
Fixes GH issue #366.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/algorithm.cxx1
-rw-r--r--libbuild2/cc/windows-rpath.cxx15
-rw-r--r--libbuild2/target.hxx12
3 files changed, 20 insertions, 8 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 36d45b2..7fde2a9 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -2840,7 +2840,6 @@ namespace build2
// s.recipe_group_action may be used further (see, for example,
// group_state()) and should retain its value.
//
- //
if (!s.recipe_keep)
s.recipe = nullptr;
diff --git a/libbuild2/cc/windows-rpath.cxx b/libbuild2/cc/windows-rpath.cxx
index bd5a928..eb62ad1 100644
--- a/libbuild2/cc/windows-rpath.cxx
+++ b/libbuild2/cc/windows-rpath.cxx
@@ -45,6 +45,8 @@ namespace build2
// Return the greatest (newest) timestamp of all the DLLs that we will be
// adding to the assembly or timestamp_nonexistent if there aren't any.
//
+ // Note: called during the execute phase.
+ //
timestamp link_rule::
windows_rpath_timestamp (const file& t,
const scope& bs,
@@ -88,7 +90,18 @@ namespace build2
//
if (l->is_a<libs> () && !l->path ().empty ()) // Also covers binless.
{
- timestamp t (l->load_mtime ());
+ // Handle the case where the library is a member of a group (for
+ // example, people are trying to hack something up with pre-built
+ // libraries; see GH issue #366).
+ //
+ timestamp t;
+ if (l->group_state (action () /* inner */))
+ {
+ t = l->group->is_a<mtime_target> ()->mtime ();
+ assert (t != timestamp_unknown);
+ }
+ else
+ t = l->load_mtime ();
if (t > r)
r = t;
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index b97d562..0d4eece 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -1058,6 +1058,12 @@ namespace build2
target_state
executed_state (action, bool fail = true) const;
+ // Return true if the state comes from the group. Target must be at least
+ // matched except for ad hoc group members during the execute phase.
+ //
+ bool
+ group_state (action) const;
+
protected:
// Version that should be used during match after the target has been
// matched for this action.
@@ -1074,12 +1080,6 @@ namespace build2
target_state
executed_state_impl (action) const;
- // Return true if the state comes from the group. Target must be at least
- // matched except for ad hoc group members during the execute phase.
- //
- bool
- group_state (action) const;
-
public:
// Targets to which prerequisites resolve for this action. Note that
// unlike prerequisite::target, these can be resolved to group members.