diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genssl | 33 | ||||
-rwxr-xr-x | tools/test-build | 53 | ||||
-rwxr-xr-x | tools/travis-ci.sh | 12 |
3 files changed, 64 insertions, 34 deletions
diff --git a/tools/genssl b/tools/genssl index aa8d48300..189311c1a 100755 --- a/tools/genssl +++ b/tools/genssl @@ -21,29 +21,31 @@ BEGIN { - require 5.8.0; + require 5.10.0; } +use feature ':5.10'; use strict; use warnings FATAL => qw(all); use File::Temp(); # IMPORTANT: This script has to be able to run by itself so that it can be used -# by binary distributions where the make/utilities.pm module will not +# by binary distributions where the make/console.pm module will not # be available! sub prompt($$) { my ($question, $default) = @_; - print "$question\n"; + return prompt_string(1, $question, $default) if eval 'use FindBin;use lib $FindBin::RealDir;use make::console; 1'; + say $question; print "[$default] => "; chomp(my $answer = <STDIN>); - print "\n"; + say ''; return $answer ? $answer : $default; } if ($#ARGV != 0 || $ARGV[0] !~ /^(?:auto|gnutls|openssl)$/i) { - print "Syntax: genssl <auto|gnutls|openssl>\n"; + say STDERR "Usage: $0 <auto|gnutls|openssl>"; exit 1; } @@ -51,7 +53,7 @@ if ($#ARGV != 0 || $ARGV[0] !~ /^(?:auto|gnutls|openssl)$/i) { my $certtool = $^O eq 'darwin' ? 'gnutls-certtool' : 'certtool'; # Check whether the user has the required tools installed. -my $has_gnutls = !system "$certtool --version >/dev/null 2>&1"; +my $has_gnutls = `$certtool --version v 2>/dev/null`; my $has_openssl = !system 'openssl version >/dev/null 2>&1'; # The framework the user has specified. @@ -64,14 +66,14 @@ if ($tool eq 'auto') { } elsif ($has_openssl) { $tool = 'openssl'; } else { - print STDERR "SSL generation failed: could not find $certtool or openssl in the PATH!\n"; + say STDERR "SSL generation failed: could not find $certtool or openssl in the PATH!"; exit 1; } } elsif ($tool eq 'gnutls' && !$has_gnutls) { - print STDERR "SSL generation failed: could not find '$certtool' in the PATH!\n"; + say STDERR "SSL generation failed: could not find '$certtool' in the PATH!"; exit 1; } elsif ($tool eq 'openssl' && !$has_openssl) { - print STDERR "SSL generation failed: could not find 'openssl' in the PATH!\n"; + say STDERR 'SSL generation failed: could not find \'openssl\' in the PATH!'; exit 1; } @@ -92,6 +94,8 @@ my $dercert; my $status = 0; if ($tool eq 'gnutls') { + $has_gnutls =~ /certtool.+?(\d+\.\d+)/; + my $sec_param = $1 lt '2.10' ? '--bits 2048' : '--sec-param normal'; my $tmp = new File::Temp(); print $tmp <<__GNUTLS_END__; cn = "$common_name" @@ -113,9 +117,9 @@ ocsp_signing_key time_stamping_key __GNUTLS_END__ close($tmp); - $status ||= system "$certtool --generate-privkey --outfile key.pem"; + $status ||= system "$certtool --generate-privkey $sec_param --outfile key.pem"; $status ||= system "$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template $tmp"; - $status ||= system "$certtool --generate-dh-params --bits 2048 --outfile dhparams.pem"; + $status ||= system "$certtool --generate-dh-params $sec_param --outfile dhparams.pem"; $dercert = `$certtool --certificate-info --infile cert.pem --outder` unless $status; } elsif ($tool eq 'openssl') { my $tmp = new File::Temp(); @@ -135,13 +139,14 @@ __OPENSSL_END__ } if ($status) { - print STDERR "SSL generation failed: $tool exited with a non-zero status!\n"; + say STDERR "SSL generation failed: $tool exited with a non-zero status!"; exit 1; } if (defined $dercert && eval 'use Digest::SHA; 1') { my $hash = Digest::SHA->new(256); $hash->add($dercert); - print "\nAdd this TLSA record to your domain for DANE support:\n"; - print "_6697._tcp." . $common_name . " TLSA 3 0 1 " . $hash->hexdigest . "\n"; + say ''; + say 'Add this TLSA record to your domain for DANE support:'; + say "_6697._tcp." . $common_name . " TLSA 3 0 1 " . $hash->hexdigest; } diff --git a/tools/test-build b/tools/test-build index 7f1bf68cd..2b9ee4ee2 100755 --- a/tools/test-build +++ b/tools/test-build @@ -2,7 +2,7 @@ # # InspIRCd -- Internet Relay Chat Daemon # -# Copyright (C) 2013 Peter Powell <petpow@saberuk.com> +# Copyright (C) 2013-2014 Peter Powell <petpow@saberuk.com> # # 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 @@ -19,48 +19,61 @@ BEGIN { - require 5.8.0; + require 5.10.0; unless (-f 'configure') { - print "Error: test-build must be run from the main source directory!\n"; + print "Error: $0 must be run from the main source directory!\n"; exit 1; } } +use feature ':5.10'; use strict; use warnings FATAL => qw(all); +use FindBin qw($RealDir); + +use lib $RealDir; +use make::common; use make::configure; -use make::utilities; -$ENV{D} = $ENV{V} = 1; +$ENV{INSPIRCD_DEBUG} = $ENV{INSPIRCD_VERBOSE} = 1; system 'git', 'clean', '-dfx'; -foreach my $compiler ('g++', 'clang++', 'icpc') { - next if system "$compiler -v > /dev/null 2>&1"; +my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc); +foreach my $compiler (@compilers) { + if (system "$compiler -v > /dev/null 2>&1") { + say "Skipping $compiler as it is not installed on this system!"; + next; + } $ENV{CXX} = $compiler; - my @socketengines = ( 'select' ); + my @socketengines = qw(select); push @socketengines, 'epoll' if test_header $compiler, 'sys/epoll.h'; push @socketengines, 'kqueue' if test_file $compiler, 'kqueue.cpp'; push @socketengines, 'poll' if test_header $compiler, 'poll.h'; push @socketengines, 'ports' if test_header $compiler, 'ports.h'; foreach my $socketengine (@socketengines) { - print "Attempting to build using the $compiler compiler and the $socketengine socket engine...\n"; - if (system './configure', '--disable-interactive', "--socketengine=$socketengine") { - print "Failed to configure using the $compiler compiler and the $socketengine socket engine!\n"; + say "Attempting to build using the $compiler compiler and the $socketengine socket engine..."; + system './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES} if defined $ENV{TEST_BUILD_MODULES}; + if (system './configure', '--development', '--socketengine', $socketengine) { + say "Failed to configure using the $compiler compiler and the $socketengine socket engine!"; exit 1; } - $ENV{PURE_STATIC} = 1; - if (system 'make', '-j'.get_cpu_count, 'install') { - print "Failed to compile with static modules using the $compiler compiler and the $socketengine socket engine!\n"; - exit 1; + if (!defined $ENV{TEST_BUILD_DYNAMIC}) { + $ENV{INSPIRCD_STATIC} = 1; + if (system 'make', '-j'.get_cpu_count, 'install') { + say "Failed to compile with static modules using the $compiler compiler and the $socketengine socket engine!"; + exit 1; + } } - delete $ENV{PURE_STATIC}; - if (system 'make', '-j'.get_cpu_count, 'install') { - print "Failed to compile with dynamic modules using the $compiler compiler and the $socketengine socket engine!\n"; - exit 1; + if (!defined $ENV{TEST_BUILD_STATIC}) { + delete $ENV{INSPIRCD_STATIC}; + if (system 'make', '-j'.get_cpu_count, 'install') { + say "Failed to compile with dynamic modules using the $compiler compiler and the $socketengine socket engine!"; + exit 1; + } } - print "Building using the $compiler compiler and the $socketengine socket engine succeeded!\n"; + say "Building using the $compiler compiler and the $socketengine socket engine succeeded!"; } system 'git', 'clean', '-dfx'; diff --git a/tools/travis-ci.sh b/tools/travis-ci.sh new file mode 100755 index 000000000..bb32e19a1 --- /dev/null +++ b/tools/travis-ci.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -ev +if [ "$TRAVIS_OS_NAME" = "linux" ] +then + sudo apt-get update --assume-yes + sudo apt-get install --assume-yes libgeoip-dev libgnutls-dev libldap2-dev libmysqlclient-dev libpcre3-dev libpq-dev libsqlite3-dev libssl-dev libtre-dev +else + >&2 echo "'$TRAVIS_OS_NAME' is an unknown Travis CI environment!" + exit 1 +fi +export TEST_BUILD_MODULES="m_geoip.cpp,m_ldap.cpp,m_mysql.cpp,m_pgsql.cpp,m_regex_pcre.cpp,m_regex_posix.cpp,m_regex_tre.cpp,m_sqlite3.cpp,m_ssl_gnutls.cpp,m_ssl_openssl.cpp" +./tools/test-build $CXX |