Skip to content

Commit 25018df

Browse files
committed
Allow env variables to configure install
1 parent ebb8051 commit 25018df

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

Makefile.PL

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,23 @@ use warnings;
3333
# commandline options
3434
################################################################################
3535

36+
# tiny helper to get options from environment or provided default
37+
sub env_option($$) { exists $ENV{$_[0]} ? $ENV{$_[0]} : $_[1]; }
38+
3639
# 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;
5053

5154
# arrays for various switches
5255
my (@libs, @flags, @defs, @incs);
@@ -65,7 +68,8 @@ sub help
6568
print " --library Install libsass library (auto-enabled)\n";
6669
print " --native-watcher Depend on optimized file watcher module\n";
6770
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";
6973
print " --debug Build libsass in debug mode\n";
7074
print " --profiling Enable gcov profiling switches\n";
7175
print " --compiler Skips compiler autodetection (passed to CppGuess)\n";
@@ -76,6 +80,10 @@ sub help
7680
print " --get-versions Show versions of all perl package (.pm) files\n";
7781
print " --set-versions Set versions of all perl package (.pm) files\n";
7882
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";
7987
exit 1;
8088
}
8189

0 commit comments

Comments
 (0)