|
11 | 11 | from pathlib import Path |
12 | 12 | from . import build, minstall |
13 | 13 | from .mesonlib import (EnvironmentVariables, MesonException, join_args, is_windows, setup_vsenv, |
14 | | - get_wine_shortpath, MachineChoice, relpath) |
| 14 | + get_wine_shortpath, MachineChoice, relpath, is_osx) |
15 | 15 | from .options import OptionKey |
16 | 16 | from . import mlog |
17 | 17 |
|
@@ -151,6 +151,14 @@ def write_gdb_script(privatedir: Path, install_data: 'InstallData', workdir: Pat |
151 | 151 | mlog.log(' - Change current workdir to', mlog.bold(str(rel_path.parent)), |
152 | 152 | 'or use', mlog.bold(f'--init-command {rel_path}')) |
153 | 153 |
|
| 154 | +def macos_sip_enabled() -> bool: |
| 155 | + if not is_osx(): |
| 156 | + return False |
| 157 | + ret = subprocess.run(["csrutil", "status"], text=True, capture_output=True, encoding='utf-8') |
| 158 | + if not ret.stdout: |
| 159 | + return True |
| 160 | + return 'enabled' in ret.stdout |
| 161 | + |
154 | 162 | def dump(devenv: T.Dict[str, str], varnames: T.Set[str], dump_format: T.Optional[str], output: T.Optional[T.TextIO] = None) -> None: |
155 | 163 | for name in varnames: |
156 | 164 | print(f'{name}="{devenv[name]}"', file=output) |
@@ -221,6 +229,10 @@ def run(options: argparse.Namespace) -> int: |
221 | 229 | tmprc.flush() |
222 | 230 | args.append("--rcfile") |
223 | 231 | args.append(tmprc.name) |
| 232 | + if 'DYLD_LIBRARY_PATH' in devenv and macos_sip_enabled(): |
| 233 | + mlog.warning('macOS System Integrity Protection is enabled: DYLD_LIBRARY_PATH cannot be set in the subshell') |
| 234 | + mlog.warning('To fix that, use `meson devenv --dump dev.env && source dev.env`') |
| 235 | + del devenv['DYLD_LIBRARY_PATH'] |
224 | 236 | else: |
225 | 237 | # Try to resolve executable using devenv's PATH |
226 | 238 | abs_path = shutil.which(args[0], path=devenv.get('PATH', None)) |
|
0 commit comments