sassc 2.1.0.pre1 → 2.1.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff2772176f5c2bacf4de7b0834cbf272937b6116fa74fb17a17f29d9724b88f7
4
- data.tar.gz: bb3876936e8d92ba560939f5e26b2c164d6c979dd346a4c49bebab568f3c8fde
3
+ metadata.gz: cded5a763843c824e5d515d37545e852120a63d187b39d8214c7fe002f9c57a4
4
+ data.tar.gz: cda45eb98106cfaba4ae9c21fe3016af2239d330bdadc8fe4a1f86acde5da078
5
5
  SHA512:
6
- metadata.gz: 22d29a7b4470fcaf270a7c0c9a8abda0ada4242ca1d62f2c6c096a3119b3178369c8b4a168395f2cdf80498630b6f7e6d21eaa32048db01fd7fa31d134292368
7
- data.tar.gz: '080d0c1eb2a7545a7f4762963e2ca0b6edd8b271c0aeb8d238afc92a90d03f8db0f43e569fc22e9eb8b957447184b88f7df673157e8ad3d448ba6857494bf639'
6
+ metadata.gz: d85b37901cc1ed34a21d2e9a4ab2ceb1fcb94bd70354a0b4f1640fe76b1301b088616db73ed8dd79d51a74e1341c1a39fcf60feb11400bb7a0820d9aee6bf2a4
7
+ data.tar.gz: 49ee4ffcf2c78f6be513af3b549ac1a09f89b1c4e64e57c807a33da5edad0663c8e5053f1ae0dd701e62bd487405f746bf8da1cdb4c4555186b3bf355efdc201
data/.gitignore CHANGED
@@ -15,3 +15,4 @@
15
15
  *.gem
16
16
  mkmf.log
17
17
  vendor/bundle
18
+ /ext/Makefile
@@ -1,3 +1,7 @@
1
+ - **2.1.0.pre2**
2
+ - [Reduce Ruby warnings](https://github.com/sass/sassc-ruby/pull/124)
3
+ - [prefer equal? to determine object identity](https://github.com/sass/sassc-ruby/pull/122)
4
+ - [Link C/C++ stdlib statically for binary gems](https://github.com/sass/sassc-ruby/pull/127)
1
5
  - **2.1.0.pre1**
2
6
  - [Update Libsass to 3.6.0](https://github.com/sass/sassc-ruby/pull/96/files)
3
7
  - [Support old Ruby versions](https://github.com/sass/sassc-ruby/pull/117/files)
data/Rakefile CHANGED
@@ -4,12 +4,27 @@ task default: :test
4
4
 
5
5
  require 'rake/extensiontask'
6
6
  gem_spec = Gem::Specification.load("sassc.gemspec")
7
+
8
+ # HACK: Prevent rake-compiler from overriding required_ruby_version,
9
+ # because the shared library here is Ruby-agnostic.
10
+ # See https://github.com/rake-compiler/rake-compiler/issues/153
11
+ module FixRequiredRubyVersion
12
+ def required_ruby_version=(*); end
13
+ end
14
+ Gem::Specification.send(:prepend, FixRequiredRubyVersion)
15
+
7
16
  Rake::ExtensionTask.new('libsass', gem_spec) do |ext|
8
17
  ext.name = 'libsass'
9
18
  ext.ext_dir = 'ext'
10
19
  ext.lib_dir = 'lib/sassc'
11
20
  ext.cross_compile = true
12
21
  ext.cross_platform = %w[x86-mingw32 x64-mingw32 x86-linux x86_64-linux]
22
+
23
+ # Link C++ stdlib statically when building binary gems.
24
+ ext.cross_config_options << '--enable-static-stdlib'
25
+
26
+ ext.cross_config_options << '--disable-march-tune-native'
27
+
13
28
  ext.cross_compiling do |spec|
14
29
  spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
15
30
  end
@@ -18,11 +33,19 @@ end
18
33
  desc 'Compile all native gems via rake-compiler-dock (Docker)'
19
34
  task 'gem:native' do
20
35
  require 'rake_compiler_dock'
21
- RakeCompilerDock.sh "bundle && gem i rake --no-document && "\
22
- "rake cross native gem MAKE='nice make -j`nproc`' "\
23
- "RUBY_CC_VERSION=2.6.0:2.5.0:2.4.0:2.3.0"
36
+
37
+ # The RUBY_CC_VERSION here doesn't matter for the final package.
38
+ # Only one version should be specified, as the shared library is Ruby-agnostic.
39
+ #
40
+ # g++-multilib is installed for 64->32-bit cross-compilation.
41
+ RakeCompilerDock.sh "sudo apt-get install -y g++-multilib && bundle && gem i rake --no-document && "\
42
+ "rake clean && rake cross native gem MAKE='nice make -j`nproc`' "\
43
+ "RUBY_CC_VERSION=2.6.0 CLEAN=1"
24
44
  end
25
45
 
46
+ CLEAN.include 'tmp', 'pkg', 'lib/sassc/libsass.so', 'ext/libsass/VERSION',
47
+ 'ext/*.{o,so,bundle}', 'ext/Makefile'
48
+
26
49
  desc "Run all tests"
27
50
  task test: 'compile:libsass' do
28
51
  $LOAD_PATH.unshift('lib', 'test')
@@ -0,0 +1,4 @@
1
+ # Replaces default mkmf dependencies. Default mkmf dependencies include all libruby headers.
2
+ # We don't need libruby and some of these headers are missing on JRuby (breaking compilation there).
3
+ $(OBJS): $(HDRS)
4
+
@@ -10,30 +10,76 @@ if !File.directory?(libsass_dir) ||
10
10
  fail 'Could not fetch libsass'
11
11
  end
12
12
 
13
- # Only needed because rake-compiler expects `.bundle` on macOS:
14
- # https://github.com/rake-compiler/rake-compiler/blob/9f15620e7db145d11ae2fc4ba032367903f625e3/features/support/platform_extension_helpers.rb#L5
15
- dl_ext = (RUBY_PLATFORM =~ /darwin/ ? 'bundle' : 'so')
13
+ require 'mkmf'
16
14
 
17
- File.write 'Makefile', <<-MAKEFILE
18
- ifndef DESTDIR
19
- LIBSASS_OUT = #{gem_root}/lib/sassc/libsass.#{dl_ext}
20
- else
21
- LIBSASS_OUT = $(DESTDIR)$(PREFIX)/libsass.#{dl_ext}
22
- endif
15
+ $CXXFLAGS << ' -std=c++11'
23
16
 
24
- SUB_DIR := #{libsass_dir}
17
+ # Set to true when building binary gems
18
+ if enable_config('static-stdlib', false)
19
+ $LDFLAGS << ' -static-libgcc -static-libstdc++'
20
+ end
21
+
22
+ # Set to false when building binary gems
23
+ if enable_config('march-tune-native', true)
24
+ $CFLAGS << ' -march=native -mtune=native'
25
+ $CXXFLAGS << ' -march=native -mtune=native'
26
+ end
27
+
28
+ if enable_config('lto', true)
29
+ $CFLAGS << ' -flto'
30
+ $CXXFLAGS << ' -flto'
31
+ $LDFLAGS << ' -flto'
32
+ end
33
+
34
+ # Disable noisy compilation warnings.
35
+ $warnflags = ''
36
+ $CFLAGS.gsub!(/[\s+](-ansi|-std=[^\s]+)/, '')
37
+
38
+ dir_config 'libsass'
39
+
40
+ libsass_version = Dir.chdir(libsass_dir) do
41
+ if File.exist?('VERSION')
42
+ File.read('VERSION').chomp
43
+ elsif File.exist?('.git')
44
+ ver = %x[git describe --abbrev=4 --dirty --always --tags].chomp
45
+ File.write('VERSION', ver)
46
+ ver
47
+ end
48
+ end
49
+
50
+ if libsass_version
51
+ libsass_version_def = %Q{ -DLIBSASS_VERSION='"#{libsass_version}"'}
52
+ $CFLAGS << libsass_version_def
53
+ $CXXFLAGS << libsass_version_def
54
+ end
55
+
56
+ $INCFLAGS << " -I$(srcdir)/libsass/include"
57
+ $VPATH << "$(srcdir)/libsass/src"
58
+ Dir.chdir(__dir__) do
59
+ $VPATH += Dir['libsass/src/*/'].map { |p| "$(srcdir)/#{p}" }
60
+ $srcs = Dir['libsass/src/**/*.{c,cpp}']
61
+ end
62
+
63
+ MakeMakefile::LINK_SO << "\nstrip -x $@"
25
64
 
26
- libsass.#{dl_ext}:#{' clean' if ENV['CLEAN']}
27
- $(MAKE) -C '$(SUB_DIR)' lib/libsass.so
28
- cp '$(SUB_DIR)/lib/libsass.so' libsass.#{dl_ext}
29
- strip -x libsass.#{dl_ext}
65
+ # Don't link libruby.
66
+ $LIBRUBYARG = nil
30
67
 
31
- install: libsass.#{dl_ext}
32
- cp libsass.#{dl_ext} '$(LIBSASS_OUT)'
68
+ # Disable .def file generation for mingw, as it defines an
69
+ # `Init_libsass` export which we don't have.
70
+ MakeMakefile.send(:remove_const, :EXPORT_PREFIX)
71
+ MakeMakefile::EXPORT_PREFIX = nil
33
72
 
34
- clean:
35
- $(MAKE) -C '$(SUB_DIR)' clean
36
- rm -f '$(LIBSASS_OUT)' libsass.#{dl_ext}
73
+ if RUBY_ENGINE == 'jruby' &&
74
+ Gem::Version.new(RUBY_ENGINE_VERSION) < Gem::Version.new('9.2.8.0')
75
+ # COUTFLAG is not set correctly on jruby<9.2.8.0
76
+ # See https://github.com/jruby/jruby/issues/5749
77
+ MakeMakefile.send(:remove_const, :COUTFLAG)
78
+ MakeMakefile::COUTFLAG = '-o $(empty)'
79
+
80
+ # CCDLFLAGS is not set correctly on jruby<9.2.8.0
81
+ # See https://github.com/jruby/jruby/issues/5751
82
+ $CXXFLAGS << ' -fPIC'
83
+ end
37
84
 
38
- .PHONY: clean install
39
- MAKEFILE
85
+ create_makefile 'sassc/libsass'
@@ -0,0 +1 @@
1
+ 3.6.0
@@ -6,16 +6,8 @@ module SassC
6
6
  module Native
7
7
  extend FFI::Library
8
8
 
9
- spec = Gem.loaded_specs["sassc"]
10
- gem_root = spec.gem_dir
11
-
12
- dl_ext = (RUBY_PLATFORM =~ /darwin/ ? 'bundle' : 'so')
13
- ruby_version_so_path = "#{gem_root}/lib/sassc/#{RUBY_VERSION[/\d+.\d+/]}/libsass.#{dl_ext}"
14
- if File.exist?(ruby_version_so_path)
15
- ffi_lib ruby_version_so_path
16
- else
17
- ffi_lib "#{gem_root}/lib/sassc/libsass.#{dl_ext}"
18
- end
9
+ dl_ext = (RbConfig::CONFIG['host_os'] =~ /darwin/ ? 'bundle' : 'so')
10
+ ffi_lib File.expand_path("libsass.#{dl_ext}", __dir__)
19
11
 
20
12
  require_relative "native/sass_value"
21
13
 
@@ -42,7 +34,7 @@ module SassC
42
34
 
43
35
  # Remove the redundant "sass_" from the beginning of every method name
44
36
  def self.attach_function(*args)
45
- super if args.size != 3
37
+ return super if args.size != 3
46
38
 
47
39
  if args[0] =~ /^sass_/
48
40
  args.unshift args[0].to_s.sub(/^sass_/, "")
@@ -98,11 +98,6 @@ module SassC
98
98
  attach_function "sass_color_set_#{color_channel}".to_sym, [:sass_value_ptr, :double], :void
99
99
  end
100
100
 
101
- # ADDAPI size_t ADDCALL sass_list_get_length(const union Sass_Value* v)
102
- # ADDAPI union Sass_Value* ADDCALL sass_list_get_value (const union Sass_Value* v, size_t i);
103
- attach_function :sass_list_get_length, [:sass_value_ptr], :size_t
104
- attach_function :sass_list_get_value, [:sass_value_ptr, :size_t], :sass_value_ptr
105
-
106
101
  # ADDAPI char* ADDCALL sass_error_get_message (const union Sass_Value* v);
107
102
  # ADDAPI void ADDCALL sass_error_set_message (union Sass_Value* v, char* msg);
108
103
  attach_function :sass_error_get_message, [:sass_value_ptr], :string
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SassC
4
- VERSION = "2.1.0.pre1"
4
+ VERSION = "2.1.0.pre2"
5
5
  end
@@ -40,18 +40,30 @@ Gem::Specification.new do |spec|
40
40
  gem_dir = File.expand_path(File.dirname(__FILE__)) + "/"
41
41
 
42
42
  libsass_dir = File.join(gem_dir, 'ext', 'libsass')
43
- if !File.directory?(libsass_dir)
44
- $stderr.puts "Error: ext/libsass not checked out. Please run:\n\n"\
45
- " git submodule update --init"
46
- exit 1
43
+ if !File.directory?(libsass_dir) ||
44
+ # '.', '..', and possibly '.git' from a failed checkout:
45
+ Dir.entries(libsass_dir).size <= 3
46
+ Dir.chdir(__dir__) { system('git submodule update --init') } or
47
+ fail 'Could not fetch libsass'
48
+ end
49
+
50
+ # Write a VERSION file for non-binary gems (for `SassC::Native.version`).
51
+ if !File.exist?(File.join(libsass_dir, 'VERSION'))
52
+ libsass_version = Dir.chdir(libsass_dir) do
53
+ %x[git describe --abbrev=4 --dirty --always --tags].chomp
54
+ end
55
+ File.write(File.join(libsass_dir, 'VERSION'), libsass_version)
47
56
  end
48
57
 
49
58
  Dir.chdir(libsass_dir) do
50
59
  submodule_relative_path = File.join('ext', 'libsass')
60
+ skip_re = %r{(^("?test|docs|script)/)|\.md$|\.yml$}
61
+ only_re = %r{\.[ch](pp)?$}
51
62
  `git ls-files`.split($\).each do |filename|
52
- next if filename =~ %r{(^("?test|docs|script)/)|\.md$|\.yml$}
63
+ next if filename =~ skip_re || filename !~ only_re
53
64
  spec.files << File.join(submodule_relative_path, filename)
54
65
  end
66
+ spec.files << File.join(submodule_relative_path, 'VERSION')
55
67
  end
56
68
 
57
69
  end
@@ -286,7 +286,7 @@ CSS
286
286
  def test_empty_template_returns_a_new_object
287
287
  input = String.new
288
288
  output = Engine.new(input).render
289
- assert input.object_id != output.object_id, 'empty template must return a new object'
289
+ assert !input.equal?(output), 'empty template must return a new object'
290
290
  end
291
291
 
292
292
  def test_empty_template_encoding_matches_input
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre1
4
+ version: 2.1.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -153,18 +153,9 @@ files:
153
153
  - LICENSE.txt
154
154
  - README.md
155
155
  - Rakefile
156
+ - ext/depend
156
157
  - ext/extconf.rb
157
- - ext/libsass/.editorconfig
158
- - ext/libsass/.gitattributes
159
- - ext/libsass/.gitignore
160
- - ext/libsass/COPYING
161
- - ext/libsass/GNUmakefile.am
162
- - ext/libsass/INSTALL
163
- - ext/libsass/LICENSE
164
- - ext/libsass/Makefile
165
- - ext/libsass/Makefile.conf
166
- - ext/libsass/configure.ac
167
- - ext/libsass/contrib/libsass.spec
158
+ - ext/libsass/VERSION
168
159
  - ext/libsass/contrib/plugin.cpp
169
160
  - ext/libsass/include/sass.h
170
161
  - ext/libsass/include/sass/base.h
@@ -172,12 +163,7 @@ files:
172
163
  - ext/libsass/include/sass/functions.h
173
164
  - ext/libsass/include/sass/values.h
174
165
  - ext/libsass/include/sass/version.h
175
- - ext/libsass/include/sass/version.h.in
176
166
  - ext/libsass/include/sass2scss.h
177
- - ext/libsass/m4/.gitkeep
178
- - ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4
179
- - ext/libsass/res/resource.rc
180
- - ext/libsass/src/GNUmakefile.am
181
167
  - ext/libsass/src/ast.cpp
182
168
  - ext/libsass/src/ast.hpp
183
169
  - ext/libsass/src/ast2c.cpp
@@ -292,7 +278,6 @@ files:
292
278
  - ext/libsass/src/source_map.hpp
293
279
  - ext/libsass/src/subset_map.cpp
294
280
  - ext/libsass/src/subset_map.hpp
295
- - ext/libsass/src/support/libsass.pc.in
296
281
  - ext/libsass/src/to_value.cpp
297
282
  - ext/libsass/src/to_value.hpp
298
283
  - ext/libsass/src/units.cpp
@@ -309,12 +294,6 @@ files:
309
294
  - ext/libsass/src/util_string.hpp
310
295
  - ext/libsass/src/values.cpp
311
296
  - ext/libsass/src/values.hpp
312
- - ext/libsass/version.sh
313
- - ext/libsass/win/libsass.sln
314
- - ext/libsass/win/libsass.sln.DotSettings
315
- - ext/libsass/win/libsass.targets
316
- - ext/libsass/win/libsass.vcxproj
317
- - ext/libsass/win/libsass.vcxproj.filters
318
297
  - lib/sassc.rb
319
298
  - lib/sassc/dependency.rb
320
299
  - lib/sassc/engine.rb
@@ -1,15 +0,0 @@
1
- # This file is for unifying the coding style for different editors and IDEs
2
- # editorconfig.org
3
-
4
- root = true
5
-
6
- [*]
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
- indent_style = space
11
- indent_size = 2
12
-
13
- [{Makefile, GNUmakefile.am}]
14
- indent_style = tab
15
- indent_size = 4
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
@@ -1,86 +0,0 @@
1
- # Miscellaneous stuff
2
-
3
- /sassc
4
- /sass-spec
5
- /plugins/
6
-
7
- VERSION
8
- .DS_Store
9
- .sass-cache
10
- *.gem
11
- *.gcno
12
- .svn/*
13
- .cproject
14
- .project
15
- .settings/
16
- *.db
17
- *.aps
18
-
19
- # Configuration stuff
20
-
21
- GNUmakefile.in
22
- GNUmakefile
23
- /aclocal.m4
24
- /autom4te.cache/
25
- /src/config.h
26
- /config.h.in
27
- /config.log
28
- /config.status
29
- /configure
30
- /libtool
31
- /m4/libtool.m4
32
- /m4/ltoptions.m4
33
- /m4/ltsugar.m4
34
- /m4/ltversion.m4
35
- /m4/lt~obsolete.m4
36
- /script/ar-lib
37
- /script/compile
38
- /script/config.guess
39
- /script/config.sub
40
- /script/depcomp
41
- /script/install-sh
42
- /script/ltmain.sh
43
- /script/missing
44
- /script/test-driver
45
- /src/stamp-h1
46
- /src/Makefile.in
47
- /src/Makefile
48
- libsass/*
49
-
50
- # Build stuff
51
-
52
- *.o
53
- *.lo
54
- *.so
55
- *.dll
56
- *.a
57
- *.suo
58
- *.sdf
59
- *.opendb
60
- *.opensdf
61
- a.out
62
- libsass.js
63
- tester
64
- tester.exe
65
- build/
66
- config.h.in*
67
- lib/pkgconfig/
68
-
69
- bin/*
70
- .deps/
71
- .libs/
72
- win/bin
73
- *.user
74
- win/*.db
75
-
76
- # Final results
77
-
78
- sassc++
79
- libsass.la
80
- src/support/libsass.pc
81
-
82
- # Cloned testing dirs
83
- sassc/
84
- sass-spec/
85
-
86
- installer/