Skip to content

Commit

Permalink
Update libsass to master + other fixes
Browse files Browse the repository at this point in the history
Updates libsass to master ([d225a09a](https://github.com/sass/libsass/tree/d225a09a152050d569c077f97bb944c8dc819d6f)) to incorporate fixes for:

1. The :not selector. Fixes #91. sass/libsass#2697
2. Default precision changed to 10. sass/libsass#2716
3. Now builds with `cc` instead of hard-coding `gcc`. sass/libsass#2707
4. Building on Linux and Solaris. sass/libsass#2720

Also:
1. Adds Windows RubyInstaller compilation support via `rake-compiler`. Fixes #18.
2. Fixes `load_paths` separator on Windows. Fixes #93.
3. Changes the location of `libsass.so` from `ext/` to `lib/`. Fixes #95.
  • Loading branch information
glebm committed Nov 17, 2018
1 parent c2d6de7 commit b0b9592
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "ext/libsass"]
path = ext/libsass
url = git://github.com/sass/libsass.git
url = git://github.com/sass/libsass.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This gem combines the speed of `libsass`, the [Sass C implementation](https://gi

### libsass Version

[3.5.2](https://github.com/sass/libsass/releases/tag/3.5.2)
[d225a09a](https://github.com/sass/libsass/commit/d225a09a152050d569c077f97bb944c8dc819d6f)

## Installation

Expand Down
11 changes: 8 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ rescue LoadError
puts 'Cannot load bundler/gem_tasks'
end

require 'tasks/libsass'

task default: :test

require 'rake/extensiontask'
Rake::ExtensionTask.new do |ext|
ext.name = 'libsass'
ext.ext_dir = 'ext'
ext.lib_dir = 'lib/sassc'
end

desc "Run all tests"
task test: 'libsass:compile' do
task test: 'compile:libsass' do
$LOAD_PATH.unshift('lib', 'test')
Dir.glob('./test/**/*_test.rb') { |f| require f }
end
3 changes: 0 additions & 3 deletions ext/Rakefile

This file was deleted.

32 changes: 32 additions & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

gem_root = File.expand_path('..', __dir__)
libsass_dir = File.join(gem_root, 'ext', 'libsass')

File.write 'Makefile', <<-MAKEFILE
ifndef DESTDIR
LIBSASS_OUT = #{gem_root}/lib/sassc/libsass.so
else
LIBSASS_OUT = $(DESTDIR)$(PREFIX)/libsass.so
endif
SUB_DIR := #{libsass_dir}
SUB_TARGET := lib/libsass.so
libsass.so: #{'clean ' if ENV['CLEAN']}| $(SUB_DIR)
$(MAKE) -C '$(SUB_DIR)' lib/libsass.so
cp '$(SUB_DIR)/lib/libsass.so' libsass.so
install: libsass.so
cp libsass.so '$(LIBSASS_OUT)'
$(SUB_DIR):
cd '#{gem_root}'
git submodule update --init
clean: | $(SUB_DIR)
$(MAKE) -C '$(SUB_DIR)' clean
rm -f '$(LIBSASS_OUT)' libsass.so
.PHONY: clean install
MAKEFILE
2 changes: 1 addition & 1 deletion ext/libsass
Submodule libsass updated 82 files
+1 −1 .travis.yml
+10 −0 CODE_OF_CONDUCT.md
+21 −35 GNUmakefile.am
+42 −84 Makefile
+10 −1 Makefile.conf
+5 −4 Readme.md
+8 −12 configure.ac
+1 −1 docs/api-doc.md
+73 −0 docs/dev-profiling.md
+18 −7 docs/implementations.md
+3 −0 docs/setup-environment.md
+16 −10 docs/unicode.md
+4 −4 script/ci-build-plugin
+1 −1 script/tap-runner
+45 −43 src/ast.cpp
+123 −172 src/ast.hpp
+13 −16 src/ast2c.cpp
+8 −9 src/ast2c.hpp
+50 −10 src/ast_def_macros.hpp
+11 −5 src/ast_fwd_decl.hpp
+4 −0 src/backtrace.cpp
+13 −12 src/bind.cpp
+3 −1 src/bind.hpp
+64 −0 src/c2ast.cpp
+14 −0 src/c2ast.hpp
+2 −2 src/cencode.c
+0 −7 src/check_nesting.cpp
+6 −5 src/check_nesting.hpp
+8 −0 src/context.cpp
+2 −2 src/context.hpp
+2 −7 src/cssize.cpp
+4 −4 src/cssize.hpp
+11 −8 src/debugger.hpp
+14 −0 src/environment.cpp
+6 −0 src/environment.hpp
+1 −0 src/error_handling.hpp
+151 −176 src/eval.cpp
+20 −12 src/eval.hpp
+14 −22 src/expand.cpp
+7 −11 src/expand.hpp
+3 −3 src/extend.hpp
+22 −0 src/file.cpp
+742 −0 src/fn_colors.cpp
+85 −0 src/fn_colors.hpp
+284 −0 src/fn_lists.cpp
+34 −0 src/fn_lists.hpp
+94 −0 src/fn_maps.cpp
+30 −0 src/fn_maps.hpp
+252 −0 src/fn_miscs.cpp
+40 −0 src/fn_miscs.hpp
+217 −0 src/fn_numbers.cpp
+45 −0 src/fn_numbers.hpp
+238 −0 src/fn_selectors.cpp
+35 −0 src/fn_selectors.hpp
+261 −0 src/fn_strings.cpp
+34 −0 src/fn_strings.hpp
+153 −0 src/fn_utils.cpp
+62 −0 src/fn_utils.hpp
+8 −2,200 src/functions.cpp
+1 −187 src/functions.hpp
+4 −23 src/inspect.cpp
+0 −5 src/inspect.hpp
+0 −5 src/listize.cpp
+3 −3 src/listize.hpp
+4 −7 src/memory/SharedPtr.cpp
+23 −26 src/memory/SharedPtr.hpp
+38 −12 src/operation.hpp
+33 −6 src/operators.cpp
+43 −27 src/parser.cpp
+6 −4 src/parser.hpp
+1 −1 src/prelexer.cpp
+2 −3 src/remove_placeholders.hpp
+5 −2 src/sass.cpp
+12 −9 src/sass.hpp
+45 −14 src/sass2scss.cpp
+1 −1 src/sass_context.cpp
+1 −1 src/sass_functions.hpp
+0 −7 src/to_value.cpp
+0 −5 src/to_value.hpp
+0 −5 src/util.hpp
+20 −2 win/libsass.targets
+56 −2 win/libsass.vcxproj.filters
2 changes: 1 addition & 1 deletion lib/sassc/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def output_style

def load_paths
paths = @options[:load_paths]
paths.join(":") if paths
paths.join(File::PATH_SEPARATOR) if paths
end
end
end
2 changes: 1 addition & 1 deletion lib/sassc/native.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Native

spec = Gem.loaded_specs["sassc"]
gem_root = spec.gem_dir
ffi_lib "#{gem_root}/ext/libsass/lib/libsass.so"
ffi_lib "#{gem_root}/lib/sassc/libsass.so"

require_relative "native/sass_value"

Expand Down
33 changes: 0 additions & 33 deletions lib/tasks/libsass.rb

This file was deleted.

4 changes: 3 additions & 1 deletion sassc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ Gem::Specification.new do |spec|

spec.require_paths = ["lib"]

spec.extensions = ["ext/Rakefile"]
spec.platform = Gem::Platform::RUBY
spec.extensions = ["ext/extconf.rb"]

spec.add_development_dependency "minitest", "~> 5.5.1"
spec.add_development_dependency "minitest-around"
spec.add_development_dependency "test_construct"
spec.add_development_dependency "pry"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake-compiler"

spec.add_dependency "rake"
spec.add_dependency "ffi", "~> 1.9.6"
Expand Down
2 changes: 1 addition & 1 deletion test/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_precision_not_specified
SCSS
expected_output = <<-CSS
.foo {
baz: 0.33333; }
baz: 0.3333333333; }
CSS
output = Engine.new(template).render
assert_equal expected_output, output
Expand Down
2 changes: 1 addition & 1 deletion test/native_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module NativeTest

class General < MiniTest::Test
def test_it_reports_the_libsass_version
assert_equal "3.5.2", Native.version
assert_equal "3.5.2-87-gd225", Native.version
end
end

Expand Down

0 comments on commit b0b9592

Please sign in to comment.