aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-02-15 19:35:53 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-02-15 19:35:53 +0200
commit87ea869f0229af1448dce0a49718eebe47492018 (patch)
tree184f7430f979e205a165e40b28f607d200ba9581
parent99bb73e6c96655fe335dbeca6ae2f8dc7986d213 (diff)
downloadmeson-87ea869f0229af1448dce0a49718eebe47492018.zip
meson-87ea869f0229af1448dce0a49718eebe47492018.tar.gz
meson-87ea869f0229af1448dce0a49718eebe47492018.tar.bz2
Can install files created with configure_file.
-rw-r--r--.gitignore1
-rw-r--r--interpreter.py11
-rw-r--r--ninjabackend.py6
-rw-r--r--test cases/common/16 configure file/installed_files.txt1
-rw-r--r--test cases/common/16 configure file/meson.build3
5 files changed, 16 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 22c52ec..084bbf4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
/meson-test-run.txt
+*~
diff --git a/interpreter.py b/interpreter.py
index 7cc938d..92a2b92 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -303,8 +303,9 @@ class Headers(InterpreterObject):
return self.custom_install_dir
class Data(InterpreterObject):
- def __init__(self, source_subdir, sources, kwargs):
+ def __init__(self, in_sourcetree, source_subdir, sources, kwargs):
InterpreterObject.__init__(self)
+ self.in_sourcetree = in_sourcetree
self.source_subdir = source_subdir
self.sources = sources
kwsource = kwargs.get('sources', [])
@@ -1269,7 +1270,7 @@ class Interpreter():
for a in args:
if not isinstance(a, str):
raise InvalidArguments('Argument %s is not a string.' % str(a))
- data = Data(self.subdir, args, kwargs)
+ data = Data(True, self.subdir, args, kwargs)
self.build.data.append(data)
return data
@@ -1295,9 +1296,9 @@ class Interpreter():
raise InterpreterException('Required keyword argument "input" not defined.')
if not 'output' in kwargs:
raise InterpreterException('Required keyword argument "output" not defined.')
+ inputfile = kwargs['input']
+ output = kwargs['output']
if 'configuration' in kwargs:
- inputfile = kwargs['input']
- output = kwargs['output']
conf = kwargs['configuration']
if not isinstance(conf, ConfigurationDataHolder):
raise InterpreterException('Argument "configuration" is not of type configuration_data')
@@ -1314,6 +1315,8 @@ class Interpreter():
(res.stdout, res.stderr))
else:
raise InterpreterException('Configure_file must have either "configuration" or "command".')
+ if isinstance(kwargs.get('install_dir', None), str):
+ self.build.data.append(Data(False, self.subdir, [output], kwargs))
def func_include_directories(self, node, args, kwargs):
absbase = os.path.join(self.environment.get_source_dir(), self.subdir)
diff --git a/ninjabackend.py b/ninjabackend.py
index 96e49d2..42ebf3d 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -464,7 +464,11 @@ class NinjaBackend(backends.Backend):
for de in data:
subdir = de.get_install_dir()
for f in de.get_sources():
- srcabs = os.path.join(self.environment.get_source_dir(), de.get_source_subdir(), f)
+ if de.in_sourcetree:
+ srcprefix = self.environment.get_source_dir()
+ else:
+ srcprefix = self.environment.get_build_dir()
+ srcabs = os.path.join(srcprefix, de.get_source_subdir(), f)
dstabs = os.path.join(subdir, f)
i = [srcabs, dstabs]
d.data.append(i)
diff --git a/test cases/common/16 configure file/installed_files.txt b/test cases/common/16 configure file/installed_files.txt
new file mode 100644
index 0000000..219b4c0
--- /dev/null
+++ b/test cases/common/16 configure file/installed_files.txt
@@ -0,0 +1 @@
+usr/share/appdir/config2.h
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index c320a5d..f381c8e 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -22,7 +22,8 @@ ofile = '@0@/config2.h'.format(meson.current_build_dir())
configure_file(input : 'dummy.dat',
output : 'config2.h',
-command : [genprog, scriptfile, ifile, ofile])
+command : [genprog, scriptfile, ifile, ofile],
+install_dir : 'share/appdir')
test('inctest2', executable('prog2', 'prog2.c',
include_directories : include_directories('.')))