aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py11
-rw-r--r--mesonbuild/build.py6
2 files changed, 11 insertions, 6 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 659a53d..bd65cbe 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2004,14 +2004,21 @@ rule FORTRAN_DEP_HACK
def generate_shlib_aliases(self, target, outdir):
basename = target.get_filename()
aliases = target.get_aliaslist()
- for alias in aliases:
+ for i, alias in enumerate(aliases):
aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias)
try:
os.remove(aliasfile)
except Exception:
pass
+ # If both soversion and version are set and to different values,
+ # the .so symlink must point to the soversion symlink rather than the
+ # original file.
+ if i == 0 and len(aliases) > 1:
+ pointed_to_filename = aliases[1]
+ else:
+ pointed_to_filename = basename
try:
- os.symlink(basename, aliasfile)
+ os.symlink(pointed_to_filename, aliasfile)
except NotImplementedError:
mlog.debug("Library versioning disabled because symlinks are not supported.")
except OSError:
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 39e215f..462a55b 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1069,12 +1069,10 @@ class SharedLibrary(BuildTarget):
self.soversion = str(self.soversion)
if not isinstance(self.soversion, str):
raise InvalidArguments('Shared library soversion is not a string or integer.')
- try:
- int(self.soversion)
- except ValueError:
- raise InvalidArguments('Shared library soversion must be a valid integer')
elif self.ltversion:
# library version is defined, get the soversion from that
+ # We replicate what Autotools does here and take the first
+ # number of the version by default.
self.soversion = self.ltversion.split('.')[0]
# Visual Studio module-definitions file
if 'vs_module_defs' in kwargs: