Skip to content

Commit 50a9406

Browse files
committed
cheribsd: Set MAKEOBJDIRPREFIX lazily pre-setup()
We can't just do it eagerly in __init__ since we need _init_called to be set to true by Target.create_project for cheribsd-mfs-root-kernel (its builddir will call cheribsd_reuse_build_dir, which then gets the base cheribsd instance, which asserts that the caller is already initialised). This is all a bit of a mess still, as it seems that all the make_args setting in setup() should be done in _setup_make_args(), with setup() either calling _setup_make_args() if needed or just letting the laziness do its job if not, but I don't want to untangle all that.
1 parent 4a4ebef commit 50a9406

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pycheribuild/projects/cross/cheribsd.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,22 @@ def check_system_dependencies(self) -> None:
525525

526526
def __init__(self, *args, **kwargs) -> None:
527527
super().__init__(*args, **kwargs)
528+
self._setup_core_make_args_called = False
529+
530+
def _setup_core_make_args(self) -> None:
531+
if self._setup_core_make_args_called:
532+
return
533+
528534
# Needed pre-setup for _query_make_var() (e.g. via objdir)
529535
self.make_args.set_env(MAKEOBJDIRPREFIX=str(self.build_dir))
530536
# TODO? Avoid lots of nested child directories by using MAKEOBJDIR instead of MAKEOBJDIRPREFIX
531537
# self.make_args.set_env(MAKEOBJDIR=str(self.build_dir))
532538

539+
self._setup_core_make_args_called = True
540+
533541
def setup(self) -> None:
534542
super().setup()
543+
self._setup_core_make_args()
535544

536545
if self.crossbuild:
537546
# Use the script that I added for building on Linux/MacOS:
@@ -828,6 +837,9 @@ def _setup_make_args(self) -> None:
828837
# Same as setup() but can be called multiple times.
829838
if self._setup_make_args_called:
830839
return
840+
841+
self._setup_core_make_args()
842+
831843
# Must be called after __init__() to ensure that CHERI LLVM/upstream LLVM have been built
832844
# before querying the compiler.
833845
if self.crossbuild:

0 commit comments

Comments
 (0)