@@ -33,20 +33,23 @@ use warnings;
33
33
# commandline options
34
34
# ###############################################################################
35
35
36
+ # tiny helper to get options from environment or provided default
37
+ sub env_option ($$) { exists $ENV {$_ [0]} ? $ENV {$_ [0]} : $_ [1]; }
38
+
36
39
# command line options
37
- my $optimize = ' -O3' ;
38
- my $debug_mode = 0;
39
- my $install_sassc = 0;
40
- my $install_plugins = 1;
41
- my $install_library = 0;
42
- my $native_watcher = 0;
43
- my $compiler = undef ;
44
- my $profiling = 0;
45
- my $skip_manifest = 0;
46
- my $skip_version = 0;
47
- my $update_deps = 0;
48
- my $checkout_deps = 0;
49
- my $skip_git = 0;
40
+ my $optimize = env_option ' PSASS_OPTIMIZE ' , ' -O3' ;
41
+ my $debug_mode = env_option ' PSASS_DEBUG_MODE ' , 0;
42
+ my $install_sassc = env_option ' PSASS_INSTALL_SASSC ' , 0;
43
+ my $install_plugins = env_option ' PSASS_INSTALL_PLUGINS ' , 1;
44
+ my $install_library = env_option ' PSASS_INSTALL_LIBRARY ' , 0;
45
+ my $native_watcher = env_option ' PSASS_NATIVE_WATCHER ' , 0;
46
+ my $compiler = env_option ' PSASS_COMPILER ' , undef ;
47
+ my $profiling = env_option ' PSASS_PROFILING ' , 0;
48
+ my $skip_manifest = env_option ' PSASS_SKIP_MANIFEST ' , 0;
49
+ my $skip_version = env_option ' PSASS_SKIP_VERSION ' , 0;
50
+ my $update_deps = env_option ' PSASS_UPDATE_DEPS ' , 0;
51
+ my $checkout_deps = env_option ' PSASS_CHECKOUT_DEPS ' , 0;
52
+ my $skip_git = env_option ' PSASS_SKIP_GIT ' , 0;
50
53
51
54
# arrays for various switches
52
55
my (@libs , @flags , @defs , @incs );
@@ -65,7 +68,8 @@ sub help
65
68
print " --library Install libsass library (auto-enabled)\n " ;
66
69
print " --native-watcher Depend on optimized file watcher module\n " ;
67
70
print " --help This help screen\n " ;
68
- print " \n The following options are for developers only:\n\n " ;
71
+ print " \n " ;
72
+ print " The following options are for developers only:\n\n " ;
69
73
print " --debug Build libsass in debug mode\n " ;
70
74
print " --profiling Enable gcov profiling switches\n " ;
71
75
print " --compiler Skips compiler autodetection (passed to CppGuess)\n " ;
@@ -76,6 +80,10 @@ sub help
76
80
print " --get-versions Show versions of all perl package (.pm) files\n " ;
77
81
print " --set-versions Set versions of all perl package (.pm) files\n " ;
78
82
print " --skip-git Do not try to use anything git related\n " ;
83
+ print " \n " ;
84
+ print " You may use environment variables to set any option\n " ;
85
+ print " Prefix them with `PSASS_` and write all in uppercase\n " ;
86
+ print " e.g. --native-watcher becomes PSASS_NATIVE_WATCHER\n " ;
79
87
exit 1;
80
88
}
81
89
0 commit comments