aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-11-19 01:14:05 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-11-20 16:52:45 -0500
commit8f41154827d9608234d0c0455551392d968d9e23 (patch)
treee180bf6db1c2bd2f8370108b693c5e7a45a9bf7f
parentaa9668a2fc40b728ec0e3afed85ac9e12c3c50f1 (diff)
downloadmeson-8f41154827d9608234d0c0455551392d968d9e23.zip
meson-8f41154827d9608234d0c0455551392d968d9e23.tar.gz
meson-8f41154827d9608234d0c0455551392d968d9e23.tar.bz2
Can specify headers to install with Files.
-rw-r--r--mesonbuild/backend/ninjabackend.py5
-rw-r--r--mesonbuild/interpreter.py10
-rw-r--r--test cases/common/9 header install/installed_files.txt1
-rw-r--r--test cases/common/9 header install/meson.build5
-rw-r--r--test cases/common/9 header install/sub/fileheader.h3
-rw-r--r--test cases/common/9 header install/sub/meson.build2
6 files changed, 17 insertions, 9 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 8efb5fb..2bfb822 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -656,12 +656,15 @@ int dummy;
incroot = self.environment.get_includedir()
headers = self.build.get_headers()
+ srcdir = self.environment.get_source_dir()
+ builddir = self.environment.get_build_dir()
for h in headers:
outdir = h.get_custom_install_dir()
if outdir is None:
outdir = os.path.join(incroot, h.get_install_subdir())
for f in h.get_sources():
- abspath = os.path.join(self.environment.get_source_dir(), h.get_source_subdir(), f)
+ assert(isinstance(f, File))
+ abspath = f.absolute_path(srcdir, builddir)
i = [abspath, outdir]
d.headers.append(i)
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 1c562b6..b20d98c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -457,10 +457,9 @@ class IncludeDirsHolder(InterpreterObject):
class Headers(InterpreterObject):
- def __init__(self, src_subdir, sources, kwargs):
+ def __init__(self, sources, kwargs):
InterpreterObject.__init__(self)
self.sources = sources
- 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:
@@ -473,9 +472,6 @@ class Headers(InterpreterObject):
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
@@ -2155,9 +2151,9 @@ requirements use the version keyword argument instead.''')
self.build.benchmarks.append(t)
mlog.debug('Adding benchmark "', mlog.bold(args[0]), '".', sep='')
- @stringArgs
def func_install_headers(self, node, args, kwargs):
- h = Headers(self.subdir, args, kwargs)
+ source_files = self.source_strings_to_files(args)
+ h = Headers(source_files, kwargs)
self.build.headers.append(h)
return h
diff --git a/test cases/common/9 header install/installed_files.txt b/test cases/common/9 header install/installed_files.txt
index b9e91a2..8af6c1f 100644
--- a/test cases/common/9 header install/installed_files.txt
+++ b/test cases/common/9 header install/installed_files.txt
@@ -1,3 +1,4 @@
usr/include/rootdir.h
usr/include/subdir/subdir.h
usr/include/vanished.h
+usr/include/fileheader.h
diff --git a/test cases/common/9 header install/meson.build b/test cases/common/9 header install/meson.build
index 8c8ca73..7f3ce51 100644
--- a/test cases/common/9 header install/meson.build
+++ b/test cases/common/9 header install/meson.build
@@ -2,7 +2,10 @@ project('header install', 'c')
as_array = ['subdir.h']
+subdir('vanishing_subdir')
+subdir('sub')
+
h1 = install_headers('rootdir.h')
h2 = install_headers(as_array, subdir : 'subdir')
+h3 = install_headers(subheader)
-subdir('vanishing_subdir')
diff --git a/test cases/common/9 header install/sub/fileheader.h b/test cases/common/9 header install/sub/fileheader.h
new file mode 100644
index 0000000..28e5c8d
--- /dev/null
+++ b/test cases/common/9 header install/sub/fileheader.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define LIFE "Is life! Na naa, naa-na na."
diff --git a/test cases/common/9 header install/sub/meson.build b/test cases/common/9 header install/sub/meson.build
new file mode 100644
index 0000000..1ee0d1d
--- /dev/null
+++ b/test cases/common/9 header install/sub/meson.build
@@ -0,0 +1,2 @@
+subheader = files('fileheader.h')
+