@@ -12,6 +12,13 @@ def run(self):
12
12
13
13
BASEDIR = os .path .dirname (os .path .abspath (__file__ ))
14
14
15
+ def _supported_unix ():
16
+ if sys .platform .startswith ('linux' ):
17
+ return 'linux'
18
+ if sys .platform .startswith ('freebsd' ):
19
+ return 'bsd'
20
+ return False
21
+
15
22
if IS_PYPY :
16
23
ext_modules = [] # built-in
17
24
else :
@@ -35,14 +42,19 @@ def run(self):
35
42
extra_compile_args += ['-g' ]
36
43
extra_compile_args += ['-O2' ]
37
44
extra_source_files += ['src/vmprof_unix.c' , 'src/vmprof_mt.c' ]
38
- elif sys . platform . startswith ( 'linux' ):
45
+ elif _supported_unix ( ):
39
46
libraries = ['dl' ,'unwind' ]
40
47
extra_compile_args = ['-Wno-unused' ]
41
- extra_compile_args += ['-DVMPROF_LINUX=1' ]
48
+ if _supported_unix () == 'linux' :
49
+ extra_compile_args += ['-DVMPROF_LINUX=1' ]
50
+ if _supported_unix () == 'bsd' :
51
+ libraries = ['unwind' ]
52
+ extra_compile_args += ['-DVMPROF_BSD=1' ]
53
+ extra_compile_args += ['-I/usr/local/include' ]
42
54
extra_compile_args += ['-DVMPROF_UNIX=1' ]
43
55
if platform .machine ().startswith ("arm" ):
44
56
libraries .append ('unwind-arm' )
45
- elif platform .machine ().startswith ("x86" ):
57
+ elif platform .machine ().startswith ("x86" ) or platform . machine (). startswith ( "amd64" ) :
46
58
if sys .maxsize == 2 ** 63 - 1 :
47
59
libraries .append ('unwind-x86_64' )
48
60
else :
0 commit comments