aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/backends.py6
-rw-r--r--mesonbuild/build.py1
-rw-r--r--mesonbuild/interpreter.py12
-rw-r--r--mesonbuild/mesonmain.py1
4 files changed, 20 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index b869008..311e16c 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -17,6 +17,7 @@ from .. import build
from .. import dependencies
from .. import mesonlib
import json
+import subprocess
from ..coredata import MesonException
class InstallData():
@@ -435,3 +436,8 @@ class Backend():
cmd.append(i)
cmd = [i.replace('\\', '/') for i in cmd]
return (srcs, ofilenames, cmd)
+
+ def run_postconf_scripts(self):
+ for s in self.build.postconf_scripts:
+ cmd = s['exe'].get_command() + [self.environment.get_source_dir(), self.environment.get_build_dir()] + s['args']
+ subprocess.check_call(cmd)
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index c96a69f..315e4bc 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -98,6 +98,7 @@ class Build:
self.pot = []
self.subprojects = {}
self.install_scripts = []
+ self.postconf_scripts = []
self.install_dirs = []
self.dep_manifest_name = None
self.dep_manifest = {}
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index ffd4689..62b7fc0 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -795,6 +795,7 @@ class MesonMain(InterpreterObject):
'source_root' : self.source_root_method,
'build_root' : self.build_root_method,
'add_install_script' : self.add_install_script_method,
+ 'add_postconf_script' : self.add_postconf_script_method,
'install_dependency_manifest': self.install_dependency_manifest_method,
'project_version': self.project_version_method,
})
@@ -810,6 +811,17 @@ class MesonMain(InterpreterObject):
raise InterpreterException('Can not find install script %s.' % scriptbase)
self.build.install_scripts.append(build.InstallScript([scriptfile]))
+ def add_postconf_script_method(self, args, kwargs):
+ if len(args) < 1:
+ raise InterpreterException('Not enough arguments')
+ check_stringlist(args, 'add_postconf_script arguments must be strings.')
+ scriptbase = args[0]
+ search_dir = os.path.join(self.interpreter.environment.source_dir,
+ self.interpreter.subdir)
+ exe = dependencies.ExternalProgram(scriptbase, search_dir=search_dir)
+ extras = args[1:]
+ self.build.postconf_scripts.append({'exe': exe, 'args': extras})
+
def current_source_dir_method(self, args, kwargs):
src = self.interpreter.environment.source_dir
sub = self.interpreter.subdir
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 543a31f..95e6731 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -168,6 +168,7 @@ itself as required.'''
intr.run()
env.dump_coredata()
g.generate(intr)
+ g.run_postconf_scripts()
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
pickle.dump(b, open(dumpfile, 'wb'))