diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-01 15:29:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-01 15:29:24 +0200 |
commit | b7b30102882f0a85c169a0eb4944a8f1c344c9e1 (patch) | |
tree | f5c66e392bed3e3fcdc06941519ffc0a66b63c82 /build2/cc | |
parent | b810a034499e1cdc27e03714721b4de085da6d3a (diff) |
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.
Diffstat (limited to 'build2/cc')
-rw-r--r-- | build2/cc/pkgconfig.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
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<string> (rs.vars[var_project]) << endl; - os << "Version: " << cast<string> (rs.vars["version"]) << endl; - os << "Description: @@ TODO" << endl; + { + const string& n (cast<string> (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<string> (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<string> (rs[var_project_summary])) + os << *s << endl; + else + os << n << ' ' << v << endl; + + if (const string* u = cast_null<string> (rs[var_project_url])) + os << "URL: " << *u << endl; + } // In pkg-config backslashes, spaces, etc are escaped with a // backslash. |