@@ -39,6 +39,7 @@ my $debug_mode = 0;
39
39
my $install_sassc = 0;
40
40
my $install_plugins = 1;
41
41
my $install_library = 0;
42
+ my $native_watcher = 0;
42
43
my $compiler = undef ;
43
44
my $profiling = 0;
44
45
my $skip_manifest = 0;
@@ -62,6 +63,7 @@ sub help
62
63
print " --sassc Install optional sassc cli utility\n " ;
63
64
print " --plugins Install optional libsass plugins (default)\n " ;
64
65
print " --library Install libsass library (auto-enabled)\n " ;
66
+ print " --native-watcher Depend on optimized file watcher module\n " ;
65
67
print " --help This help screen\n " ;
66
68
print " \n The following options are for developers only:\n\n " ;
67
69
print " --debug Build libsass in debug mode\n " ;
@@ -153,6 +155,7 @@ GetOptions(
153
155
' --skip-git!' => \$skip_git ,
154
156
' --skip-version!' => \$skip_version ,
155
157
' --skip-manifest!' => \$skip_manifest ,
158
+ ' --native-watcher!' => \$native_watcher ,
156
159
# options for git submodules
157
160
' --update-deps!' => \$update_deps ,
158
161
' --checkout-deps!' => \$checkout_deps ,
@@ -416,14 +419,41 @@ if ($EMMV > 7.10 && $EMMV < 7.20) {
416
419
}
417
420
}
418
421
422
+ # ###############################################################################
423
+ # Emit a message to inform user of suboptimal watch behavior
424
+ # Filesys::Notify::KQueue will use inefficient polling scans
425
+ # ###############################################################################
426
+
427
+ # stores choosen matcher
428
+ my $watchdeps = undef ;
429
+
430
+ # list watchers per OS
431
+ my %watchers = (
432
+ ' linux' => [ ' Linux::Inotify2' , 0.01 ],
433
+ ' darwin' => [ ' Mac::FSEvents' , 0.01 ],
434
+ ' freebsd' => [ ' Filesys::Notify::KQueue' , 0.01 ],
435
+ ' MSWin32' => [ ' Win32::ChangeNotify' , 0.01 ],
436
+ ' cygwin' => [ ' Win32::ChangeNotify' , 0.01 ]
437
+ );
438
+
439
+ # check if dependency is wanted and/or available
440
+ if (exists $watchers {$^O} && ! $ENV {PERL_FNS_NO_OPT }) {
441
+ if ($native_watcher ) { $watchdeps = $watchers {$^O}; }
442
+ elsif (!eval { require $watchers {$^O}-> [0]; return 1; }) {
443
+ warn " Consider installing $watchers {$^O}->[0]\n " ;
444
+ warn " Or configure with `--native-watcher` option\n " ;
445
+ }
446
+ }
447
+
419
448
# ###############################################################################
420
449
# See lib/ExtUtils/MakeMaker.pm for details of how to
421
450
# influence content of the Makefile that is written.
422
451
# ###############################################################################
423
452
424
453
my %WriteMakefile = (
425
454
NAME => ' CSS::Sass' ,
426
- VERSION_FROM => ' lib/CSS/Sass.pm' , # finds $VERSION, requires EU::MM from perl >= 5.5
455
+ # finds $VERSION, requires EU::MM from perl >= 5.5
456
+ VERSION_FROM => ' lib/CSS/Sass.pm' ,
427
457
# runtime dependencies
428
458
PREREQ_PM => {
429
459
# 'perl' => 5.008000,
@@ -432,13 +462,20 @@ my %WriteMakefile = (
432
462
' warnings' => 0, # core as of 5.008
433
463
' strict' => 0, # core as of 5.008,
434
464
# dependencies for psass cli tool
465
+ # 'Benchmark' => 0.01,
435
466
' Getopt::Long' => 0.01,
436
467
' Encode::Locale' => 0.01,
437
468
# dependencies for file watcher
438
- ' List::Util' => 1.45,
469
+ # uniq only available since 1.45
470
+ ' List::Util' => 1.45, # core as of 5.008
439
471
# this is an optional dependency
440
- # not sure if we want to force it
441
- # 'Filesys::Notify::Simple' => 0.01,
472
+ # only needed for psass filewatcher
473
+ ' Filesys::Notify::Simple' => 0.01,
474
+ # it doesn't have any dependencies
475
+ # but you may want to install one of
476
+ # Linux::Inotify2, Win32::ChangeNotify
477
+ # Mac::FSEvents, Filesys::Notify::KQueue
478
+ $watchdeps ? @{$watchdeps } : (),
442
479
},
443
480
# test dependencies
444
481
TEST_REQUIRES => {
0 commit comments