@@ -69,21 +69,22 @@ def spawn(self, cmd):
69
69
spawn (cmd , dry_run = self .dry_run )
70
70
from distutils .msvc9compiler import MSVCCompiler
71
71
MSVCCompiler .spawn = spawn
72
- flags = ['/EHsc' ]
72
+ flags = ['-c' , '-O2' , ' /EHsc' ]
73
73
link_flags = []
74
74
else :
75
75
flags = ['-fPIC' , '-std=c++0x' , '-Wall' , '-Wno-parentheses' ]
76
76
platform .mac_ver ()
77
77
if platform .system () in ['Darwin' , 'FreeBSD' ]:
78
- os .environ ['CC' ] = os .environ ['CXX' ] = 'c++'
78
+ os .environ .setdefault ('CC' , 'clang' )
79
+ os .environ .setdefault ('CXX' , 'clang++' )
79
80
orig_customize_compiler = distutils .sysconfig .customize_compiler
80
81
81
82
def customize_compiler (compiler ):
82
83
orig_customize_compiler (compiler )
83
- compiler .compiler [0 ] = 'c++'
84
- compiler .compiler_so [0 ] = 'c++'
85
- compiler .compiler_cxx [0 ] = 'c++'
86
- compiler .linker_so [0 ] = 'c++'
84
+ compiler .compiler [0 ] = os . environ [ 'CC' ]
85
+ compiler .compiler_so [0 ] = os . environ [ 'CXX' ]
86
+ compiler .compiler_cxx [0 ] = os . environ [ 'CXX' ]
87
+ compiler .linker_so [0 ] = os . environ [ 'CXX' ]
87
88
return compiler
88
89
distutils .sysconfig .customize_compiler = customize_compiler
89
90
flags .extend ([
@@ -120,15 +121,21 @@ def restore_cencode():
120
121
if os .path .isfile (cencode_path ):
121
122
with open (cencode_path , 'w' ) as f :
122
123
f .write (cencode_body )
123
- link_flags = ['-fPIC' , '-lstdc++' ]
124
+
125
+ flags = ['-c' , '-O3' ] + flags
126
+
127
+ if platform .system () == 'FreeBSD' :
128
+ link_flags = ['-fPIC' , '-lc++' ]
129
+ else :
130
+ link_flags = ['-fPIC' , '-lstdc++' ]
124
131
125
132
sass_extension = Extension (
126
133
'_sass' ,
127
134
sources ,
128
135
library_dirs = [os .path .join ('.' , LIBSASS_DIR )],
129
136
include_dirs = [os .path .join ('.' , LIBSASS_DIR )],
130
137
depends = libsass_headers ,
131
- extra_compile_args = [ '-c' , '-O2' ] + flags ,
138
+ extra_compile_args = flags ,
132
139
extra_link_args = link_flags ,
133
140
)
134
141
0 commit comments