summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-11-24 11:21:19 +0100
committerArmin Rigo <arigo@tunes.org>2020-11-24 11:21:19 +0100
commit55f18fb97be7757995755bf4e80f60f219676e23 (patch)
tree85c0edbbfbe51a852bd72196dd35919d17c24828 /setup.py
parentff3dfb69b4342b1caacfef88e705de86f5bb9844 (diff)
parent097bc56353a9084b10e30de94b8f0f12487b2784 (diff)
downloadcffi-55f18fb97be7757995755bf4e80f60f219676e23.tar.gz
hg merge default
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py31
1 files changed, 5 insertions, 26 deletions
diff --git a/setup.py b/setup.py
index 826216d..f2e007c 100644
--- a/setup.py
+++ b/setup.py
@@ -149,39 +149,18 @@ if COMPILE_LIBFFI:
sources.extend(os.path.join(COMPILE_LIBFFI, filename)
for filename in _filenames)
else:
- if 'darwin' in sys.platform and macosx_deployment_target() >= (10, 15):
- # use libffi from Mac OS SDK if we're targetting 10.15 (including
- # on arm64). This libffi is safe against the crash-after-fork
- # issue described in _cffi_backend.c. Also, arm64 uses a different
- # ABI for calls to vararg functions as opposed to regular functions.
- extra_compile_args += ['-iwithsysroot/usr/include/ffi']
- define_macros += [('CFFI_TRUST_LIBFFI', '1'),
- ('HAVE_FFI_PREP_CIF_VAR', '1')]
- libraries += ['ffi']
- else:
- use_pkg_config()
+ use_pkg_config()
ask_supports_thread()
ask_supports_sync_synchronize()
+if 'darwin' in sys.platform:
+ # priority is given to `pkg_config`, but always fall back on SDK's libffi.
+ extra_compile_args += ['-iwithsysroot/usr/include/ffi']
+
if 'freebsd' in sys.platform:
include_dirs.append('/usr/local/include')
library_dirs.append('/usr/local/lib')
-if 'darwin' in sys.platform:
- try:
- p = subprocess.Popen(['xcrun', '--show-sdk-path'],
- stdout=subprocess.PIPE)
- except OSError as e:
- if e.errno not in [errno.ENOENT, errno.EACCES]:
- raise
- else:
- t = p.stdout.read().decode().strip()
- p.stdout.close()
- if p.wait() == 0:
- include_dirs.append(t + '/usr/include/ffi')
-
-
-
if __name__ == '__main__':
from setuptools import setup, Distribution, Extension