diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-29 19:31:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-29 19:31:16 +0200 |
commit | 2720b45ef0ca9fd58c11fd9b4f000e1cf3a0819d (patch) | |
tree | 4505f65e4f997889e01d4b69bdf94257223d3dc6 /build2/cc/install.cxx | |
parent | 47e89b188ac71627f43e0bb8c47ffe08f6c1b919 (diff) |
Implement initial support for library versioning
Currently we only support platform-independent versions that get appended
to the library name. The magic incantation is this:
lib{foo}: bin.lib.version = @-1.2
This will produce libfoo-1.2.so, libfoo-1.2.dll, etc.
In the future we will support things like this:
lib{foo}: bin.lib.version = linux@1.2.3 freebsd@1.2 windows@1.2
Diffstat (limited to 'build2/cc/install.cxx')
-rw-r--r-- | build2/cc/install.cxx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx index c62ea95..a69cc52 100644 --- a/build2/cc/install.cxx +++ b/build2/cc/install.cxx @@ -68,5 +68,59 @@ namespace build2 match_result r (link_.match (a, t, hint)); return r ? install::file_rule::match (a, t, "") : r; } + + void install:: + install_extra (file& t, const install_dir& id) const + { + if (t.is_a<libs> () && tclass != "windows") + { + // Here we may have a bunch of symlinks that we need to install. + // + link::libs_paths lp (link_.derive_libs_paths (t)); + + auto ln = [&id, this] (const path& f, const path& l) + { + install_l (id, f.leaf (), l.leaf (), false); + }; + + const path& lk (lp.link); + const path& so (lp.soname); + const path& in (lp.interm); + + const path* f (lp.real); + + if (!in.empty ()) {ln (*f, in); f = ∈} + if (!so.empty ()) {ln (*f, so); f = &so;} + if (!lk.empty ()) {ln (*f, lk);} + } + } + + bool install:: + uninstall_extra (file& t, const install_dir& id) const + { + bool r (false); + + if (t.is_a<libs> () && tclass != "windows") + { + // Here we may have a bunch of symlinks that we need to uninstall. + // + link::libs_paths lp (link_.derive_libs_paths (t)); + + auto rm = [&id, this] (const path& l) + { + return uninstall (id, nullptr, l.leaf (), false); + }; + + const path& lk (lp.link); + const path& so (lp.soname); + const path& in (lp.interm); + + if (!lk.empty ()) r = rm (lk) || r; + if (!so.empty ()) r = rm (so) || r; + if (!in.empty ()) r = rm (in) || r; + } + + return r; + } } } |