aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py42
1 files changed, 34 insertions, 8 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index f9e628d..e2dd7ca 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -44,7 +44,10 @@ known_basic_kwargs = {'install' : True,
known_shlib_kwargs = known_basic_kwargs.copy()
known_shlib_kwargs.update({'version' : True,
- 'soversion' : True})
+ 'soversion' : True,
+ 'name_prefix' : True,
+ 'name_suffix' : True,
+ })
backslash_explanation = \
'''Compiler arguments have a backslash "\\" character. This is unfortunately not
@@ -411,6 +414,23 @@ class BuildTarget():
if not os.path.isfile(trial):
raise InvalidArguments('Tried to add non-existing resource %s.' % r)
self.resources = resources
+ if 'name_prefix' in kwargs:
+ name_prefix = kwargs['name_prefix']
+ if isinstance(name_prefix, list):
+ if len(name_prefix) != 0:
+ raise InvalidArguments('Array must be empty to signify null.')
+ elif not isinstance(name_prefix, str):
+ raise InvalidArguments('Name prefix must be a string.')
+ self.prefix = name_prefix
+ if 'name_suffix' in kwargs:
+ name_suffix = kwargs['name_suffix']
+ if isinstance(name_suffix, list):
+ if len(name_suffix) != 0:
+ raise InvalidArguments('Array must be empty to signify null.')
+ else:
+ if not isinstance(name_suffix, str):
+ raise InvalidArguments('Name suffix must be a string.')
+ self.suffix = name_suffix
def get_subdir(self):
return self.subdir
@@ -654,7 +674,8 @@ class StaticLibrary(BuildTarget):
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
if len(self.sources) > 0 and self.sources[0].endswith('.cs'):
raise InvalidArguments('Static libraries not supported for C#.')
- self.prefix = environment.get_static_lib_prefix()
+ if not hasattr(self, 'prefix'):
+ self.prefix = environment.get_static_lib_prefix()
self.suffix = environment.get_static_lib_suffix()
if len(self.sources) > 0 and self.sources[0].endswith('.rs'):
self.suffix = 'rlib'
@@ -675,13 +696,18 @@ class SharedLibrary(BuildTarget):
self.soversion = None
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs);
if len(self.sources) > 0 and self.sources[0].endswith('.cs'):
- self.suffix = 'dll'
- self.prefix = 'lib'
+ prefix = 'lib'
+ suffix = 'dll'
else:
- self.prefix = environment.get_shared_lib_prefix()
- self.suffix = environment.get_shared_lib_suffix()
- if len(self.sources) > 0 and self.sources[0].endswith('.rs'):
- self.suffix = 'rlib'
+ prefix = environment.get_shared_lib_prefix()
+ suffix = environment.get_shared_lib_suffix()
+ if not hasattr(self, 'prefix'):
+ self.prefix = prefix
+ if not hasattr(self, 'suffix'):
+ if len(self.sources) > 0 and self.sources[0].endswith('.rs'):
+ self.suffix = 'rlib'
+ else:
+ self.suffix = suffix
self.importsuffix = environment.get_import_lib_suffix()
self.filename = self.prefix + self.name + '.' + self.suffix