aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-08-07 15:37:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-08-07 15:37:54 +0200
commitf918e62bcb9c6dec5c6302a55710f9850087fe9a (patch)
treee5f2e8070de084e8acd710b19a0605d5e61ea36a
parentd65e54a0dfabc9a8468f5746fe0be3e609c93f03 (diff)
Install archive prerequisites of libraries0.6.0
-rw-r--r--build2/cc/install.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx
index 72d9218..050ab1e 100644
--- a/build2/cc/install.cxx
+++ b/build2/cc/install.cxx
@@ -41,11 +41,14 @@ namespace build2
// If this is a shared library prerequisite, install it as long as it
// is in the same amalgamation as we are.
//
- // @@ Shouldn't we also install a static library prerequisite of a
- // static library?
+ // Less obvious: we also want to install a static library prerequisite
+ // of a library (since it could be referenced from its .pc file, etc).
//
- if ((t.is_a<exe> () || t.is_a<libs> ()) &&
- (p.is_a<libx> () || p.is_a<libs> ()))
+ bool st (t.is_a<exe> () || t.is_a<libs> ()); // Target needs shared.
+ bool at (t.is_a<liba> () || t.is_a<libs> ()); // Target needs static.
+
+ if ((st && (p.is_a<libx> () || p.is_a<libs> ())) ||
+ (at && (p.is_a<libx> () || p.is_a<liba> ())))
{
const target* pt (&p.search (t));
@@ -56,7 +59,7 @@ namespace build2
pt = &link_member (
*l, a, link_info (t.base_scope (), link_type (t).type));
- if (pt->is_a<libs> ()) // Can be liba{}.
+ if ((st && pt->is_a<libs> ()) || (at && pt->is_a<liba> ()))
return pt->in (t.weak_scope ()) ? pt : nullptr;
// See through libux{}. Note that we are always in the same project
@@ -179,8 +182,11 @@ namespace build2
return nullptr;
}
- if ((t.is_a<libue> () || t.is_a<libus> ()) &&
- (p.is_a<libx> () || p.is_a<libs> ()))
+ bool st (t.is_a<libue> () || t.is_a<libus> ()); // Target needs shared.
+ bool at (t.is_a<libua> () || t.is_a<libus> ()); // Target needs static.
+
+ if ((st && (p.is_a<libx> () || p.is_a<libs> ())) ||
+ (at && (p.is_a<libx> () || p.is_a<liba> ())))
{
const target* pt (&p.search (t));
@@ -188,7 +194,7 @@ namespace build2
pt = &link_member (
*l, a, link_info (t.base_scope (), link_type (t).type));
- if (pt->is_a<libs> ())
+ if ((st && pt->is_a<libs> ()) || (at && pt->is_a<liba> ()))
return pt->in (t.weak_scope ()) ? pt : nullptr;
if (pt->is_a<libux> ())