]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Refer to modules without the m_ prefix in error messages
authorPeter Powell <petpow@saberuk.com>
Tue, 16 Jul 2019 09:25:35 +0000 (10:25 +0100)
committerPeter Powell <petpow@saberuk.com>
Tue, 16 Jul 2019 09:25:35 +0000 (10:25 +0100)
make/directive.pm

index c0c2aee85039bb297ba9f016d8fb233ab032276f..cdf869e5ec62d9d832ab4d684e53d384c3158835 100644 (file)
@@ -89,6 +89,13 @@ sub __environment {
        return $prefix . uc $suffix;
 }
 
+sub __module {
+       my $file = shift;
+       my $name = basename $file, '.cpp';
+       $name =~ s/^m_//;
+       return $name;
+}
+
 sub __error {
        my ($file, @message) = @_;
        push @message, '';
@@ -174,25 +181,25 @@ 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 ${\basename $file, '.cpp'}|> using pkg-config: <|BOLD $flags|>\n";
+               print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\__module $file}|> using pkg-config: <|BOLD $flags|>\n";
                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 ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\__module $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
                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 ${\basename $file, '.cpp'}|>: <|BOLD $defaults|>\n";
+               print_format "Using the default <|GREEN $name|> compiler flags for <|GREEN ${\__module $file}|>: <|BOLD $defaults|>\n";
                return $defaults;
        }
 
        # We can't find it via pkg-config, via the environment, or via the defaults so give up.
-       __error $file, "unable to find the <|GREEN $name|> compiler flags for <|GREEN ${\basename $file, '.cpp'}|>!";
+       __error $file, "unable to find the <|GREEN $name|> compiler flags for <|GREEN ${\__module $file}|>!";
 }
 
 sub __function_find_linker_flags {
@@ -201,25 +208,25 @@ 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 ${\basename $file, '.cpp'}|> using pkg-config: <|BOLD $flags|>\n";
+               print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\__module $file}|> using pkg-config: <|BOLD $flags|>\n";
                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 ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\__module $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
                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 ${\basename $file, '.cpp'}|>: <|BOLD $defaults|>\n";
+               print_format "Using the default <|GREEN $name|> linker flags for <|GREEN ${\__module $file}|>: <|BOLD $defaults|>\n";
                return $defaults;
        }
 
        # We can't find it via pkg-config, via the environment, or via the defaults so give up.
-       __error $file, "unable to find the <|GREEN $name|> linker flags for <|GREEN ${\basename $file, '.cpp'}|>!";
+       __error $file, "unable to find the <|GREEN $name|> linker flags for <|GREEN ${\__module $file}|>!";
 }
 
 sub __function_require_compiler {
@@ -287,18 +294,18 @@ 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 ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               print_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\__module $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
                return $ENV{$key};
        }
 
        my $directory = catdir(VENDOR_DIRECTORY, $name);
        if (-d $directory) {
-               print_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\basename $file, '.cpp'}|>: <|BOLD $directory|>\n";
+               print_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\__module $file}|>: <|BOLD $directory|>\n";
                return $directory;
        }
 
        # We can't find it via the environment or via the filesystem so give up.
-       __error $file, "unable to find the <|GREEN $name|> vendor directory for <|GREEN ${\basename $file, '.cpp'}|>!";
+       __error $file, "unable to find the <|GREEN $name|> vendor directory for <|GREEN ${\__module $file}|>!";
 }
 
 sub __function_warning {