@@ -69,21 +69,22 @@ def spawn(self, cmd):
6969 spawn (cmd , dry_run = self .dry_run )
7070 from distutils .msvc9compiler import MSVCCompiler
7171 MSVCCompiler .spawn = spawn
72- flags = ['/EHsc' ]
72+ flags = ['-c' , '-O2' , ' /EHsc' ]
7373 link_flags = []
7474else :
7575 flags = ['-fPIC' , '-std=c++0x' , '-Wall' , '-Wno-parentheses' ]
7676 platform .mac_ver ()
7777 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++' )
7980 orig_customize_compiler = distutils .sysconfig .customize_compiler
8081
8182 def customize_compiler (compiler ):
8283 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' ]
8788 return compiler
8889 distutils .sysconfig .customize_compiler = customize_compiler
8990 flags .extend ([
@@ -120,15 +121,21 @@ def restore_cencode():
120121 if os .path .isfile (cencode_path ):
121122 with open (cencode_path , 'w' ) as f :
122123 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++' ]
124131
125132sass_extension = Extension (
126133 '_sass' ,
127134 sources ,
128135 library_dirs = [os .path .join ('.' , LIBSASS_DIR )],
129136 include_dirs = [os .path .join ('.' , LIBSASS_DIR )],
130137 depends = libsass_headers ,
131- extra_compile_args = [ '-c' , '-O2' ] + flags ,
138+ extra_compile_args = flags ,
132139 extra_link_args = link_flags ,
133140)
134141
0 commit comments