1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
import _imp
import os
import sys
import struct
from distutils.spawn import find_executable
so_ext = _imp.extension_suffixes()[0]
mybase = os.path.dirname(os.path.dirname(__file__))
# FIXME: The compiler-specific values should be exported from the build,
# perhaps via a special __pypy__._sysconfigdata module?
build_time_vars = {
'ABIFLAGS': '',
# SOABI is PEP 3149 compliant, but CPython3 has so_ext.split('.')[1]
# ("ABI tag"-"platform tag") where this is ABI tag only. Wheel 0.34.2
# depends on this value, so don't make it CPython compliant without
# checking wheel: it uses pep425tags.get_abi_tag with special handling
# for CPython
"SOABI": '-'.join(so_ext.split('.')[1].split('-')[:2]),
"SO": so_ext, # deprecated in Python 3, for backward compatibility
'CC': "cc -pthread",
'CXX': "c++ -pthread",
'OPT': "-DNDEBUG -O2",
'CFLAGS': "-DNDEBUG -O2",
'CCSHARED': "-fPIC",
'LDSHARED': "cc -pthread -shared",
'EXT_SUFFIX': so_ext,
'SHLIB_SUFFIX': ".so",
'AR': "ar",
'ARFLAGS': "rc",
'EXE': "",
# This should point to where the libpypy3-c.so file lives, on CPython
# it points to "mybase/lib". But that would require rethinking the PyPy
# packaging process which copies pypy3 and libpypy3-c.so to the
# "mybase/bin" directory. Only when making a portable build (the default
# for the linux buildbots) is there even a "mybase/lib" created, even so
# the mybase/bin layout is left untouched.
'LIBDIR': os.path.join(mybase, 'bin'),
'INCLUDEPY': os.path.join(mybase, 'include'),
'LDLIBRARY': 'libpypy3-c.so',
'VERSION': '%d.%d' % sys.version_info[:2],
'LDVERSION': '%d.%d' % sys.version_info[:2],
'Py_DEBUG': 0, # cpyext never uses this
'Py_ENABLE_SHARED': 0, # if 1, will add python so to link like -lpython3.7
'SIZEOF_VOID_P': struct.calcsize("P"),
}
if find_executable("gcc"):
build_time_vars.update({
"CC": "gcc -pthread",
"GNULD": "yes",
"LDSHARED": "gcc -pthread -shared",
})
if find_executable("g++"):
build_time_vars["CXX"] = "g++ -pthread"
if sys.platform[:6] == "darwin":
# Fix this if we ever get M1 support
arch = 'x86_64'
build_time_vars['CC'] += ' -arch %s' % (arch,)
build_time_vars['LDSHARED'] = build_time_vars['CC'] + ' -shared -undefined dynamic_lookup'
build_time_vars['LDLIBRARY'] = 'libpypy3-c.dylib'
if "CXX" in build_time_vars:
build_time_vars['CXX'] += ' -arch %s' % (arch,)
build_time_vars['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
|