45 lines
2.3 KiB
Diff
45 lines
2.3 KiB
Diff
From b6d28249d8e2d05270f6098608dda98a8d22bd47 Mon Sep 17 00:00:00 2001
|
|
From: jeremyd2019 <github@jdrake.com>
|
|
Date: Mon, 22 Nov 2021 13:15:12 -0800
|
|
Subject: [PATCH 105/N] fix mingw cross compiling in setup.py
|
|
|
|
gcc outputs with `;` path delimiter on mingw, so use `os.pathsep` instead of `:` (assuming this is a host rather than target decision)
|
|
|
|
clang does not output `LIBRARY_PATH` with `-E -v`, so add an extra call to `-print-search-dirs` to find its library path.
|
|
---
|
|
setup.py | 15 +++++++++++++--
|
|
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index b6b6a5e..2b07c4c 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -807,14 +807,25 @@ def add_cross_compiling_paths(self):
|
|
elif line.startswith("End of search list"):
|
|
in_incdirs = False
|
|
elif (is_gcc or is_clang) and line.startswith("LIBRARY_PATH"):
|
|
- for d in line.strip().split("=")[1].split(":"):
|
|
+ for d in line.strip().split("=")[1].split(os.pathsep):
|
|
d = os.path.normpath(d)
|
|
- if '/gcc/' not in d:
|
|
+ if '/gcc/' not in d and '/clang/' not in d:
|
|
add_dir_to_list(self.compiler.library_dirs,
|
|
d)
|
|
elif (is_gcc or is_clang) and in_incdirs and '/gcc/' not in line and '/clang/' not in line:
|
|
add_dir_to_list(self.compiler.include_dirs,
|
|
line.strip())
|
|
+ if is_clang:
|
|
+ ret = run_command('%s -print-search-dirs >%s' % (CC, tmpfile))
|
|
+ if ret == 0:
|
|
+ with open(tmpfile) as fp:
|
|
+ for line in fp.readlines():
|
|
+ if line.startswith("libraries:"):
|
|
+ for d in line.strip().split("=")[1].split(os.pathsep):
|
|
+ d = os.path.normpath(d)
|
|
+ if '/gcc/' not in d and '/clang/' not in d:
|
|
+ add_dir_to_list(self.compiler.library_dirs,
|
|
+ d)
|
|
finally:
|
|
os.unlink(tmpfile)
|
|
|