diff options
-rw-r--r-- | interpreter.py | 18 | ||||
-rw-r--r-- | ninjabackend.py | 4 | ||||
-rw-r--r-- | test cases/common/9 header install/installed_files.txt | 1 | ||||
-rw-r--r-- | test cases/common/9 header install/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/9 header install/vanishing_subdir/meson.build | 1 | ||||
-rw-r--r-- | test cases/common/9 header install/vanishing_subdir/vanished.h | 5 |
6 files changed, 22 insertions, 9 deletions
diff --git a/interpreter.py b/interpreter.py index bd6421d..e49ff92 100644 --- a/interpreter.py +++ b/interpreter.py @@ -275,20 +275,24 @@ class IncludeDirsHolder(InterpreterObject): class Headers(InterpreterObject): - def __init__(self, sources, kwargs): + def __init__(self, src_subdir, sources, kwargs): InterpreterObject.__init__(self) self.sources = sources - self.subdir = kwargs.get('subdir', '') + self.source_subdir = src_subdir + self.install_subdir = kwargs.get('subdir', '') self.custom_install_dir = kwargs.get('install_dir', None) if self.custom_install_dir is not None: if not isinstance(self.custom_install_dir, str): raise InterpreterException('Custom_install_dir must be a string.') - def set_subdir(self, subdir): - self.subdir = subdir + def set_install_subdir(self, subdir): + self.install_subdir = subdir - def get_subdir(self): - return self.subdir + def get_install_subdir(self): + return self.install_subdir + + def get_source_subdir(self): + return self.source_subdir def get_sources(self): return self.sources @@ -1150,7 +1154,7 @@ class Interpreter(): for a in args: if not isinstance(a, str): raise InvalidArguments('Argument %s is not a string.' % str(a)) - h = Headers(args, kwargs) + h = Headers(self.subdir, args, kwargs) self.build.headers.append(h) return h diff --git a/ninjabackend.py b/ninjabackend.py index 0918d7e..35734c3 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -433,9 +433,9 @@ class NinjaBackend(backends.Backend): for h in headers: outdir = h.get_custom_install_dir() if outdir is None: - outdir = os.path.join(incroot, h.get_subdir()) + outdir = os.path.join(incroot, h.get_install_subdir()) for f in h.get_sources(): - abspath = os.path.join(self.environment.get_source_dir(), f) # FIXME + abspath = os.path.join(self.environment.get_source_dir(), h.get_source_subdir(), f) i = [abspath, outdir] d.headers.append(i) diff --git a/test cases/common/9 header install/installed_files.txt b/test cases/common/9 header install/installed_files.txt index bcfb9e3..508aa32 100644 --- a/test cases/common/9 header install/installed_files.txt +++ b/test cases/common/9 header install/installed_files.txt @@ -1,2 +1,3 @@ include/rootdir.h include/subdir/subdir.h +include/vanished.h diff --git a/test cases/common/9 header install/meson.build b/test cases/common/9 header install/meson.build index 6564a5d..8c8ca73 100644 --- a/test cases/common/9 header install/meson.build +++ b/test cases/common/9 header install/meson.build @@ -4,3 +4,5 @@ as_array = ['subdir.h'] h1 = install_headers('rootdir.h') h2 = install_headers(as_array, subdir : 'subdir') + +subdir('vanishing_subdir') diff --git a/test cases/common/9 header install/vanishing_subdir/meson.build b/test cases/common/9 header install/vanishing_subdir/meson.build new file mode 100644 index 0000000..a81626c --- /dev/null +++ b/test cases/common/9 header install/vanishing_subdir/meson.build @@ -0,0 +1 @@ +install_headers('vanished.h') diff --git a/test cases/common/9 header install/vanishing_subdir/vanished.h b/test cases/common/9 header install/vanishing_subdir/vanished.h new file mode 100644 index 0000000..ed7971b --- /dev/null +++ b/test cases/common/9 header install/vanishing_subdir/vanished.h @@ -0,0 +1,5 @@ +#pragma once + +/* This is a header in a subdirectory. Make sure it installs into + * /prefix/include and not /prefix/include/vanishing_subdir. + */ |