diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-10-27 10:18:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-10-27 10:18:02 +0200 |
commit | 6712c585947af89275fba83066c510950be197b9 (patch) | |
tree | 368f18b33fc7a21d1c1fe6de4d9639804c4047a5 | |
parent | 77855794fa1b430635ca6b698a6d177bfc9298db (diff) |
WIP: install: don't install static library binary
-rw-r--r-- | libbuild2/cc/install-rule.cxx | 7 | ||||
-rw-r--r-- | libbuild2/install/rule.cxx | 12 | ||||
-rw-r--r-- | libbuild2/install/rule.hxx | 4 |
3 files changed, 15 insertions, 8 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx index 389a9ac..0065c0a 100644 --- a/libbuild2/cc/install-rule.cxx +++ b/libbuild2/cc/install-rule.cxx @@ -44,14 +44,15 @@ namespace build2 { if (!t.is_a<exe> ()) { - // If runtime-only, filter out all known buildtime member types. + // If runtime-only, filter out all known buildtime target types. // const auto& md (t.data<install_match_data> (a)); if ((md.options & lib::option_install_buildtime) == 0) { - if (m.is_a<pc> () || // pkg-config files. - m.is_a<libi> ()) // Import library. + if (m.is_a<liba> () || // Staic library. + m.is_a<pc> () || // pkg-config file. + m.is_a<libi> ()) // Import library. return false; } } diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx index 49675a8..63d58a7 100644 --- a/libbuild2/install/rule.cxx +++ b/libbuild2/install/rule.cxx @@ -1255,6 +1255,8 @@ namespace build2 // target_state r (straight_execute_prerequisites (a, t)); + bool fr (filter (a, t, t)); + // Then installable ad hoc group members, if any. // for (const target* m (t.adhoc_member); @@ -1269,7 +1271,7 @@ namespace build2 { if (const path* p = lookup_install<path> (*mf, "install")) { - install_target (*mf, *p, tp.empty () ? 1 : 2); + install_target (*mf, *p, !fr || tp.empty () ? 1 : 2); r |= target_state::changed; } } @@ -1280,7 +1282,7 @@ namespace build2 // Finally install the target itself (since we got here we know the // install variable is there). // - if (!tp.empty ()) + if (fr && !tp.empty ()) { install_target (t, cast<path> (t[var_install (rs)]), 1); r |= target_state::changed; @@ -1632,7 +1634,9 @@ namespace build2 // target_state r (target_state::unchanged); - if (!tp.empty ()) + bool fr (filter (a, t, t)); + + if (fr && !tp.empty ()) r |= uninstall_target (t, cast<path> (t[var_install (rs)]), 1); // Then installable ad hoc group members, if any. To be anally precise, @@ -1654,7 +1658,7 @@ namespace build2 r |= uninstall_target ( *mf, *p, - tp.empty () || r != target_state::changed ? 1 : 2); + !fr || tp.empty () || r != target_state::changed ? 1 : 2); } } } diff --git a/libbuild2/install/rule.hxx b/libbuild2/install/rule.hxx index 4a35503..04ac9a7 100644 --- a/libbuild2/install/rule.hxx +++ b/libbuild2/install/rule.hxx @@ -118,7 +118,9 @@ namespace build2 // Return false if this ad hoc group member should be ignored and true // otherwise. Note that this filter is called during execute and only - // for install/uninstall (and not update). + // for install/uninstall (and not update). For generality, it is also + // (first) called on the target itself (can be detected by comparing + // the second and third arguments). // // The default implementation accepts all members. // |