ladybird/Ports/python3/patches/0005-Tweak-setup.py-sysroot-detection.patch
Linus Groh edf3aee4df Ports/python3: Update Python to 3.11.0
This now requires `--host` and `--with-build-python` to be passed to the
configure script when cross compiling; the former we simply do like in
many other package.sh scripts as well, the latter we point to `python3`,
which is expected to match the port's version anyway.
2022-10-25 13:11:42 +01:00

30 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Humberto Alves <hjalves@live.com>
Date: Thu, 1 Sep 2022 20:25:11 +0100
Subject: [PATCH] Tweak `setup.py` sysroot detection
When crosscompiling, the Python installer expects the C compiler to
be invoked with a `--sysroot` command line option, which then is used
to find additional subdirectories containing headers and libraries.
Because there is no such option present, this is a workaround to use
the environment variable `SERENITY_INSTALL_ROOT` as a fake `--sysroot`
in the detection code.
---
setup.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/setup.py b/setup.py
index e651ac7627e8b796f8b9b4d60f592bc9261b6540..c4c4e92309a952a88d9de1b853a9535cb86913cc 100644
--- a/setup.py
+++ b/setup.py
@@ -166,6 +166,8 @@ def sysroot_paths(make_vars, subdirs):
for var_name in make_vars:
var = sysconfig.get_config_var(var_name)
if var is not None:
+ if serenity_install_root := os.environ.get('SERENITY_INSTALL_ROOT'):
+ var += f' --sysroot={serenity_install_root}'
m = re.search(r'--sysroot=([^"]\S*|"[^"]+")', var)
if m is not None:
sysroot = m.group(1).strip('"')