Skip to content

Commit

Permalink
Merge pull request #43 from sass/develop
Browse files Browse the repository at this point in the history
Bump to LibSass version 3.6.4.
  • Loading branch information
mgreter committed May 1, 2020
2 parents d95a2df + 18d7e40 commit 5db54f2
Show file tree
Hide file tree
Showing 16 changed files with 152 additions and 57 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ compiler:
- gcc

perl:
- "5.20"
- "5.18"
- "5.16"
- "5.14"
- "5.12"
- "5.30"
- "5.28"
- "5.26"
- "5.24"
- "5.22"

install:
# Deal with dependencies
Expand Down
23 changes: 23 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
CSS::Sass (3.6.2)

Updating libsass to version 3.6.4
https://github.com/sass/libsass/releases/tag/3.6.4

* Bumped libsass version to latest 3.6 stable branch (3.6.4)
* CPAN release for 3.6.1 was skipped due to regressions
* GCC 4.4 support was removed for now (might not come back)

-- Marcel Greter <perl-libsass@ocbnet.ch> Thu, 1 May 2020 13:46:07 +0100

CSS::Sass (3.6.1)

Updating libsass to version 3.6.3
Improves extend compatibility with dart-sass
https://github.com/sass/libsass/releases/tag/3.6.3

* Bumped libsass version to latest 3.6 stable branch (3.6.3)
* Fixed issue with building plugins on Mac OSX (#41)
* Updated sass-spec and adjusted spec runner

-- Marcel Greter <perl-libsass@ocbnet.ch> Mon, 4 Nov 2019 12:00:00 +0200

CSS::Sass (3.6.0)

First release with next major libsass version
Expand Down
2 changes: 1 addition & 1 deletion META.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@
"url" : "https://github.com/sass/perl-libsass"
}
},
"version" : "v3.6.0"
"version" : "v3.6.2"
}
2 changes: 1 addition & 1 deletion META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ resources:
homepage: https://metacpan.org/release/CSS-Sass
license: http://opensource.org/licenses/MIT
repository: https://github.com/sass/perl-libsass
version: v3.6.0
version: v3.6.2
99 changes: 73 additions & 26 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ my $skip_manifest = env_option 'PSASS_SKIP_MANIFEST', 0;
my $skip_version = env_option 'PSASS_SKIP_VERSION', 0;
my $update_deps = env_option 'PSASS_UPDATE_DEPS', 0;
my $checkout_deps = env_option 'PSASS_CHECKOUT_DEPS', 0;
my $patch_gcc44 = env_option 'PSASS_PATCH_GCC44', 0;
# my $patch_gcc44 = env_option 'PSASS_PATCH_GCC44', 0;
my $skip_git = env_option 'PSASS_SKIP_GIT', 0;

# arrays for various switches
Expand Down Expand Up @@ -81,7 +81,7 @@ sub help
print " --checkout-deps Checkout submodules at linked commit (needs git repo)\n";
print " --get-versions Show versions of all perl package (.pm) files\n";
print " --set-versions Set versions of all perl package (.pm) files\n";
print " --patch-gcc44 Patch libsass for gcc44 compatibility\n";
# print " --patch-gcc44 Patch libsass for gcc44 compatibility\n";
print " --skip-git Do not try to use anything git related\n";
print "\n";
print " You may use environment variables to set any option\n";
Expand Down Expand Up @@ -163,7 +163,7 @@ GetOptions(
'--library!' => \$install_library,
'--compiler:s' => \$compiler,
'--profiling!' => \$profiling,
'--patch-gcc44' => \$patch_gcc44,
# '--patch-gcc44' => \$patch_gcc44,
'--skip-git!' => \$skip_git,
'--skip-version!' => \$skip_version,
'--skip-manifest!' => \$skip_manifest,
Expand Down Expand Up @@ -306,7 +306,7 @@ if ($install_sassc) {
$sassc_version = <$fh> if (defined $fh);
chomp($sassc_version);
print "Detected sassc $sassc_version\n";
# create compile flags to include the libsass version
# create compile flags to include the sassc version
push @defs, qq(SASSC_VERSION=\\"$sassc_version\\");
} else {
# give a warning if the version could not be determined (probably not generated yet)
Expand All @@ -318,24 +318,29 @@ if ($install_sassc) {
# patch sources
################################################################################

if ($patch_gcc44) {
my $cwd = Cwd::getcwd;
chdir ("libsass") or die "pushd: $!";
print "Patching libsass source for gcc compatibility\n";
foreach my $patch (sort glob("../patches/*.patch")) {
print "applying $patch\n";
# system "git", "am", "--abort";
system "git", "am", "--3way", "--keep-cr",
"--ignore-space-change", "--quiet", $patch;
}
system "perl", "script/replace-range-for-loops.pl";
chdir ($cwd) or die "popd: $!";
}
# if ($patch_gcc44) {
# my $cwd = Cwd::getcwd;
# chdir ("libsass") or die "pushd: $!";
# print "Patching libsass source for gcc compatibility\n";
# foreach my $patch (sort glob("../patches/*.patch")) {
# print "applying $patch\n";
# # system "git", "am", "--abort";
# system "git", "am", "--3way", "--keep-cr",
# "--ignore-space-change", "--quiet", $patch;
# }
# system "perl", "script/replace-range-for-loops.pl";
# chdir ($cwd) or die "popd: $!";
# }

################################################################################
# compiler configurations
################################################################################

unless (defined $compiler) {
$compiler = $ENV{'CC'} || $ENV{'CXX'};
$compiler =~ s/\++$// if $compiler;
}

my $guess = ExtUtils::CppGuess->new(
(defined($compiler) ? (cc => $compiler) : ()),
);
Expand All @@ -350,16 +355,37 @@ if ($guess->is_gcc) {
$cc_version = sprintf("%d.%d.%d", $1, $2, $3);
$guess->{'gcc_version'} = $cc_version;
print "Detected GCC compiler $cc_version ...\n";
if ($1 < 4 || ($1 == 4 && $2 < 4)) {
if ($1 < 4 || ($1 == 4 && $2 < 7)) {
warn "Your GCC Version is too old for LibSass!\n";
warn "Needs at least gcc version 4.4 or higher!\n";
die "Please consider upgrading your GCC compiler!\n";
warn "Needs at least gcc version 4.7 or higher!\n";
warn "Please consider upgrading your GCC compiler!\n";
exit 0; # avoid any CPAN Testers failure reports
}
}
else {
print "Detected GCC compiler (version unknown) ...\n";
}
}
elsif ($guess->is_clang) {
# version not exposed by CppGuess!?
use Capture::Tiny 'capture_merged';
my $cmd = $guess->{cc} . " --version";
my $cc_version = capture_merged { system($cmd) };
if ($cc_version =~ m/clang\s+(?:version)?\s+(\d+)\.(\d+)\.(\d+)\s+\([^\)]+\)\r?\n/i) {
$cc_version = sprintf("%d.%d.%d", $1, $2, $3);
$guess->{'gcc_version'} = $cc_version;
print "Detected CLANG compiler $cc_version ...\n";
if ($1 < 3 || ($1 == 3 && $2 < 3)) {
warn "Your CLANG Version is too old for LibSass!\n";
warn "Needs at least clang version 3.3 or higher!\n";
warn "Please consider upgrading your clang compiler!\n";
exit 0; # avoid any CPAN Testers failure reports
}
}
else {
print "Detected CLANG compiler (version unknown) ...\n";
}
}
# we never really tested compilation via MSVC yet ...
elsif ($guess->is_msvc) { print "Detected MSVC compiler ...\n"; }
else { print "Unknown compiler, trying anyway...\n"; }
Expand Down Expand Up @@ -606,7 +632,7 @@ my $static = 0;
my $reported = 0;

sub compile_lib {
my ($mm, $name) = @_;
my ($lib, $mm, $name) = @_;
my @args = (
'$(LD) $(OPTIMIZE) -lstdc++ -shared', "-o ${name}",
);
Expand All @@ -624,6 +650,11 @@ sub compile_lib {
unless ($^O eq 'MSWin32' && $Config{cc} =~ /^cl/) {
push @args, '-Wl,-rpath,\\$$ORIGIN/../..';
}
# add explicit library name on OSX
if ($^O eq 'darwin') {
push @args, '-Wl,-install_name,' . $lib;
# push @args, '-Wl,-rpath,@loader_path/../..';
}
# -static-libgcc -static-libstdc++
return join(' ', @args, @libs);
}
Expand All @@ -643,6 +674,10 @@ sub libsass_sassc
}
# otherwise we asume gcc
else {
# On windows there is nothing like rpath for dll load paths
# So dll and sassc would need to be in same directory
# For now we just fall back to link sassc statically
my $static = $static || $^O eq 'MSWin32';
# create the sassc executable by linking against sassc and libsass
push @ret, "\t" . '$(LD) -o $(SASSC_EXE) $(LDFLAGS) -lm $(SASSC_OBJ) $(LIBS)'
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHAUTODIR) -lsass -lstdc++')
Expand All @@ -667,7 +702,7 @@ sub libsass_lib
# create the target for the makefile
push @ret, '$(LIBSASS_LIB): $(LIBSASS_OBJ)';
# create the libsass shared library by linking against all objects
push @ret, "\t" . compile_lib($_[0], '$(LIBSASS_LIB)') . ' $(LIBSASS_OBJ)';
push @ret, "\t" . compile_lib('libsass.$(SO)', $_[0], '$(LIBSASS_LIB)') . ' $(LIBSASS_OBJ)';
# add target to virtual "pure_all"
push @cleanups, '$(LIBSASS_OBJ)';
push @cleanups, '$(LIBSASS_LIB)';
Expand All @@ -686,8 +721,11 @@ sub libsass_plugin_math
# make sure the plugin path exists for output
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/math';
# create the libsass shared library by linking against all objects
push @ret, "\t" . compile_lib($_[0], '$(MATH_LIB)') . ' $(MATH_OBJ)'
push @ret, "\t" . compile_lib('math.$(SO)', $_[0], '$(MATH_LIB)') . ' $(MATH_OBJ)'
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHAUTODIR) -lsass -lstdc++');
# change dynamic loading of libsass.dylib to look relative to ourself (only on mac)
push @ret, "\t" . 'install_name_tool -change libsass.dylib @loader_path/../../libsass.dylib'
. ' $(MATH_LIB)' if ($^O eq 'darwin' && !$static);
# add target to virtual "pure_all"
push @cleanups, '$(MATH_OBJ)';
push @cleanups, '$(MATH_LIB)';
Expand All @@ -706,8 +744,11 @@ sub libsass_plugin_img_size
# make sure the plugin path exists for output
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/img-size';
# create the libsass shared library by linking against all objects
push @ret, "\t" . compile_lib($_[0], '$(IMG_SIZE_LIB)') . ' $(IMG_SIZE_OBJ)'
push @ret, "\t" . compile_lib('img-size.$(SO)', $_[0], '$(IMG_SIZE_LIB)') . ' $(IMG_SIZE_OBJ)'
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHAUTODIR) -lsass -lstdc++');
# change dynamic loading of libsass.dylib to look relative to ourself (only on mac)
push @ret, "\t" . 'install_name_tool -change libsass.dylib @loader_path/../../libsass.dylib'
. ' $(IMG_SIZE_LIB)' if ($^O eq 'darwin' && !$static);
# add target to virtual "pure_all"
push @cleanups, '$(IMG_SIZE_OBJ)';
push @cleanups, '$(IMG_SIZE_LIB)';
Expand All @@ -731,8 +772,11 @@ sub libsass_plugin_digest
# make sure the plugin path exists for output
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/digest';
# create the libsass shared library by linking against all objects
push @ret, "\t" . compile_lib($_[0], '$(DIGEST_LIB)') . ' $(DIGEST_OBJ)'
push @ret, "\t" . compile_lib('digest.$(SO)', $_[0], '$(DIGEST_LIB)') . ' $(DIGEST_OBJ)'
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHAUTODIR) -lsass -lstdc++');
# change dynamic loading of libsass.dylib to look relative to ourself (only on mac)
push @ret, "\t" . 'install_name_tool -change libsass.dylib @loader_path/../../libsass.dylib'
. ' $(DIGEST_LIB)' if ($^O eq 'darwin' && !$static);
# add target to virtual "pure_all"
push @cleanups, '$(DIGEST_OBJ)';
push @cleanups, '$(DIGEST_LIB)';
Expand All @@ -756,8 +800,11 @@ sub libsass_plugin_glob
# make sure the plugin path exists for output
push @ret, "\t" . '$(MKPATH) $(INST_ARCHAUTODIR)/plugins/glob';
# create the libsass shared library by linking against all objects
push @ret, "\t" . compile_lib($_[0], '$(GLOB_LIB)') . ' $(GLOB_OBJ)'
push @ret, "\t" . compile_lib('glob.$(SO)', $_[0], '$(GLOB_LIB)') . ' $(GLOB_OBJ)'
. ' ' . ($static ? '$(LIBSASS_OBJ)' : '-L$(INST_ARCHAUTODIR) -lsass -lstdc++');
# change dynamic loading of libsass.dylib to look relative to ourself (only on mac)
push @ret, "\t" . 'install_name_tool -change libsass.dylib @loader_path/../../libsass.dylib'
. ' $(GLOB_LIB)' if ($^O eq 'darwin' && !$static);
# add target to virtual "pure_all"
push @cleanups, '$(GLOB_OBJ)';
push @cleanups, '$(GLOB_LIB)';
Expand Down
2 changes: 1 addition & 1 deletion lib/CSS/Sass.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ our @EXPORT = qw(
SASS2SCSS_CONVERT_COMMENT
);

our $VERSION = "3.6.0";
our $VERSION = "3.6.2";

require XSLoader;
XSLoader::load('CSS::Sass', $VERSION);
Expand Down
2 changes: 1 addition & 1 deletion lib/CSS/Sass/Plugins.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use warnings;

################################################################################
package CSS::Sass::Plugins;
our $VERSION = "3.6.0";
our $VERSION = "3.6.2";
################################################################################
# collect plugins
our %plugins;
Expand Down
2 changes: 1 addition & 1 deletion lib/CSS/Sass/Value.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use CSS::Sass;

################################################################################
package CSS::Sass::Value;
our $VERSION = "3.6.0";
our $VERSION = "3.6.2";
################################################################################
use CSS::Sass qw(import_sv);
use CSS::Sass qw(sass_operation);
Expand Down
2 changes: 1 addition & 1 deletion lib/CSS/Sass/Watchdog.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use CSS::Sass;

################################################################################
package CSS::Sass::Watchdog;
our $VERSION = "3.6.0";
our $VERSION = "3.6.2";
################################################################################

use Exporter 'import'; # gives you Exporter's import() method directly
Expand Down
2 changes: 1 addition & 1 deletion libsass
Submodule libsass updated 161 files
2 changes: 1 addition & 1 deletion patches/0006-Fix-keywords-override-final-and-nullptr.patch
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ index 014e4fa1..df49612a 100644
+ #define GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+ #if GCC_VERSION < 40500
+ #if GCC_VERSION < 40600
+ #define nullptr NULL
+ // just consume them
+ #define override
Expand Down
2 changes: 1 addition & 1 deletion plugins/sassc
Submodule sassc updated 1 files
+6 −0 win/sassc.vcxproj
2 changes: 1 addition & 1 deletion t/01_xs.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN { use_ok('CSS::Sass') };
my $r;
$r = CSS::Sass::compile_sass("this is invalid sass source", {});
is ($r->{error_status}, 1, "Failed compile sets error_status");
like($r->{error_message}, qr/on line 1:22 of stdin/, "Failed compile sets error_message");
like($r->{error_message}, qr/on line 1:28 of stdin/, "Failed compile sets error_message");
is ($r->{output_string}, undef, "Failed compile sets output_string to undef");

$r = CSS::Sass::compile_sass(".valid { color: red; }", {});
Expand Down
12 changes: 6 additions & 6 deletions t/02_perl.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $r = $sass->compile(".valid { color: red; }");
isnt ($r, undef, "Successful compile returns something");

$r = eval { $sass->compile("this is invalid sass source") };
like ($@, qr/on line 1:22 of stdin/, "Failed compile dies with error message");
like ($@, qr/on line 1:28 of stdin/, "Failed compile dies with error message");

$sass->options->{dont_die} = 1;
eval {
Expand All @@ -23,7 +23,7 @@ eval {
};
fail ( "dont_die option doesn't die") if $@;
is ($r, undef, "dont_die option returns undef on error");
like ($sass->last_error, qr/on line 1:22 of stdin/, "Failed compile saves error message in last_error");
like ($sass->last_error, qr/on line 1:28 of stdin/, "Failed compile saves error message in last_error");


$sass->options->{dont_die} = 0;
Expand All @@ -47,7 +47,7 @@ is ($err, undef, "Successful compile returns no errors")

($r, $err) = sass_compile("this is invalid sass source");
is ($r, undef, "Failed compile returns no code");
like ($err, qr/on line 1:22 of stdin/, "Failed compile returns an error");
like ($err, qr/on line 1:28 of stdin/, "Failed compile returns an error");

$r = sass_compile(".valid { color: red; }");
isnt ($r, undef, "Successful compile scalar context returns something");
Expand Down Expand Up @@ -84,7 +84,7 @@ $fh->autoflush(); binmode $fh;
print $fh "this is invalid sass source";
close $fh;
$r = eval { $sass->compile_file($filename) };
like ($@, qr/on line 1:22 of .*\.scss/, "Failed compile dies with error message");
like ($@, qr/on line 1:28 of .*\.scss/, "Failed compile dies with error message");

($fh, $filename) = tempfile( SUFFIX => '.scss');
$fh->autoflush(); binmode $fh;
Expand All @@ -97,7 +97,7 @@ eval {
};
fail ( "dont_die option doesn't die") if $@;
is ($r, undef, "dont_die option returns undef on error");
like ($sass->last_error, qr/on line 1:22 of .*\.scss/, "Failed compile saves error message in last_error");
like ($sass->last_error, qr/on line 1:28 of .*\.scss/, "Failed compile saves error message in last_error");


($fh, $filename) = tempfile( SUFFIX => '.scss');
Expand Down Expand Up @@ -140,7 +140,7 @@ print $fh "this is invalid sass source";
close $fh;
($r, $err) = sass_compile_file($filename);
is ($r, undef, "Failed compile returns no code");
like ($err, qr/on line 1:22 of .*\.scss/, "Failed compile returns an error");
like ($err, qr/on line 1:28 of .*\.scss/, "Failed compile returns an error");

($fh, $filename) = tempfile( SUFFIX => '.scss');
$fh->autoflush(); binmode $fh;
Expand Down
Loading

0 comments on commit 5db54f2

Please sign in to comment.