0005-Tweak-setup.py-sysroot-detection.patch 1.1 KB

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