From 39a368bc63f64f26e7b1d9fb3973c2dc132a5270 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 7 Sep 2018 16:50:36 +0200 Subject: Fix binless logic some more --- build2/cc/link-rule.cxx | 4 ++-- build2/cc/pkgconfig.cxx | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 138ae9d..93cdecf 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -1241,7 +1241,7 @@ namespace build2 // Note: on Windows shared library could be the DLL with unknown // location (empty path). See search_library() for details. // - if (l->path ().empty () && l->member != nullptr) // Binless. + if (l->path ().empty () && l->member == nullptr) // Binless. return; // On Windows a shared library is a DLL with the import library as @@ -1355,7 +1355,7 @@ namespace build2 // Note: on Windows shared library could be the DLL with unknown // location (empty path). See search_library() for details. // - if (l->path ().empty () && l->member != nullptr) // Binless. + if (l->path ().empty () && l->member == nullptr) // Binless. return; // Check if this library renders us out of date. diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index cbc4c50..a752348 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -452,8 +452,9 @@ namespace build2 #ifndef BUILD2_BOOTSTRAP // Iterate over pkgconf directories that correspond to the specified - // library directory, passing them to the callback function, until the - // function returns false. + // library directory, passing them to the callback function for as long as + // it returns false (not found). Return true if the callback returned + // true. // bool common:: pkgconfig_search (const dir_path& d, const pkgconfig_callback& f) const @@ -465,8 +466,8 @@ namespace build2 // .pc files of autotools-based packages installed by the user often // still end up there. // - if (exists (pd /= "pkgconfig") && !f (move (pd))) - return false; + if (exists (pd /= "pkgconfig") && f (move (pd))) + return true; // Platform-specific locations. // @@ -474,13 +475,13 @@ namespace build2 { // On FreeBSD .pc files go to libdata/pkgconfig/, not lib/pkgconfig/. // - pd = d; - if (exists (((pd /= "..") /= "libdata") /= "pkgconfig") && - !f (move (pd))) - return false; + (((pd = d) /= "..") /= "libdata") /= "pkgconfig"; + + if (exists (pd) && f (move (pd))) + return true; } - return true; + return false; } // Search for the .pc files in the pkgconf directories that correspond to @@ -562,14 +563,14 @@ namespace build2 d.s = search_dir (p, ".shared"); if (!d.a.empty () || !d.s.empty ()) - return false; + return true; // Then the common. // if (d.common) d.a = d.s = search_dir (p, ""); - return d.a.empty (); + return !d.a.empty (); }; pair r; @@ -1079,7 +1080,7 @@ namespace build2 auto add_pc_dir = [&pc_dirs] (dir_path&& d) -> bool { pc_dirs.emplace_back (move (d)); - return true; + return false; }; pkgconfig_search (libd, add_pc_dir); @@ -1099,7 +1100,7 @@ namespace build2 // path (unknown location) and an ad hoc member that is the // import library. See search_library() for details. // - : st->path ().empty () && st->member != nullptr); + : st->path ().empty () && st->member == nullptr); bool pa (at != nullptr && !ap.empty ()); if (pa || sp.empty ()) -- cgit v1.1