Skip to content

Commit 5c17fae

Browse files
committed
Allow disabling extra flags with LIBRT_NO_EXTRA_FLAGS env variable
We need a way to disable these when cross compiling as these flags will break due to picking up the host rather than the target.
1 parent c5c12fa commit 5c17fae

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mypyc/build_setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
3737
X86_64 = platform.machine() in ("x86_64", "AMD64", "amd64")
3838
PYODIDE = "PYODIDE" in os.environ
39+
NO_EXTRA_FLAGS = "LIBRT_NO_EXTRA_FLAGS" in os.environ
3940

4041

4142
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
@@ -46,7 +47,7 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
4647
continue
4748
if "base64/arch/" in str(argument):
4849
new_cmd.extend(["-msimd128"])
49-
else:
50+
elif not NO_EXTRA_FLAGS:
5051
compiler_type: str = self.compiler_type
5152
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT.get(compiler_type, None)
5253
new_cmd = list(cmd)

mypyc/lib-rt/build_setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
3737
X86_64 = platform.machine() in ("x86_64", "AMD64", "amd64")
3838
PYODIDE = "PYODIDE" in os.environ
39+
NO_EXTRA_FLAGS = "LIBRT_NO_EXTRA_FLAGS" in os.environ
3940

4041

4142
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
@@ -46,7 +47,7 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
4647
continue
4748
if "base64/arch/" in str(argument):
4849
new_cmd.extend(["-msimd128"])
49-
else:
50+
elif not NO_EXTRA_FLAGS:
5051
compiler_type: str = self.compiler_type
5152
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT.get(compiler_type, None)
5253
new_cmd = list(cmd)

0 commit comments

Comments
 (0)