From 9eca2e46a05870065e3cfa88ae42362d81aa3157 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Sun, 30 Dec 2018 23:28:28 +0100 Subject: Added more compiler option support --- mesonbuild/compilers/cs.py | 6 ++++++ mesonbuild/compilers/d.py | 8 +++++++- mesonbuild/compilers/fortran.py | 2 +- mesonbuild/compilers/java.py | 6 ++++++ mesonbuild/compilers/rust.py | 8 ++++++++ mesonbuild/compilers/swift.py | 2 +- mesonbuild/compilers/vala.py | 10 ++++++++++ 7 files changed, 39 insertions(+), 3 deletions(-) (limited to 'mesonbuild') diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index a504f80..cbfcd9c 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -89,6 +89,12 @@ class CsCompiler(Compiler): return [] def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): + for idx, i in enumerate(parameter_list): + if i[:2] == '-L': + parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) + if i[:5] == '-lib:': + parameter_list[idx] = i[:5] + os.path.normpath(os.path.join(build_dir, i[5:])) + return parameter_list def name_string(self): diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index a3e3369..3065ac7 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -115,6 +115,12 @@ class DCompiler(Compiler): for idx, i in enumerate(parameter_list): if i[:3] == '-I=': parameter_list[idx] = i[:3] + os.path.normpath(os.path.join(build_dir, i[3:])) + if i[:4] == '-L-L': + parameter_list[idx] = i[:4] + os.path.normpath(os.path.join(build_dir, i[4:])) + if i[:5] == '-L=-L': + parameter_list[idx] = i[:5] + os.path.normpath(os.path.join(build_dir, i[5:])) + if i[:6] == '-Wl,-L': + parameter_list[idx] = i[:6] + os.path.normpath(os.path.join(build_dir, i[6:])) return parameter_list @@ -520,7 +526,7 @@ class GnuDCompiler(DCompiler): def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): for idx, i in enumerate(parameter_list): - if i[:2] == '-I': + if i[:2] == '-I' or i[:2] == '-L': parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) return parameter_list diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 456e63e..8056969 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -173,7 +173,7 @@ end program prog def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): for idx, i in enumerate(parameter_list): - if i[:2] == '-I': + if i[:2] == '-I' or i[:2] == '-L': parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) return parameter_list diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py index 89d4c9c..03cc1b0 100644 --- a/mesonbuild/compilers/java.py +++ b/mesonbuild/compilers/java.py @@ -82,6 +82,12 @@ class JavaCompiler(Compiler): return java_buildtype_args[buildtype] def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): + for idx, i in enumerate(parameter_list): + if i[:4] == '-cp:' or i[:4] == '-cp;': + parameter_list[idx] = i[:4] + os.path.normpath(os.path.join(build_dir, i[4:])) + if i[:11] == '-classpath:' or i[:11] == '-classpath;': + parameter_list[idx] = i[:11] + os.path.normpath(os.path.join(build_dir, i[11:])) + return parameter_list def sanity_check(self, work_dir, environment): diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index b569566..68da823 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -84,4 +84,12 @@ class RustCompiler(Compiler): return rust_optimization_args[optimization_level] def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): + for idx, i in enumerate(parameter_list): + if i[:2] == '-L': + for j in ['dependency', 'crate', 'native', 'framework', 'all']: + combined_len = len(j) + 3 + if i[:combined_len] == '-L{}='.format(j): + parameter_list[idx] = i[:combined_len] + os.path.normpath(os.path.join(build_dir, i[combined_len:])) + break + return parameter_list diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py index 1d12cbc..eb58d11 100644 --- a/mesonbuild/compilers/swift.py +++ b/mesonbuild/compilers/swift.py @@ -93,7 +93,7 @@ class SwiftCompiler(Compiler): def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): for idx, i in enumerate(parameter_list): - if i[:2] == '-I': + if i[:2] == '-I' or i[:2] == '-L': parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) return parameter_list diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py index bfe48f4..e64d57f 100644 --- a/mesonbuild/compilers/vala.py +++ b/mesonbuild/compilers/vala.py @@ -67,6 +67,16 @@ class ValaCompiler(Compiler): return [] def compute_parameters_with_absolute_paths(self, parameter_list, build_dir): + for idx, i in enumerate(parameter_list): + if i[:9] == '--girdir=': + parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:])) + if i[:10] == '--vapidir=': + parameter_list[idx] = i[:10] + os.path.normpath(os.path.join(build_dir, i[10:])) + if i[:13] == '--includedir=': + parameter_list[idx] = i[:13] + os.path.normpath(os.path.join(build_dir, i[13:])) + if i[:14] == '--metadatadir=': + parameter_list[idx] = i[:14] + os.path.normpath(os.path.join(build_dir, i[14:])) + return parameter_list def sanity_check(self, work_dir, environment): -- cgit v1.1