]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - tools/test-build
Merge insp20
[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 Peter Powell <petpow@saberuk.com>
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 BEGIN {
22         require 5.8.0;
23         unless (-f 'configure') {
24                 print "Error: test-build must be run from the main source directory!\n";
25                 exit 1;
26         }
27 }
28
29 use strict;
30 use warnings FATAL => qw(all);
31
32 use make::configure;
33 use make::utilities;
34
35 $ENV{D} = $ENV{V} = 1;
36
37 system 'git', 'clean', '-dfx';
38
39 foreach my $compiler ('g++', 'clang++', 'icpc') {
40         next if system "$compiler -v > /dev/null 2>&1";
41         $ENV{CXX} = $compiler;
42         my @socketengines = ( 'select' );
43         push @socketengines, 'epoll' if test_header $compiler, 'sys/epoll.h';
44         push @socketengines, 'kqueue' if test_file $compiler, 'kqueue.cpp';
45         push @socketengines, 'poll' if test_header $compiler, 'poll.h';
46         push @socketengines, 'ports' if test_header $compiler, 'ports.h';
47         foreach my $socketengine (@socketengines) {
48                 print "Attempting to build using the $compiler compiler and the $socketengine socket engine...\n";
49                 if (system './configure', '--disable-interactive', "--socketengine=$socketengine") {
50                         print "Failed to configure using the $compiler compiler and the $socketengine socket engine!\n";
51                         exit 1;
52                 }
53                 $ENV{PURE_STATIC} = 1;
54                 if (system 'make', '-j'.get_cpu_count, 'install') {
55                         print "Failed to compile with static modules using the $compiler compiler and the $socketengine socket engine!\n";
56                         exit 1;
57                 }
58                 delete $ENV{PURE_STATIC};
59                 if (system 'make', '-j'.get_cpu_count, 'install') {
60                         print "Failed to compile with dynamic modules using the $compiler compiler and the $socketengine socket engine!\n";
61                         exit 1;
62                 }
63                 print "Building using the $compiler compiler and the $socketengine socket engine succeeded!\n";
64         }
65
66         system 'git', 'clean', '-dfx';
67 }