summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--make/configure.pm14
-rw-r--r--make/console.pm16
-rw-r--r--make/directive.pm22
3 files changed, 23 insertions, 29 deletions
diff --git a/make/configure.pm b/make/configure.pm
index dcdcd0aca..86ce8d0a1 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -199,8 +199,8 @@ sub cmd_update {
sub run_test($$;$) {
my ($what, $result, $adjective) = @_;
$adjective //= 'available';
- print_format "Checking whether <|GREEN $what|> is $adjective ... ";
- print_format $result ? "<|GREEN yes|>\n" : "<|RED no|>\n";
+ print console_format "Checking whether <|GREEN $what|> is $adjective ... ";
+ say console_format $result ? "<|GREEN yes|>" : "<|RED no|>";
return $result;
}
@@ -237,11 +237,11 @@ sub module_shrink($) {
sub write_configure_cache(%) {
unless (-e CONFIGURE_DIRECTORY) {
- print_format "Creating <|GREEN ${\abs2rel CONFIGURE_DIRECTORY, CONFIGURE_ROOT}|> ...\n";
+ say console_format "Creating <|GREEN ${\abs2rel CONFIGURE_DIRECTORY, CONFIGURE_ROOT}|> ...";
create_directory CONFIGURE_DIRECTORY, 0750 or print_error "unable to create ${\CONFIGURE_DIRECTORY}: $!";
}
- print_format "Writing <|GREEN ${\abs2rel CONFIGURE_CACHE_FILE, CONFIGURE_ROOT}|> ...\n";
+ say console_format "Writing <|GREEN ${\abs2rel CONFIGURE_CACHE_FILE, CONFIGURE_ROOT}|> ...";
my %config = @_;
write_config_file CONFIGURE_CACHE_FILE, %config;
}
@@ -277,7 +277,7 @@ sub parse_templates($$$) {
# Iterate through files in make/template.
foreach my $template (<${\CONFIGURE_ROOT}/make/template/*>) {
- print_format "Parsing <|GREEN ${\abs2rel $template, CONFIGURE_ROOT}|> ...\n";
+ say console_format "Parsing <|GREEN ${\abs2rel $template, CONFIGURE_ROOT}|> ...";
open(my $fh, $template) or print_error "unable to read $template: $!";
my (@lines, $mode, @platforms, @targets);
@@ -336,12 +336,12 @@ sub parse_templates($$$) {
# Create the directory if it doesn't already exist.
my $directory = dirname $target;
unless (-e $directory) {
- print_format "Creating <|GREEN ${\abs2rel $directory, CONFIGURE_ROOT}|> ...\n";
+ say console_format "Creating <|GREEN ${\abs2rel $directory, CONFIGURE_ROOT}|> ...";
create_directory $directory, 0750 or print_error "unable to create $directory: $!";
};
# Write the template file.
- print_format "Writing <|GREEN ${\abs2rel $target, CONFIGURE_ROOT}|> ...\n";
+ say console_format "Writing <|GREEN ${\abs2rel $target, CONFIGURE_ROOT}|> ...";
open(my $fh, '>', $target) or print_error "unable to write $target: $!";
foreach (@lines) {
say $fh $_;
diff --git a/make/console.pm b/make/console.pm
index 50df77ea5..cd2a780e7 100644
--- a/make/console.pm
+++ b/make/console.pm
@@ -31,7 +31,6 @@ use File::Spec::Functions qw(rel2abs);
our @EXPORT = qw(command
execute_command
console_format
- print_format
print_error
print_warning
prompt_bool
@@ -69,12 +68,6 @@ sub console_format($) {
return $message;
}
-sub print_format($;$) {
- my $message = shift;
- my $stream = shift // *STDOUT;
- print { $stream } console_format $message;
-}
-
sub print_error {
print STDERR console_format "<|RED Error:|> ";
for my $line (@_) {
@@ -120,7 +113,7 @@ sub prompt_string($$$) {
my ($interactive, $question, $default) = @_;
return $default unless $interactive;
say console_format $question;
- say console_format "[<|GREEN $default|>] => ";
+ print console_format "[<|GREEN $default|>] => ";
chomp(my $answer = <STDIN>);
say '';
return $answer ? $answer : $default;
@@ -143,13 +136,14 @@ sub command_alias($$) {
sub execute_command(@) {
my $command = defined $_[0] ? lc shift : 'help';
if ($command eq 'help') {
- print_format "<|GREEN Usage:|> $0 <<|UNDERLINE COMMAND|>> [<|UNDERLINE OPTIONS...|>]\n\n";
- print_format "<|GREEN Commands:|>\n";
+ say console_format "<|GREEN Usage:|> $0 <<|UNDERLINE COMMAND|>> [<|UNDERLINE OPTIONS...|>]";
+ say '';
+ say console_format "<|GREEN Commands:|>";
for my $key (sort keys %commands) {
next unless defined $commands{$key}->description;
my $name = sprintf "%-15s", $key;
my $description = $commands{$key}->description;
- print_format " <|BOLD $name|> # $description\n";
+ say console_format " <|BOLD $name|> # $description";
}
exit 0;
} elsif (!$commands{$command}) {
diff --git a/make/directive.pm b/make/directive.pm
index 25e61160e..cd1aff426 100644
--- a/make/directive.pm
+++ b/make/directive.pm
@@ -145,7 +145,7 @@ sub __function_execute {
# Try to execute the command...
chomp(my $result = `$command ${\DIRECTIVE_ERROR_PIPE}`);
unless ($?) {
- print_format "Execution of `<|GREEN $command|>` succeeded: <|BOLD $result|>\n";
+ say console_format "Execution of `<|GREEN $command|>` succeeded: <|BOLD $result|>";
return $result;
}
@@ -153,14 +153,14 @@ sub __function_execute {
if (defined $environment && $environment ne '') {
$environment = __environment 'INSPIRCD_', $environment;
if (defined $ENV{$environment}) {
- print_format "Execution of `<|GREEN $command|>` failed; using the environment: <|BOLD $ENV{$environment}|>\n";
+ say console_format "Execution of `<|GREEN $command|>` failed; using the environment: <|BOLD $ENV{$environment}|>";
return $ENV{$environment};
}
}
# If all else fails then look for the defaults..
if (defined $defaults) {
- print_format "Execution of `<|GREEN $command|>` failed; using the defaults: <|BOLD $defaults|>\n";
+ say console_format "Execution of `<|GREEN $command|>` failed; using the defaults: <|BOLD $defaults|>";
return $defaults;
}
@@ -174,20 +174,20 @@ sub __function_find_compiler_flags {
# Try to look up the compiler flags with pkg-config...
chomp(my $flags = `pkg-config --cflags $name ${\DIRECTIVE_ERROR_PIPE}`);
unless ($?) {
- print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>\n";
+ say console_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>";
return $flags;
}
# If looking up with pkg-config fails then check the environment...
my $key = __environment 'INSPIRCD_CXXFLAGS_', $name;
if (defined $ENV{$key}) {
- print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+ say console_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
return $ENV{$key};
}
# If all else fails then look for the defaults..
if (defined $defaults) {
- print_format "Using the default <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>\n";
+ say console_format "Using the default <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>";
return $defaults;
}
@@ -201,20 +201,20 @@ sub __function_find_linker_flags {
# Try to look up the linker flags with pkg-config...
chomp(my $flags = `pkg-config --libs $name ${\DIRECTIVE_ERROR_PIPE}`);
unless ($?) {
- print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>\n";
+ say console_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>";
return $flags;
}
# If looking up with pkg-config fails then check the environment...
my $key = __environment 'INSPIRCD_CXXFLAGS_', $name;
if (defined $ENV{$key}) {
- print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+ say console_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
return $ENV{$key};
}
# If all else fails then look for the defaults..
if (defined $defaults) {
- print_format "Using the default <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>\n";
+ say console_format "Using the default <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>";
return $defaults;
}
@@ -287,13 +287,13 @@ sub __function_vendor_directory {
# Try to look the directory up in the environment...
my $key = __environment 'INSPIRCD_VENDOR_', $name;
if (defined $ENV{$key}) {
- print_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+ say console_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
return $ENV{$key};
}
my $directory = catdir(VENDOR_DIRECTORY, $name);
if (-d $directory) {
- print_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|>: <|BOLD $directory|>\n";
+ say console_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|>: <|BOLD $directory|>";
return $directory;
}