From a2cad68fe340a66ad54b93f88e39f97898fc462e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Aug 2017 10:49:09 +0200 Subject: Reimplement pkg-config generation with more conservative approach for now --- build2/cc/install.cxx | 24 ------------------------ build2/cc/install.hxx | 9 --------- build2/cc/link.cxx | 27 ++++++++++++++++++++++++++- build2/cc/link.hxx | 5 +++++ build2/cc/pkgconfig.cxx | 4 ++-- 5 files changed, 33 insertions(+), 36 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx index c65e7f6..72d9218 100644 --- a/build2/cc/install.cxx +++ b/build2/cc/install.cxx @@ -107,30 +107,6 @@ namespace build2 return r; } - target_state file_install:: - update_extra (action act, const target& t) const - { - // (Re)generate pkg-config's .pc file. While the target itself might be - // up-to-date from a previous run, there is no guarantee that .pc exists - // or also up-to-date. So to keep things simple we just regenerate it - // unconditionally. - // - // Also, if you are wondering why don't we just always produce this .pc, - // install or no install, the reason is unless and until we are updating - // for install, we have no idea where to things will be installed. - // - bool a; - const file* f; - - if ((a = (f = t.is_a ())) || - ( f = t.is_a ())) - { - pkgconfig_save (act, *f, a); - } - - return target_state::unchanged; - } - void file_install:: install_extra (const file& t, const install_dir& id) const { diff --git a/build2/cc/install.hxx b/build2/cc/install.hxx index 2dd2b71..a846fc8 100644 --- a/build2/cc/install.hxx +++ b/build2/cc/install.hxx @@ -41,15 +41,6 @@ namespace build2 virtual bool uninstall_extra (const file&, const install_dir&) const override; - virtual target_state - update_extra (action, const target&) const override; - - private: - // pkg-config's .pc file generation (in pkgconfig.cxx). - // - void - pkgconfig_save (action, const file&, bool) const; - private: const link& link_; }; diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx index 08b5314..41455e5 100644 --- a/build2/cc/link.cxx +++ b/build2/cc/link.cxx @@ -1564,6 +1564,31 @@ namespace build2 dd.close (); + // (Re)generate pkg-config's .pc file. While the target itself might be + // up-to-date from a previous run, there is no guarantee that .pc exists + // or also up-to-date. So to keep things simple we just regenerate it + // unconditionally. + // + // Also, if you are wondering why don't we just always produce this .pc, + // install or no install, the reason is unless and until we are updating + // for install, we have no idea where to things will be installed. + // + if (for_install) + { + bool a; + const file* f; + + if ((a = (f = t.is_a ())) || + ( f = t.is_a ())) + { + // @@ Hack: this should really be in install:update_extra() where we + // (should) what we are installing and what not. + // + if (rs["install.root"]) + pkgconfig_save (act, *f, a); + } + } + // If nothing changed, then we are done. // if (!update) @@ -1945,7 +1970,7 @@ namespace build2 if (tclass == "windows") { - // For Windows generate rpath-emulating assembly (unless updaing for + // For Windows generate rpath-emulating assembly (unless updating for // install). // if (lt.executable () && !for_install) diff --git a/build2/cc/link.hxx b/build2/cc/link.hxx index cadc82c..dc5f70a 100644 --- a/build2/cc/link.hxx +++ b/build2/cc/link.hxx @@ -122,6 +122,11 @@ namespace build2 pair windows_manifest (const file&, bool rpath_assembly) const; + // pkg-config's .pc file generation (pkgconfig.cxx). + // + void + pkgconfig_save (action, const file&, bool) const; + private: const string rule_id; }; diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index 3fc40ad..0a7bf8f 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include using namespace std; using namespace butl; @@ -537,7 +537,7 @@ namespace build2 return true; } - void file_install:: + void link:: pkgconfig_save (action act, const file& l, bool la) const { tracer trace (x, "pkgconfig_save"); -- cgit v1.1