3 # InspIRCd -- Internet Relay Chat Daemon
5 # Copyright (C) 2013-2016, 2018-2020 Sadie Powell <sadie@witchery.services>
7 # This file is part of InspIRCd. InspIRCd is free software: you can
8 # redistribute it and/or modify it under the terms of the GNU General Public
9 # License as published by the Free Software Foundation, version 2.
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 unless (-f 'configure') {
24 print "Error: $0 must be run from the main source directory!\n";
31 use warnings FATAL => qw(all);
33 use File::Basename qw(dirname);
34 use FindBin qw($RealDir);
36 use lib dirname $RealDir;
40 $ENV{INSPIRCD_DEBUG} = 3;
41 $ENV{INSPIRCD_VERBOSE} = 1;
43 execute 'git', 'clean', '-dfx';
45 my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
46 foreach my $compiler (@compilers) {
47 if (system "$compiler -v > /dev/null 2>&1") {
48 say "Skipping $compiler as it is not installed on this system!";
51 $ENV{CXX} = $compiler;
52 my @socketengines = qw(select);
53 push @socketengines, 'epoll' if test_header $compiler, 'sys/epoll.h';
54 push @socketengines, 'kqueue' if test_file $compiler, 'kqueue.cpp';
55 push @socketengines, 'poll' if test_header $compiler, 'poll.h';
56 foreach my $socketengine (@socketengines) {
57 say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
59 if (defined $ENV{TEST_BUILD_MODULES}) {
60 execute './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES};
61 push @configure_flags, '--disable-auto-extras';
63 if (execute './configure', '--development', '--socketengine', $socketengine, @configure_flags) {
64 say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
67 if (execute 'make', '--jobs', get_cpu_count() + 1, 'install') {
68 say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
71 say "Building using the $compiler compiler and the $socketengine socket engine succeeded!";
74 execute 'git', 'clean', '-dfx';