]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - tools/test-build
Fix unnecessary begin blocks in Perl source files.
[user/henk/code/inspircd.git] / tools / test-build
1 #!/usr/bin/env perl
2 #
3 # InspIRCd -- Internet Relay Chat Daemon
4 #
5 #   Copyright (C) 2013-2016, 2018-2020 Sadie Powell <sadie@witchery.services>
6 #
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.
10 #
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
14 # details.
15 #
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/>.
18 #
19
20
21 use v5.10.0;
22 use strict;
23 use warnings FATAL => qw(all);
24
25 use File::Basename qw(dirname);
26 use FindBin        qw($RealDir);
27
28 use lib dirname $RealDir;
29 use make::common;
30 use make::configure;
31
32 $ENV{INSPIRCD_DEBUG} = 3;
33 $ENV{INSPIRCD_VERBOSE} = 1;
34
35 execute 'git', 'clean', '-dfx';
36
37 my $root = dirname $RealDir;
38 my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
39 foreach my $compiler (@compilers) {
40         if (system "$compiler -v > /dev/null 2>&1") {
41                 say "Skipping $compiler as it is not installed on this system!";
42                 next;
43         }
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         foreach my $socketengine (@socketengines) {
50                 say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
51                 my @configure_flags;
52                 if (defined $ENV{TEST_BUILD_MODULES}) {
53                         execute "$root/configure", '--enable-extras', $ENV{TEST_BUILD_MODULES};
54                         push @configure_flags, '--disable-auto-extras';
55                 }
56                 if (execute "$root/configure", '--development', '--socketengine', $socketengine, @configure_flags) {
57                         say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
58                         exit 1;
59                 }
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!";
62                         exit 1;
63                 }
64                 say "Building using the $compiler compiler and the $socketengine socket engine succeeded!";
65         }
66
67         execute 'git', 'clean', '-dfx';
68 }