aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-15 15:21:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-15 15:21:03 +0200
commita0e2979d91d50b175b08b3f35cda7f75fc10bbac (patch)
tree66b0d015538880933385bf13c23e4e5f290bff6f
parent916769d98afdc7912aa90e2443fb2ac06d46d36e (diff)
Fix bug in mkanylink() usage
-rw-r--r--build2/cc/link-rule.cxx10
-rw-r--r--libbuild2/install/rule.cxx10
2 files changed, 14 insertions, 6 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index e627aff..4be3c3f 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -2855,7 +2855,7 @@ namespace build2
if (file_exists (l, false /* follow_symlinks */))
try_rmfile (l);
- mkanylink (f, l, true /* copy */);
+ mkanylink (f, l, true /* copy */, true /* relative */);
}
catch (system_error& e)
{
@@ -2883,10 +2883,10 @@ namespace build2
const path* f (paths.real);
- if (!in.empty ()) {ln (f->leaf (), in); f = &in;}
- if (!so.empty ()) {ln (f->leaf (), so); f = &so;}
- if (!ld.empty ()) {ln (f->leaf (), ld); f = &ld;}
- if (!lk.empty ()) {ln (f->leaf (), lk);}
+ if (!in.empty ()) {ln (*f, in); f = &in;}
+ if (!so.empty ()) {ln (*f, so); f = &so;}
+ if (!ld.empty ()) {ln (*f, ld); f = &ld;}
+ if (!lk.empty ()) {ln (*f, lk);}
}
else if (lt.static_library ())
{
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index 90ee7cb..fdbbffa 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -873,7 +873,15 @@ namespace build2
if (file_exists (target, false /* follow_symlinks */))
try_rmfile (target);
- mkanylink (target, rell, true /* copy */);
+ // We have to go the roundabout way by adding directory to the
+ // target and then asking for a relative symlink because it may be a
+ // hardlink in which case the target path will be interpreted from
+ // CWD.
+ //
+ mkanylink (rell.directory () / target,
+ rell,
+ true /* copy */,
+ true /* relative */);
}
catch (system_error& e)
{