aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-14 08:28:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-14 08:28:56 +0200
commitba357a5452cb4f91eecdc09b171d99acff39cb32 (patch)
treeb334b3d6c9e3df078c02cb8fad4f13c57a47a2b3
parent02de5923e7e26da9584f018e97023eb6ca619360 (diff)
Make libs_path::link empty instead of import library path for Windows
We don't really use this anywhere (in particular, the import library name cannot possibly match the clean pattern).
-rw-r--r--build2/cc/link-rule.cxx41
-rw-r--r--build2/cc/link-rule.hxx4
2 files changed, 24 insertions, 21 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index 9caac51..f8cbfe3 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -276,13 +276,15 @@ namespace build2
}
auto link_rule::
- derive_libs_paths (file& ls, const char* pfx, const char* sfx) const
- -> libs_paths
+ derive_libs_paths (file& ls,
+ const char* pfx,
+ const char* sfx) const -> libs_paths
{
- const char* ext (nullptr);
-
bool win (tclass == "windows");
+ // Get default prefix and extension.
+ //
+ const char* ext (nullptr);
if (win)
{
if (tsys == "mingw32")
@@ -392,26 +394,25 @@ namespace build2
append_ext (cp);
- // On Windows the real path is to libs{} and the link path is to the
- // import library.
+ // On Windows the real path is to libs{} and the link path is empty.
+ // Note that we still need to derive the import library path.
//
if (win)
{
- // Usually on Windows the import library is called the same as the DLL
- // but with the .lib extension. Which means it clashes with the static
- // library. Instead of decorating the static library name with ugly
- // suffixes (as is customary), let's use the MinGW approach (one must
- // admit it's quite elegant) and call it .dll.lib.
+ // Usually on Windows with MSVC the import library is called the same
+ // as the DLL but with the .lib extension. Which means it clashes with
+ // the static library. Instead of decorating the static library name
+ // with ugly suffixes (as is customary), let's use the MinGW approach
+ // (one must admit it's quite elegant) and call it .dll.lib.
//
- lk = b;
- append_ext (lk);
-
libi& li (*find_adhoc_member<libi> (ls));
- const path& pi (li.path ());
- lk = pi.empty ()
- ? li.derive_path (move (lk), tsys == "mingw32" ? "a" : "lib")
- : pi;
+ if (li.path ().empty ())
+ {
+ path ip (b);
+ append_ext (ip);
+ li.derive_path (move (ip), tsys == "mingw32" ? "a" : "lib");
+ }
}
else if (!v.empty ())
{
@@ -2833,7 +2834,9 @@ namespace build2
try
{
- if (file_exists (l, false /* follow_symlinks */)) // The -f part.
+ // The -f part.
+ //
+ if (file_exists (l, false /* follow_symlinks */))
try_rmfile (l);
mksymlink (f, l);
diff --git a/build2/cc/link-rule.hxx b/build2/cc/link-rule.hxx
index 487b1cd..14c6fa1 100644
--- a/build2/cc/link-rule.hxx
+++ b/build2/cc/link-rule.hxx
@@ -60,8 +60,8 @@ namespace build2
// one. Except for intermediate, for which empty indicates that it is
// not used.
//
- // The libs{} path is always the real path. On Windows the link path
- // is the import library.
+ // The libs{} path is always the real path. On Windows what we link
+ // to is the import library and the link path is empty.
//
path link; // What we link: libfoo.so
path soname; // SONAME: libfoo-1.so, libfoo.so.1