aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-11-18 11:38:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-11-18 11:38:44 +0200
commitbbf670d03ee587b0794f77a39db801bad6459ca5 (patch)
treef7e144fc5a1ca83c4ee6d7a1f21039c657ef3718 /libbuild2/bin
parent462afa615e9f2fdff12a0ee7a36eb431ee07e141 (diff)
Only install runtime part of static library prerequisites of share libraries (GH issue #448)
Diffstat (limited to 'libbuild2/bin')
-rw-r--r--libbuild2/bin/init.cxx8
-rw-r--r--libbuild2/bin/rule.cxx13
-rw-r--r--libbuild2/bin/rule.hxx21
3 files changed, 37 insertions, 5 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index 610082e..f01adfb 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -12,7 +12,6 @@
#include <libbuild2/test/module.hxx>
-#include <libbuild2/install/rule.hxx>
#include <libbuild2/install/utility.hxx>
#include <libbuild2/bin/rule.hxx>
@@ -31,6 +30,7 @@ namespace build2
static const obj_rule obj_;
static const libul_rule libul_;
static const lib_rule lib_;
+ static const install_lib_rule install_lib_;
static const def_rule def_;
// Default config.bin.*.lib values.
@@ -631,10 +631,8 @@ namespace build2
//
if (install_loaded)
{
- auto& gr (install::group_rule::instance);
-
- r.insert<lib> (perform_install_id, "bin.lib", gr);
- r.insert<lib> (perform_uninstall_id, "bin.lib", gr);
+ r.insert<lib> (perform_install_id, "bin.lib", install_lib_);
+ r.insert<lib> (perform_uninstall_id, "bin.lib", install_lib_);
}
if (const test::module* m = rs.find_module<test::module> ("test"))
diff --git a/libbuild2/bin/rule.cxx b/libbuild2/bin/rule.cxx
index c7147bf..1fea558 100644
--- a/libbuild2/bin/rule.cxx
+++ b/libbuild2/bin/rule.cxx
@@ -218,5 +218,18 @@ namespace build2
const target* m[] = {t.a, t.s};
return execute_members (a, t, m);
}
+
+ // install_lib_rule
+ //
+ pair<const target*, uint64_t> install_lib_rule::
+ filter (const scope* is,
+ action a, const target& t, const prerequisite& p,
+ match_extra& me) const
+ {
+ if (p.is_a<lib> ())
+ return pair<const target*, uint64_t> (nullptr, 0);
+
+ return install::group_rule::filter (is, a, t, p, me);
+ }
}
}
diff --git a/libbuild2/bin/rule.hxx b/libbuild2/bin/rule.hxx
index 9dd1d14..74f4301 100644
--- a/libbuild2/bin/rule.hxx
+++ b/libbuild2/bin/rule.hxx
@@ -10,6 +10,7 @@
#include <libbuild2/rule.hxx>
#include <libbuild2/dist/rule.hxx>
+#include <libbuild2/install/rule.hxx>
#include <libbuild2/bin/export.hxx>
@@ -78,6 +79,26 @@ namespace build2
static target_state
perform (action, const target&);
};
+
+ // Install rule for lib{} group.
+ //
+ // The only difference compared to the standard install::group_rule is
+ // that it ignores the lib{} prerequisites, instead expecting the correct
+ // things to be installed via the liba{}/libs{} members. This is important
+ // due to the presence of match options (see lib{} target for details).
+ //
+ class LIBBUILD2_BIN_SYMEXPORT install_lib_rule: public install::group_rule
+ {
+ public:
+ install_lib_rule () {}
+
+ virtual pair<const target*, uint64_t>
+ filter (const scope*,
+ action, const target&, const prerequisite&,
+ match_extra&) const override;
+
+ using install::group_rule::filter; // "Unhide" to make Clang happy.
+ };
}
}