Skip to content

Commit 794cabf

Browse files
authored
Accept explicit arguments for meson compile and meson install (#256)
1 parent 5cbb90a commit 794cabf

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

spin/cmds/meson.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,15 @@ def build(
283283
quiet=False,
284284
build_dir=None,
285285
prefix=None,
286+
meson_compile_args=(),
287+
meson_install_args=(),
286288
):
287289
"""🔧 Build package with Meson/ninja
288290
289291
The package is installed to `build-install` (unless a different
290292
build directory is specified with `-C`).
291293
292-
MESON_ARGS are passed through e.g.:
294+
MESON_ARGS are passed through to `meson setup` e.g.:
293295
294296
spin build -- -Dpkg_config_path=/lib64/pkgconfig
295297
@@ -328,12 +330,14 @@ def build(
328330
)
329331
return
330332

331-
meson_args = list(meson_args)
333+
meson_args_setup = list(meson_args)
332334

333335
if gcov:
334-
meson_args = meson_args + ["-Db_coverage=true"]
336+
meson_args_setup = meson_args_setup + ["-Db_coverage=true"]
335337

336-
setup_cmd = _meson_cli() + ["setup", build_dir, f"--prefix={prefix}"] + meson_args
338+
setup_cmd = (
339+
_meson_cli() + ["setup", build_dir, f"--prefix={prefix}"] + meson_args_setup
340+
)
337341

338342
if clean:
339343
print(f"Removing `{build_dir}`")
@@ -365,10 +369,15 @@ def build(
365369
compile_flags += ["-j", str(jobs)]
366370

367371
p = _run(
368-
_meson_cli() + ["compile"] + compile_flags + ["-C", build_dir],
372+
_meson_cli()
373+
+ ["compile"]
374+
+ compile_flags
375+
+ ["-C", build_dir]
376+
+ list(meson_compile_args),
369377
sys_exit=True,
370378
output=not quiet,
371379
)
380+
372381
p = _run(
373382
_meson_cli()
374383
+ [
@@ -380,7 +389,8 @@ def build(
380389
install_dir
381390
if os.path.isabs(install_dir)
382391
else os.path.relpath(abs_install_dir, abs_build_dir),
383-
],
392+
]
393+
+ list(meson_install_args),
384394
output=(not quiet) and verbose,
385395
)
386396

0 commit comments

Comments
 (0)