From a84ff43b183181e0a12c6d5e31c1f366d39ce2fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 Jul 2017 18:42:47 +0200 Subject: Experimental (and probably broken) pkg-config generation support --- build2/cc/install.cxx | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'build2/cc/install.cxx') diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx index a0dc9b8..c65e7f6 100644 --- a/build2/cc/install.cxx +++ b/build2/cc/install.cxx @@ -94,12 +94,43 @@ namespace build2 { file* f; if ((f = t.is_a ()) != nullptr && tclass != "windows") - t.data (link_.derive_libs_paths (*f)); + { + const string* p (cast_null (t["bin.lib.prefix"])); + const string* s (cast_null (t["bin.lib.suffix"])); + t.data ( + link_.derive_libs_paths (*f, + p != nullptr ? p->c_str (): nullptr, + s != nullptr ? s->c_str (): nullptr)); + } } 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 { -- cgit v1.1