linkers: Add a PosixDynamicLinkerMixin
This is a mixin class for DynamicLinkers that aims to provide only the
most basic posix-like linker arguments, in other words bits that gnu ld,
apple's ld, solaris's ld, and other completely disjoint linkers that are
used on Unix-like OSes share.
@@ -349,3 +349,22 @@ class DynamicLinker(metaclass=abc.ABCMeta):
rpath_paths: str, build_rpath: str,
install_rpath: str) -> typing.List[str]:
return []
+
+
+class PosixDynamicLinkerMixin:
+
+ """Mixin class for POSIX-ish linkers.
+
+ This is obviously a pretty small subset of the linker interface, but
+ enough dynamic linkers that meson supports are POSIX-like but not
+ GNU-like that it makes sense to split this out.
+ """
+
+ def get_output_args(self, outname: str) -> typing.List[str]:
+ return ['-o', outname]
+
+ def get_std_shared_lib_args(self) -> typing.List[str]:
+ return ['-shared']
+
+ def get_search_args(self, dirname: str) -> typing.List[str]:
+ return ['-L', dirname]
