@@ -49,7 +49,7 @@ my $skip_manifest = env_option 'PSASS_SKIP_MANIFEST', 0;
49
49
my $skip_version = env_option ' PSASS_SKIP_VERSION' , 0;
50
50
my $update_deps = env_option ' PSASS_UPDATE_DEPS' , 0;
51
51
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;
53
53
my $skip_git = env_option ' PSASS_SKIP_GIT' , 0;
54
54
55
55
# arrays for various switches
@@ -81,7 +81,7 @@ sub help
81
81
print " --checkout-deps Checkout submodules at linked commit (needs git repo)\n " ;
82
82
print " --get-versions Show versions of all perl package (.pm) files\n " ;
83
83
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";
85
85
print " --skip-git Do not try to use anything git related\n " ;
86
86
print " \n " ;
87
87
print " You may use environment variables to set any option\n " ;
@@ -163,7 +163,7 @@ GetOptions(
163
163
' --library!' => \$install_library ,
164
164
' --compiler:s' => \$compiler ,
165
165
' --profiling!' => \$profiling ,
166
- ' --patch-gcc44' => \$patch_gcc44 ,
166
+ # '--patch-gcc44' => \$patch_gcc44,
167
167
' --skip-git!' => \$skip_git ,
168
168
' --skip-version!' => \$skip_version ,
169
169
' --skip-manifest!' => \$skip_manifest ,
@@ -318,24 +318,29 @@ if ($install_sassc) {
318
318
# patch sources
319
319
# ###############################################################################
320
320
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
+ # }
334
334
335
335
# ###############################################################################
336
336
# compiler configurations
337
337
# ###############################################################################
338
338
339
+ unless (defined $compiler ) {
340
+ $compiler = $ENV {' CC' } || $ENV {' CXX' };
341
+ $compiler =~ s /\+ +$// if $compiler ;
342
+ }
343
+
339
344
my $guess = ExtUtils::CppGuess-> new(
340
345
(defined ($compiler ) ? (cc => $compiler ) : ()),
341
346
);
@@ -350,16 +355,37 @@ if ($guess->is_gcc) {
350
355
$cc_version = sprintf (" %d .%d .%d " , $1 , $2 , $3 );
351
356
$guess -> {' gcc_version' } = $cc_version ;
352
357
print " Detected GCC compiler $cc_version ...\n " ;
353
- if ($1 < 4 || ($1 == 4 && $2 < 4 )) {
358
+ if ($1 < 4 || ($1 == 4 && $2 < 7 )) {
354
359
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
357
363
}
358
364
}
359
365
else {
360
366
print " Detected GCC compiler (version unknown) ...\n " ;
361
367
}
362
368
}
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
+ }
363
389
# we never really tested compilation via MSVC yet ...
364
390
elsif ($guess -> is_msvc) { print " Detected MSVC compiler ...\n " ; }
365
391
else { print " Unknown compiler, trying anyway...\n " ; }
0 commit comments