blob: cd6f98f75680c007b91966da1c4116560dfa7090 [file] [log] [blame]
# Detect SYSROOT based on environment variables rather than assuming '/'.
# Use that SYSROOT to generate paths like ${SYSROOT}/usr/...
# This is necessary on boards like whirlwind, whose SYSROOT is /build/whirlwind/
diff --git a/setup.py b/setup.py
index 7f58e7c..8cc3c5a 100755
--- a/setup.py
+++ b/setup.py
@@ -80,6 +80,8 @@ CLASSIFIERS = [
'License :: OSI Approved :: Apache Software License',
]
+SYSROOT = os.environ.get('SYSROOT', '/')
+
# Environment variable to determine whether or not the Cython extension should
# *use* Cython or use the generated C files. Note that this requires the C files
# to have been generated by building first *with* Cython support. Even if this
@@ -192,15 +194,15 @@ if "win32" in sys.platform:
if BUILD_WITH_SYSTEM_OPENSSL:
CORE_C_FILES = filter(lambda x: 'third_party/boringssl' not in x, CORE_C_FILES)
CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES)
- SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),)
+ SSL_INCLUDE = (os.path.join(SYSROOT, 'usr', 'include', 'openssl'),)
if BUILD_WITH_SYSTEM_ZLIB:
CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES)
- ZLIB_INCLUDE = (os.path.join('/usr', 'include'),)
+ ZLIB_INCLUDE = (os.path.join(SYSROOT, 'usr', 'include'),)
if BUILD_WITH_SYSTEM_CARES:
CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
- CARES_INCLUDE = (os.path.join('/usr', 'include'),)
+ CARES_INCLUDE = (os.path.join(SYSROOT, 'usr', 'include'),)
EXTENSION_INCLUDE_DIRECTORIES = (
(PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +