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 use warnings FATAL => qw(all);
25 use File::Basename qw(dirname);
26 use FindBin qw($RealDir);
28 use lib dirname $RealDir;
32 $ENV{INSPIRCD_DEBUG} = 3;
33 $ENV{INSPIRCD_VERBOSE} = 1;
35 execute 'git', 'clean', '-dfx';
37 my $root = dirname $RealDir;
38 my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
39 for my $compiler (@compilers) {
40 if (system "$compiler -v > /dev/null 2>&1") {
41 say "Skipping $compiler as it is not installed on this system!";
44 $ENV{CXX} = $compiler;
45 my @socketengines = qw(select);
46 push @socketengines, 'epoll' if test_header $compiler, 'sys/epoll.h';
47 push @socketengines, 'kqueue' if test_file $compiler, 'kqueue.cpp';
48 push @socketengines, 'poll' if test_header $compiler, 'poll.h';
49 for my $socketengine (@socketengines) {
50 say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
52 if (defined $ENV{TEST_BUILD_MODULES}) {
53 execute "$root/configure", '--enable-extras', $ENV{TEST_BUILD_MODULES};
54 push @configure_flags, '--disable-auto-extras';
56 if (execute "$root/configure", '--development', '--socketengine', $socketengine, @configure_flags) {
57 say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
60 if (execute 'make', '--directory', $root, '--jobs', get_cpu_count() + 1, 'install') {
61 say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
64 say "Building using the $compiler compiler and the $socketengine socket engine succeeded!";
67 execute 'git', 'clean', '-dfx';