aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-01-30 11:30:16 +0000
committerGitHub <noreply@github.com>2021-01-30 11:30:16 +0000
commitc67e0a8a6785ab5f139491786fa064905278d951 (patch)
tree848cd21be5fbf4c8cedae03fa0f4f72f59b92f0a /mesonbuild/modules
parentf0fbb31ccfa78ca1d7b7f9cedfbb090bf36d3e64 (diff)
parentef7dfa97fc6f20d8793609fc086718399c08a85a (diff)
downloadmeson-c67e0a8a6785ab5f139491786fa064905278d951.zip
meson-c67e0a8a6785ab5f139491786fa064905278d951.tar.gz
meson-c67e0a8a6785ab5f139491786fa064905278d951.tar.bz2
Merge pull request #8264 from xclaesse/ep-misc
external_project: misc improvements
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/unstable_external_project.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py
index aea8366..20c1671 100644
--- a/mesonbuild/modules/unstable_external_project.py
+++ b/mesonbuild/modules/unstable_external_project.py
@@ -90,11 +90,11 @@ class ExternalProject(InterpreterObject):
configure_prog = self.interpreter.find_program_impl(configure_path.as_posix())
configure_cmd = configure_prog.get_command()
- d = {'PREFIX': self.prefix.as_posix(),
- 'LIBDIR': self.libdir.as_posix(),
- 'INCLUDEDIR': self.includedir.as_posix(),
- }
- self._validate_configure_options(d.keys())
+ d = [('PREFIX', '--prefix=@PREFIX@', self.prefix.as_posix()),
+ ('LIBDIR', '--libdir=@PREFIX@/@LIBDIR@', self.libdir.as_posix()),
+ ('INCLUDEDIR', '--includedir=@PREFIX@/@INCLUDEDIR@', self.includedir.as_posix()),
+ ]
+ self._validate_configure_options(d)
configure_cmd += self._format_options(self.configure_options, d)
@@ -102,7 +102,7 @@ class ExternalProject(InterpreterObject):
host = '{}-{}-{}'.format(self.host_machine.cpu_family,
self.build_machine.system,
self.host_machine.system)
- d = {'HOST': host}
+ d = [('HOST', None, host)]
configure_cmd += self._format_options(self.cross_configure_options, d)
# Set common env variables like CFLAGS, CC, etc.
@@ -119,7 +119,10 @@ class ExternalProject(InterpreterObject):
link_exelist = compiler.get_linker_exelist()
link_args = self.env.coredata.get_external_link_args(MachineChoice.HOST, lang)
if link_exelist:
- self.run_env['LD'] = self._quote_and_join(link_exelist)
+ # FIXME: Do not pass linker because Meson uses CC as linker wrapper,
+ # but autotools often expects the real linker (e.h. GNU ld).
+ # self.run_env['LD'] = self._quote_and_join(link_exelist)
+ pass
self.run_env['LDFLAGS'] = self._quote_and_join(link_args)
self.run_env = self.user_env.get_env(self.run_env)
@@ -133,23 +136,23 @@ class ExternalProject(InterpreterObject):
def _quote_and_join(self, array: T.List[str]) -> str:
return ' '.join([shlex.quote(i) for i in array])
- def _validate_configure_options(self, required_keys: T.List[str]):
+ def _validate_configure_options(self, variables: T.List[T.Tuple[str, str, str]]):
# Ensure the user at least try to pass basic info to the build system,
# like the prefix, libdir, etc.
- for key in required_keys:
+ for key, default, val in variables:
key_format = '@{}@'.format(key)
for option in self.configure_options:
if key_format in option:
break
else:
- m = 'At least one configure option must contain "{}" key'
- raise InterpreterException(m.format(key_format))
+ FeatureNew('Default configure_option', '0.57.0').use(self.subproject)
+ self.configure_options.append(default)
- def _format_options(self, options: T.List[str], variables: T.Dict[str, str]) -> T.List[str]:
+ def _format_options(self, options: T.List[str], variables: T.List[T.Tuple[str, str, str]]) -> T.List[str]:
out = []
missing = set()
regex = get_variable_regex('meson')
- confdata = {k: (v, None) for k, v in variables.items()}
+ confdata = {k: (v, None) for k, d, v in variables}
for o in options:
arg, missing_vars = do_replacement(regex, o, 'meson', confdata)
missing.update(missing_vars)
@@ -162,12 +165,13 @@ class ExternalProject(InterpreterObject):
def _run(self, step: str, command: T.List[str]):
mlog.log('External project {}:'.format(self.name), mlog.bold(step))
- m = 'Running command: ' + str(command)
+ m = 'Running command ' + str(command) + ' in directory ' + str(self.build_dir) + '\n'
log_filename = Path(mlog.log_dir, '{}-{}.log'.format(self.name, step))
output = None
if not self.verbose:
output = open(log_filename, 'w')
output.write(m + '\n')
+ output.flush()
else:
mlog.log(m)
p, o, e = Popen_safe(command, cwd=str(self.build_dir), env=self.run_env,
@@ -186,6 +190,7 @@ class ExternalProject(InterpreterObject):
'--srcdir', self.src_dir.as_posix(),
'--builddir', self.build_dir.as_posix(),
'--installdir', self.install_dir.as_posix(),
+ '--logdir', mlog.log_dir,
'--make', self.make,
]
if self.verbose: