From b7b30102882f0a85c169a0eb4944a8f1c344c9e1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Aug 2017 15:29:24 +0200 Subject: Add version, project.summary, project.url built-in variables Extract them from manifest in the version module. Use them when generating the pkg-config's .pc files. --- build2/cc/pkgconfig.cxx | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index 55847ef..8d0ea25 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -558,11 +558,30 @@ namespace build2 ofdstream os (p); auto_rmfile arm (p); - // @@ version may not be string, need to reverse. - // - os << "Name: " << cast (rs.vars[var_project]) << endl; - os << "Version: " << cast (rs.vars["version"]) << endl; - os << "Description: @@ TODO" << endl; + { + const string& n (cast (rs.vars[var_project])); + + lookup vl (rs.vars[var_version]); + if (!vl) + fail << "no version variable in project " << n << + info << "while generating " << p; + + const string& v (cast (vl)); + + os << "Name: " << n << endl; + os << "Version: " << v << endl; + + // This one is required so make something up if unspecified. + // + os << "Description: "; + if (const string* s = cast_null (rs[var_project_summary])) + os << *s << endl; + else + os << n << ' ' << v << endl; + + if (const string* u = cast_null (rs[var_project_url])) + os << "URL: " << *u << endl; + } // In pkg-config backslashes, spaces, etc are escaped with a // backslash. -- cgit v1.1