Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix FreeBSD platform #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,22 @@ def spawn(self, cmd):
spawn(cmd, dry_run=self.dry_run)
from distutils.msvc9compiler import MSVCCompiler
MSVCCompiler.spawn = spawn
flags = ['/EHsc']
flags = ['-c', '-O2', '/EHsc']
link_flags = []
else:
flags = ['-fPIC', '-std=c++0x', '-Wall', '-Wno-parentheses']
platform.mac_ver()
if platform.system() in ['Darwin', 'FreeBSD']:
os.environ['CC'] = os.environ['CXX'] = 'c++'
os.environ.setdefault('CC', 'clang')
os.environ.setdefault('CXX', 'clang++')
orig_customize_compiler = distutils.sysconfig.customize_compiler

def customize_compiler(compiler):
orig_customize_compiler(compiler)
compiler.compiler[0] = 'c++'
compiler.compiler_so[0] = 'c++'
compiler.compiler_cxx[0] = 'c++'
compiler.linker_so[0] = 'c++'
compiler.compiler[0] = os.environ['CC']
compiler.compiler_so[0] = os.environ['CXX']
compiler.compiler_cxx[0] = os.environ['CXX']
compiler.linker_so[0] = os.environ['CXX']
return compiler
distutils.sysconfig.customize_compiler = customize_compiler
flags.extend([
Expand Down Expand Up @@ -120,15 +121,21 @@ def restore_cencode():
if os.path.isfile(cencode_path):
with open(cencode_path, 'w') as f:
f.write(cencode_body)
link_flags = ['-fPIC', '-lstdc++']

flags = ['-c', '-O3'] + flags

if platform.system() == 'FreeBSD':
link_flags = ['-fPIC', '-lc++']
else:
link_flags = ['-fPIC', '-lstdc++']

sass_extension = Extension(
'_sass',
sources,
library_dirs=[os.path.join('.', LIBSASS_DIR)],
include_dirs=[os.path.join('.', LIBSASS_DIR)],
depends=libsass_headers,
extra_compile_args=['-c', '-O2'] + flags,
extra_compile_args=flags,
extra_link_args=link_flags,
)

Expand Down