summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2014-10-01 19:52:25 +0100
committerPeter Powell <petpow@saberuk.com>2014-12-07 22:36:42 +0000
commit500a0524d94d596b327ed9aaa17fd0a8ce9ebf96 (patch)
tree56e94dda14aada898d8fedc01bc3519c5ff2c0b2 /make
parent11f4d02e7020cb5775d2b89af0e652e53cd90ed7 (diff)
Miscellaneous improvements to configure.
- Clean up various minor sections of the code. - Remove OpenSSL and GnuTLS detection plumbing. - This will soon be the job of modulemanager. - This did not work in non-interactive mode unlike --enable-extras. - Rework runas user handling. - Add the --gid configure option. - Accept either an id or a name in --gid and --uid. - Rework the question flow in interactive mode. - User is no longer asked detailed questions unless they want them. - Socket engine questions have been removed. - Automatically enable non-interactive mode if STDIN or STDOUT are not a tty.
Diffstat (limited to 'make')
-rw-r--r--make/configure.pm59
-rw-r--r--make/template/main.mk13
-rw-r--r--make/template/org.inspircd.plist4
-rw-r--r--make/test/compiler.cpp29
4 files changed, 70 insertions, 35 deletions
diff --git a/make/configure.pm b/make/configure.pm
index d04a0b645..7cf08e254 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -30,20 +30,27 @@ package make::configure;
use strict;
use warnings FATAL => qw(all);
-use Cwd 'getcwd';
-use Exporter 'import';
-use File::Basename 'basename';
+use Cwd qw(getcwd);
+use Exporter qw(import);
+use File::Basename qw(basename);
use make::console;
use make::utilities;
-our @EXPORT = qw(cmd_clean cmd_help cmd_update
- read_configure_cache write_configure_cache
- get_compiler_info find_compiler
- run_test test_file test_header
- dump_hash get_property parse_templates);
-
-sub __get_socketengines() {
+our @EXPORT = qw(cmd_clean
+ cmd_help
+ cmd_update
+ read_configure_cache
+ write_configure_cache
+ get_compiler_info
+ find_compiler
+ run_test
+ test_file
+ test_header
+ get_property
+ parse_templates);
+
+sub __get_socketengines {
my @socketengines;
foreach (<src/socketengines/socketengine_*.cpp>) {
s/src\/socketengines\/socketengine_(\w+)\.cpp/$1/;
@@ -59,7 +66,7 @@ sub __get_template_settings($$) {
# These are actually hash references
my ($config, $compiler) = @_;
- # Start off by populating with the config
+ # Start off by populating with the config
my %settings = %$config;
# Compiler information
@@ -112,11 +119,11 @@ PATH OPTIONS
[$PWD/run/data]
--log-dir=[dir] The location where the log files are stored.
[$PWD/run/logs]
+ --manual-dir=[dir] The location where the manual files are stored.
+ [$PWD/run/manuals]
--module-dir=[dir] The location where the loadable modules are
stored.
[$PWD/run/modules]
- --build-dir=[dir] The location to store files in while building.
-
EXTRA MODULE OPTIONS
@@ -130,10 +137,11 @@ MISC OPTIONS
--clean Remove the configuration cache file and start
the interactive configuration wizard.
--disable-interactive Disables the interactive configuration wizard.
+ --gid=[id|name] Sets the group to run InspIRCd as.
--help Show this message and exit.
- --uid=[name] Sets the user to run InspIRCd as.
--socketengine=[name] Sets the socket engine to be used. Possible
values are $SELIST.
+ --uid=[id|name] Sets the user to run InspIRCd as.
--update Updates the build environment.
@@ -173,14 +181,14 @@ sub read_configure_cache {
}
sub write_configure_cache(%) {
+ print_format "Writing <|GREEN .config.cache|> ...\n";
my %cfg = @_;
- open(CACHE, ">.config.cache") or return 0;
+ open(CACHE, '>.config.cache') or print_error "unable to write .config.cache: $!";
while (my ($key, $value) = each %cfg) {
$value = "" unless defined $value;
print CACHE "$key=\"$value\"\n";
}
close(CACHE);
- return 1;
}
sub get_compiler_info($) {
@@ -226,8 +234,8 @@ sub find_compiler {
sub run_test($$) {
my ($what, $result) = @_;
- print "Checking whether $what is available... ";
- print $result ? "yes\n" : "no\n";
+ print_format "Checking whether <|GREEN $what|> is available ... ";
+ print_format $result ? "<|GREEN yes|>\n" : "<|RED no|>\n";
return $result;
}
@@ -265,19 +273,6 @@ sub get_property($$;$)
return defined $default ? $default : '';
}
-sub dump_hash() {
- print "\n\e[1;32mPre-build configuration is complete!\e[0m\n\n";
- print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
- print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
- print "\e[0mData path:\e[1;32m\t\t\t$main::config{DATA_DIR}\e[0m\n";
- print "\e[0mLog path:\e[1;32m\t\t\t$main::config{LOG_DIR}\e[0m\n";
- print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
- print "\e[0mCompiler:\e[1;32m\t\t\t$main::cxx{NAME} $main::cxx{VERSION}\e[0m\n";
- print "\e[0mSocket engine:\e[1;32m\t\t\t$main::config{SOCKETENGINE}\e[0m\n";
- print "\e[0mGnuTLS support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
- print "\e[0mOpenSSL support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n";
-}
-
sub parse_templates($$) {
# These are actually hash references
@@ -300,7 +295,7 @@ sub parse_templates($$) {
while ($line =~ /(@(\w+?)@)/) {
my ($variable, $name) = ($1, $2);
if (defined $settings{$name}) {
- $line =~ s/$variable/$settings{$name}/;
+ $line =~ s/\Q$variable\E/$settings{$name}/;
} else {
print_warning "unknown template variable '$name' in $_!";
last;
diff --git a/make/template/main.mk b/make/template/main.mk
index 5806d568a..c78d9047d 100644
--- a/make/template/main.mk
+++ b/make/template/main.mk
@@ -43,6 +43,7 @@ CORELDFLAGS = -rdynamic -L. $(LDFLAGS)
PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS)
BASE = "$(DESTDIR)@BASE_DIR@"
CONPATH = "$(DESTDIR)@CONFIG_DIR@"
+MANPATH = "$(DESTDIR)@MANUAL_DIR@"
MODPATH = "$(DESTDIR)@MODULE_DIR@"
DATPATH = "$(DESTDIR)@DATA_DIR@"
BINPATH = "$(DESTDIR)@BINARY_DIR@"
@@ -225,6 +226,7 @@ install: target
@-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH)
@-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases
@-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules
+ @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH)
@-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
[ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH)
@IFNDEF PURE_STATIC
@@ -238,10 +240,11 @@ install: target
@IFEQ $(SYSTEM) linux
-$(INSTALL) -m $(INSTMODE_LIB) inspircd.service $(BASE) 2>/dev/null
@ENDIF
- -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(BASE) 2>/dev/null
- -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(BASE) 2>/dev/null
+ -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(MANPATH) 2>/dev/null
+ -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(MANPATH) 2>/dev/null
-$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
-$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
+ -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH)
-$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases
-$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules
@echo ""
@@ -273,8 +276,11 @@ clean:
deinstall:
-rm -f $(BINPATH)/inspircd
-rm -rf $(CONPATH)/examples
+ -rm -f $(MANPATH)/inspircd.1
+ -rm -f $(MANPATH)/inspircd-genssl.1
-rm -f $(MODPATH)/*.so
-rm -f $(BASE)/.gdbargs
+ -rm -f $(BASE)/inspircd.service
-rm -f $(BASE)/org.inspircd.plist
configureclean:
@@ -283,6 +289,9 @@ configureclean:
rm -f GNUmakefile
rm -f include/config.h
rm -f inspircd
+ rm -f inspircd.1
+ rm -f inspircd-genssl.1
+ -rm -f inspircd.service
-rm -f org.inspircd.plist
distclean: clean configureclean
diff --git a/make/template/org.inspircd.plist b/make/template/org.inspircd.plist
index 4bcb3e7c3..07a3446b5 100644
--- a/make/template/org.inspircd.plist
+++ b/make/template/org.inspircd.plist
@@ -23,6 +23,8 @@
<key>ServiceIPC</key>
<false/>
<key>UserName</key>
- <string>ircdaemon</string>
+ <string>@USER@</string>
+ <key>GroupName</key>
+ <string>@GROUP@</string>
</dict>
</plist>
diff --git a/make/test/compiler.cpp b/make/test/compiler.cpp
new file mode 100644
index 000000000..1c3e1d875
--- /dev/null
+++ b/make/test/compiler.cpp
@@ -0,0 +1,29 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <iostream>
+#if defined _LIBCPP_VERSION
+# include <unordered_map>
+#else
+# include <tr1/unordered_map>
+#endif
+
+int main() {
+ std::cout << "Hello, World!" << std::endl;
+ return 0;
+}