Skip to content

Commit 79556f6

Browse files
committed
Fix compile time version for sassc plugin
1 parent 8b5aa9f commit 79556f6

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Makefile.PL

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ push @incs, '.', 'libsass/include';
5959

6060
# query version of libsass dep
6161
my $libsass_version = '[na]';
62+
my $sassc_version = '[na]';
6263

6364
sub help
6465
{
@@ -237,7 +238,6 @@ if (-d ".git" && !$skip_git)
237238
open $manifest, ">:encoding(UTF-8)", "MANIFEST";
238239
die "could not create MANIFEST: $!" unless $manifest;
239240
print $manifest "MANIFEST\n";
240-
print $manifest "libsass/VERSION\n";
241241
while (my $module = shift @modules)
242242
{
243243
my $cwd = Cwd::getcwd;
@@ -249,7 +249,7 @@ if (-d ".git" && !$skip_git)
249249
}
250250
my @items = split(/\n+/, $files);
251251
my @files = grep { ! -d } @items;
252-
print $manifest grep { ! /\"/ }
252+
print $manifest grep { ! /\"/ } # "
253253
map { tr/\\/\//; $_ . "\n" }
254254
map { File::Spec->abs2rel($_, $base) } @files;
255255
push @modules,
@@ -272,7 +272,8 @@ if (-d ".git" && !$skip_git)
272272
foreach my $submodule (@submodules)
273273
{
274274
if (-e "$submodule/.git" && !$skip_version) {
275-
next unless $submodule eq "libsass"; # skip all others for now
275+
next unless $submodule eq "libsass" || $submodule eq "plugins/sassc";
276+
print $manifest "$submodule/VERSION\n";
276277
system "git -C \"$submodule\" describe --abbrev=8 --dirty --always --tags > \"$submodule/VERSION\"";
277278
}
278279
}
@@ -288,11 +289,28 @@ if (-f "libsass/VERSION") {
288289
$libsass_version = <$fh> if (defined $fh);
289290
chomp($libsass_version);
290291
print "Detected libsass $libsass_version\n";
292+
# create compile flags to include the libsass version
293+
push @defs, qq(LIBSASS_VERSION=\\"$libsass_version\\");
291294
} else {
292295
# give a warning if the version could not be determined (probably not generated yet)
293296
warn "Could not get version for libsass (", $libsass_version, ")\n";
294297
}
295298

299+
if ($install_sassc) {
300+
# read version from version file
301+
if (-f "plugins/sassc/VERSION") {
302+
open (my $fh, "<", "plugins/sassc/VERSION");
303+
$sassc_version = <$fh> if (defined $fh);
304+
chomp($sassc_version);
305+
print "Detected sassc $sassc_version\n";
306+
# create compile flags to include the libsass version
307+
push @defs, qq(SASSC_VERSION=\\"$sassc_version\\");
308+
} else {
309+
# give a warning if the version could not be determined (probably not generated yet)
310+
warn "Could not get version for sassc (", $sassc_version, ")\n";
311+
}
312+
}
313+
296314
################################################################################
297315
# compiler configurations
298316
################################################################################
@@ -358,9 +376,6 @@ push @flags, '-o $*.o' if ($guess->is_gcc);
358376
# this fixes some clang issues (is detected as gcc)
359377
# push @flags, '-stdlib=libstdc++' if ($guess->is_gcc);
360378

361-
# create compile flags to include the libsass version
362-
push @defs, qq(LIBSASS_VERSION=\\"$libsass_version\\");
363-
364379
# enable code profiling via gcov
365380
$optimize = '-O1' if $profiling;
366381
push @libs, '-lgcov' if $profiling;

0 commit comments

Comments
 (0)