From eb02996ed1033816d6205f6aece5ada8fab71c1d Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 23 Oct 2019 10:14:55 +0200 Subject: [PATCH] disable lto flag for darwin + nix see https://github.com/sass/sassc-ruby/issues/148 for more context --- ext/extconf.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index 08e067c1..f2a1507e 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -25,7 +25,12 @@ $CXXFLAGS << ' -march=native -mtune=native' end -if enable_config('lto', true) +# darwin nix clang doesn't support lto +# disable -lto flag for darwin + nix +# see: https://github.com/sass/sassc-ruby/issues/148 +enable_lto_by_default = (Gem::Platform.local.os == "darwin" && !ENV['NIX_CC'].nil?) + +if enable_config('lto', enable_lto_by_default) $CFLAGS << ' -flto' $CXXFLAGS << ' -flto' $LDFLAGS << ' -flto'