aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers/linkers.py
diff options
context:
space:
mode:
authorAditya Kamath <118170220+KamathForAIX@users.noreply.github.com>2023-06-28 00:32:32 +0530
committerGitHub <noreply@github.com>2023-06-27 22:02:32 +0300
commit8946bc05f7f9cdd16dce3613c481a66f7835fc7f (patch)
treeca5b43bcab5a14d45f317cae2a15fd8426aec60f /mesonbuild/linkers/linkers.py
parent78b8d447eea08445c9708bc0e3ba3c886717f6cd (diff)
downloadmeson-8946bc05f7f9cdd16dce3613c481a66f7835fc7f.zip
meson-8946bc05f7f9cdd16dce3613c481a66f7835fc7f.tar.gz
meson-8946bc05f7f9cdd16dce3613c481a66f7835fc7f.tar.bz2
Archive shared library in AIX (#11850)
* Archive shared library in AIX This code change to ensure we archive shared libraries in AIX. The things we do are: Archive shared library Install archived shared library Build all must build the archived shared library blibpath must have the archived shared library dependency. * Archive shared library in AIX. Made changes as per the review comments given in the first PR request. They are:- Use self.environment.machines[t.for_machine].is_aix() Remove trial spaces Use of val instead of internal Changed comments wherever requested * Space after octothorpe * Fixed failed test case causing build break during install section * Moved AIX specific code to AIXDynamicLinker from backend * Fix indentation, trailing spaces, add type annotations and Linux/macOS build break * Remove some more trailing space issues * Fixed the wrong return type in linkers
Diffstat (limited to 'mesonbuild/linkers/linkers.py')
-rw-r--r--mesonbuild/linkers/linkers.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index d7868f2..edd4085 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -16,6 +16,7 @@ from __future__ import annotations
import abc
import os
import typing as T
+import re
from .base import ArLikeLinker, RSPFileSyntax
from .. import mesonlib
@@ -541,6 +542,14 @@ class DynamicLinker(metaclass=abc.ABCMeta):
suffix: str, soversion: str, darwin_versions: T.Tuple[str, str]) -> T.List[str]:
return []
+ def get_archive_name(self, filename: str) -> str:
+ #Only used by AIX.
+ return str()
+
+ def get_command_to_archive_shlib(self) -> T.List[str]:
+ #Only used by AIX.
+ return []
+
class PosixDynamicLinkerMixin:
@@ -1440,6 +1449,21 @@ class AIXDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
def get_allow_undefined_args(self) -> T.List[str]:
return self._apply_prefix(['-berok'])
+ def get_archive_name(self, filename: str) -> str:
+ # In AIX we allow the shared library name to have the lt_version and so_version.
+ # But the archive name must just be .a .
+ # For Example shared object can have the name libgio.so.0.7200.1 but the archive
+ # must have the name libgio.a having libgio.a (libgio.so.0.7200.1) in the
+ # archive. This regular expression is to do the same.
+ filename = re.sub('[.][a]([.]?([0-9]+))*([.]?([a-z]+))*', '.a', filename.replace('.so', '.a'))
+ return filename
+
+ def get_command_to_archive_shlib(self) -> T.List[str]:
+ # Archive shared library object and remove the shared library object,
+ # since it already exists in the archive.
+ command = ['ar', '-q', '-v', '$out', '$in', '&&', 'rm', '-f', '$in']
+ return command
+
def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
# AIX's linker always links the whole archive: "The ld command
# processes all input files in the same manner, whether they are