diff options
-rw-r--r-- | authors.txt | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies.py | 9 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 8 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 12 | ||||
-rw-r--r-- | test cases/common/16 configure file/meson.build | 5 |
5 files changed, 28 insertions, 8 deletions
diff --git a/authors.txt b/authors.txt index 0c575e7..d982dfa 100644 --- a/authors.txt +++ b/authors.txt @@ -73,3 +73,5 @@ Joe Baldino Peter Harris Roger Boerdijk melak47 +Philipp Ittershagen +Dylan Baker diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index eacb15b..7f22ae6 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -1483,6 +1483,14 @@ class Python3Dependency(Dependency): def get_version(self): return self.version +class ValgrindDependency(PkgConfigDependency): + + def __init__(self, environment, kwargs): + PkgConfigDependency.__init__(self, 'valgrind', environment, kwargs) + + def get_link_args(self): + return [] + def get_dep_identifier(name, kwargs): elements = [name] modlist = kwargs.get('modules', []) @@ -1544,4 +1552,5 @@ packages = {'boost': BoostDependency, 'gl': GLDependency, 'threads': ThreadDependency, 'python3': Python3Dependency, + 'valgrind': ValgrindDependency, } diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index d308342..bf3dffe 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2310,7 +2310,11 @@ class Interpreter(InterpreterBase): inputfile = inputfile[0] if not isinstance(inputfile, (str, mesonlib.File)): raise InterpreterException('Input must be a string or a file') - ifile_abs = os.path.join(self.environment.source_dir, self.subdir, inputfile) + if isinstance(inputfile, str): + inputfile = os.path.join(self.subdir, inputfile) + else: + inputfile = inputfile.relative_name() + ifile_abs = os.path.join(self.environment.source_dir, inputfile) elif 'command' in kwargs and '@INPUT@' in kwargs['command']: raise InterpreterException('@INPUT@ used as command argument, but no input file specified.') # Validate output @@ -2329,7 +2333,7 @@ class Interpreter(InterpreterBase): if inputfile is not None: # Normalize the path of the conffile to avoid duplicates # This is especially important to convert '/' to '\' on Windows - conffile = os.path.normpath(os.path.join(self.subdir, inputfile)) + conffile = os.path.normpath(inputfile) if conffile not in self.build_def_files: self.build_def_files.append(conffile) os.makedirs(os.path.join(self.environment.build_dir, self.subdir), exist_ok=True) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 7a5b962..ba52219 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -125,14 +125,14 @@ class File: assert(isinstance(self.fname, str)) def __str__(self): - return os.path.join(self.subdir, self.fname) + return self.relative_name() def __repr__(self): ret = '<File: {0}' if not self.is_built: ret += ' (not built)' ret += '>' - return ret.format(os.path.join(self.subdir, self.fname)) + return ret.format(self.relative_name()) @staticmethod def from_source_file(source_root, subdir, fname): @@ -150,15 +150,15 @@ class File: def rel_to_builddir(self, build_to_src): if self.is_built: - return os.path.join(self.subdir, self.fname) + return self.relative_name() else: return os.path.join(build_to_src, self.subdir, self.fname) def absolute_path(self, srcdir, builddir): + absdir = srcdir if self.is_built: - return os.path.join(builddir, self.subdir, self.fname) - else: - return os.path.join(srcdir, self.subdir, self.fname) + absdir = builddir + return os.path.join(absdir, self.relative_name()) def endswith(self, ending): return self.fname.endswith(ending) diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build index 8271ca3..8ffc28c 100644 --- a/test cases/common/16 configure file/meson.build +++ b/test cases/common/16 configure file/meson.build @@ -22,6 +22,11 @@ e = executable('inctest', 'prog.c', cfile) test('inctest', e) +# Test if we can also pass files() as input +configure_file(input : files('config.h.in'), + output : 'config2.h', + configuration : conf) + # Now generate a header file with an external script. genprog = import('python3').find_python() scriptfile = '@0@/generator.py'.format(meson.current_source_dir()) |