From 45f54246095944722970c43105383ace59b4fe95 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 10 Oct 2023 21:03:58 +0200 Subject: [PATCH] Complete the soversion granularity --- src/install.rs | 10 +++++++--- src/target.rs | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/install.rs b/src/install.rs index d0c0dbe6..c56340ad 100644 --- a/src/install.rs +++ b/src/install.rs @@ -110,10 +110,14 @@ impl UnixLibNames { match lib_type { LibType::So => { let lib = format!("lib{lib_name}.so"); - let lib_with_major_ver = format!("{}.{}", lib, lib_version.major); + let lib_with_major_ver = if lib_version.major == 0 { + format!("{}.{}.{}", lib, lib_version.major, lib_version.minor) + } else { + format!("{}.{}", lib, lib_version.major) + }; let lib_with_full_ver = format!( - "{}.{}.{}", - lib_with_major_ver, lib_version.minor, lib_version.patch + "{}.{}.{}.{}", + lib, lib_version.major, lib_version.minor, lib_version.patch ); Some(Self { canonical: lib, diff --git a/src/target.rs b/src/target.rs index 975fde5c..d730ce04 100644 --- a/src/target.rs +++ b/src/target.rs @@ -70,7 +70,11 @@ impl Target { let env = &self.env; let sover = if major == 0 { - format!("{major}.{minor}") + if minor == 0 { + format!("{major}.{minor}.{patch}") + } else { + format!("{major}.{minor}") + } } else { format!("{major}") };