Skip to content

Commit 322731b

Browse files
committed
Change Makefile to drop gcc 4.4 support
1 parent bcc23f3 commit 322731b

File tree

1 file changed

+45
-19
lines changed

1 file changed

+45
-19
lines changed

Makefile.PL

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ my $skip_manifest = env_option 'PSASS_SKIP_MANIFEST', 0;
4949
my $skip_version = env_option 'PSASS_SKIP_VERSION', 0;
5050
my $update_deps = env_option 'PSASS_UPDATE_DEPS', 0;
5151
my $checkout_deps = env_option 'PSASS_CHECKOUT_DEPS', 0;
52-
my $patch_gcc44 = env_option 'PSASS_PATCH_GCC44', 0;
52+
# my $patch_gcc44 = env_option 'PSASS_PATCH_GCC44', 0;
5353
my $skip_git = env_option 'PSASS_SKIP_GIT', 0;
5454

5555
# arrays for various switches
@@ -81,7 +81,7 @@ sub help
8181
print " --checkout-deps Checkout submodules at linked commit (needs git repo)\n";
8282
print " --get-versions Show versions of all perl package (.pm) files\n";
8383
print " --set-versions Set versions of all perl package (.pm) files\n";
84-
print " --patch-gcc44 Patch libsass for gcc44 compatibility\n";
84+
# print " --patch-gcc44 Patch libsass for gcc44 compatibility\n";
8585
print " --skip-git Do not try to use anything git related\n";
8686
print "\n";
8787
print " You may use environment variables to set any option\n";
@@ -163,7 +163,7 @@ GetOptions(
163163
'--library!' => \$install_library,
164164
'--compiler:s' => \$compiler,
165165
'--profiling!' => \$profiling,
166-
'--patch-gcc44' => \$patch_gcc44,
166+
# '--patch-gcc44' => \$patch_gcc44,
167167
'--skip-git!' => \$skip_git,
168168
'--skip-version!' => \$skip_version,
169169
'--skip-manifest!' => \$skip_manifest,
@@ -318,24 +318,29 @@ if ($install_sassc) {
318318
# patch sources
319319
################################################################################
320320

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

335335
################################################################################
336336
# compiler configurations
337337
################################################################################
338338

339+
unless (defined $compiler) {
340+
$compiler = $ENV{'CC'} || $ENV{'CXX'};
341+
$compiler =~ s/\++$// if $compiler;
342+
}
343+
339344
my $guess = ExtUtils::CppGuess->new(
340345
(defined($compiler) ? (cc => $compiler) : ()),
341346
);
@@ -350,16 +355,37 @@ if ($guess->is_gcc) {
350355
$cc_version = sprintf("%d.%d.%d", $1, $2, $3);
351356
$guess->{'gcc_version'} = $cc_version;
352357
print "Detected GCC compiler $cc_version ...\n";
353-
if ($1 < 4 || ($1 == 4 && $2 < 4)) {
358+
if ($1 < 4 || ($1 == 4 && $2 < 7)) {
354359
warn "Your GCC Version is too old for LibSass!\n";
355-
warn "Needs at least gcc version 4.4 or higher!\n";
356-
die "Please consider upgrading your GCC compiler!\n";
360+
warn "Needs at least gcc version 4.7 or higher!\n";
361+
warn "Please consider upgrading your GCC compiler!\n";
362+
exit 0; # avoid any CPAN Testers failure reports
357363
}
358364
}
359365
else {
360366
print "Detected GCC compiler (version unknown) ...\n";
361367
}
362368
}
369+
elsif ($guess->is_clang) {
370+
# version not exposed by CppGuess!?
371+
use Capture::Tiny 'capture_merged';
372+
my $cmd = $guess->{cc} . " --version";
373+
my $cc_version = capture_merged { system($cmd) };
374+
if ($cc_version =~ m/clang\s+(?:version)?\s+(\d+)\.(\d+)\.(\d+)\s+\([^\)]+\)\r?\n/i) {
375+
$cc_version = sprintf("%d.%d.%d", $1, $2, $3);
376+
$guess->{'gcc_version'} = $cc_version;
377+
print "Detected CLANG compiler $cc_version ...\n";
378+
if ($1 < 3 || ($1 == 3 && $2 < 3)) {
379+
warn "Your CLANG Version is too old for LibSass!\n";
380+
warn "Needs at least clang version 3.3 or higher!\n";
381+
warn "Please consider upgrading your clang compiler!\n";
382+
exit 0; # avoid any CPAN Testers failure reports
383+
}
384+
}
385+
else {
386+
print "Detected CLANG compiler (version unknown) ...\n";
387+
}
388+
}
363389
# we never really tested compilation via MSVC yet ...
364390
elsif ($guess->is_msvc) { print "Detected MSVC compiler ...\n"; }
365391
else { print "Unknown compiler, trying anyway...\n"; }

0 commit comments

Comments
 (0)