]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Allow `brew update` to fail when running the macOS CI.
[user/henk/code/inspircd.git] / configure
index 2170828463efc088a7b8df82600473b8fa20f7e4..cac9fedb51840b2fa8978dec97f638b5b58a58be 100755 (executable)
--- a/configure
+++ b/configure
@@ -147,7 +147,7 @@ print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
 my %config;
 if ($interactive) {
        %config = read_config_file(CONFIGURE_CACHE_FILE);
-       run_test CONFIGURE_CACHE_FILE, %config;
+       run_test abs2rel(CONFIGURE_CACHE_FILE, $RealDir), %config;
        if (!defined $config{VERSION}) {
                $config{VERSION} = CONFIGURE_CACHE_VERSION;
        } elsif ($config{VERSION} != CONFIGURE_CACHE_VERSION) {
@@ -353,9 +353,9 @@ Would you like to enable extra modules manually?
 EOQ
 if (prompt_bool $interactive, $question, 0) {
        foreach my $extra (<$RealDir/src/modules/extra/m_*.cpp>) {
-               my $module_name = basename $extra, '.cpp';
-               if (prompt_bool $interactive, "Would you like to enable $module_name?", 0) {
-                       enable_extras "$module_name.cpp";
+               my $module_name = module_shrink $extra;
+               if (prompt_bool $interactive, "Would you like to enable the <|BOLD $module_name|> module?", 0) {
+                       enable_extras $module_name;
                }
        }
 } elsif (!defined $opt_disable_auto_extras) {
@@ -363,6 +363,7 @@ if (prompt_bool $interactive, $question, 0) {
        # system './modulemanager', 'enable', '--auto';
        my %modules = (
                # Missing: m_ldap, m_regex_stdlib, m_ssl_mbedtls
+               'm_argon2.cpp'          => 'pkg-config --exists libargon2',
                'm_geo_maxmind.cpp'     => 'pkg-config --exists libmaxminddb',
                'm_mysql.cpp'           => 'mysql_config --version',
                'm_pgsql.cpp'           => 'pg_config --version',
@@ -393,9 +394,10 @@ EOQ
 
 if (<$RealDir/src/modules/m_ssl_*.cpp>) {
        if (prompt_bool $interactive, $question, $interactive) {
-               system './tools/genssl', 'auto';
+               create_directory CONFIGURE_DIRECTORY, 0750 or print_error "unable to create ${\CONFIGURE_DIRECTORY}: $!";
+               system './tools/genssl', 'auto', CONFIGURE_DIRECTORY;
        } else {
-               my @pems = <$RealDir/{cert,csr,dhparams,key}.pem>;
+               my @pems = <${\CONFIGURE_DIRECTORY}/{cert,csr,dhparams,key}.pem>;
                $question = <<EOQ;
 The following self-signed files were previously generated and will be installed
 when you run Make. Do you want to delete them?
@@ -439,8 +441,7 @@ Configuration is complete! You have chosen to build with the following settings:
 EOM
 
 for my $file (<$RealDir/src/modules/m_*>) {
-       my $module = basename $file, '.cpp';
-       say "  * $module" if -l $file;
+       say "  * ${\module_shrink $file}" if -l $file;
 }
 
 my @makeargs;
@@ -488,7 +489,7 @@ sub list_extras () {
        my @sources = map { File::Spec->case_tolerant() ? lc($_) : $_ } (readdir($dd));
        closedir $dd;
        undef $dd;
-       my $maxlen = (sort { $b <=> $a } (map {length($_)} (@extras)))[0];
+       my $maxlen = (sort { $b <=> $a } (map { length module_shrink $_ } (@extras)))[0];
        my %extras = ();
 EXTRA: for my $extra (@extras) {
                next if (File::Spec->curdir() eq $extra || File::Spec->updir() eq $extra);
@@ -556,9 +557,9 @@ EXTRA:      for my $extra (@extras) {
        for my $extra (sort {$a cmp $b} keys(%extras)) {
                my $text = $extras{$extra};
                if ($text =~ m/needed by/ && $text !~ m/enabled/) {
-                       printf "\e[31;1;5m%-*s = %s%s\e[0m\n", $maxlen, $extra, $text, ($text =~ m/needed by/ ? ")" : "");
+                       printf "\e[31;1;5m%-*s = %s%s\e[0m\n", $maxlen, module_shrink($extra), $text, ($text =~ m/needed by/ ? ")" : "");
                } else {
-                       printf "%-*s = %s%s\n", $maxlen, $extra, $text, ($text =~ m/needed by/ ? "\e[0m)" : "");
+                       printf "%-*s = %s%s\n", $maxlen, module_shrink($extra), $text, ($text =~ m/needed by/ ? "\e[0m)" : "");
                }
        }
        return keys(%extras) if wantarray; # Can be used by manage_extras.
@@ -569,8 +570,8 @@ sub enable_extras(@) {
        my $extradir = catdir $moduledir, 'extra';
 
        for my $extra (@_) {
-               my $shortname = $extra =~ s/(?:^m_|\.cpp$)//gr;
-               my $extrafile = "m_$shortname.cpp";
+               my $shortname = module_shrink $extra;
+               my $extrafile = module_expand $extra;
 
                my $extrapath = catfile $extradir, $extrafile;
                if (!-f $extrapath) {
@@ -600,8 +601,8 @@ sub disable_extras(@) {
        my $extradir = catdir $moduledir, 'extra';
 
        for my $extra (@_) {
-               my $shortname = $extra =~ s/(?:^m_|\.cpp$)//gr;
-               my $extrafile = "m_$shortname.cpp";
+               my $shortname = module_shrink $extra;
+               my $extrafile = module_expand $extra;
 
                my $modulepath = catfile $moduledir, $extrafile;
                my $extrapath = catfile $extradir, $extrafile;