From b4ba01f542447def04f1e327c4cf3a385e1b8a9b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 21 Jul 2013 01:56:36 +0100 Subject: Remove a ton of duplicate and obsolete code from configure. - Add the data and log paths to dumphash. - Always exit with EXIT_FAILURE on error. - Always replace the old config.h with our new one. - Clean up the ./configure --help message slightly. - Install dhparams.pem into the conf directory on GnuTLS as well as OpenSSL. - Only show the users InspIRCd Git revision when building from Git. - Remove a check for MinGW (we have proper Windows builds). - Remove a check for FreeBSD 4 (released in 2000). - Remove a ton of pointless tab-indented comments. - Remove a ton of duplicate or unused variables. - Remove the check for stdint.h (always available on TR1 compilers). - Remove the $writeheader argument from writefiles (always 1). - Remove the following %config options: - DESTINATION (not used, always set to BASE). - EXECUTABLE (always set to inspircd). - OSNAME (duplicate of SYSTEM). - Remove support for checking whether -extra modules are up to date (if the user is installing they won't have any -extra modules installed). - Remove SSL generation messages (genssl provides these). - Replace inappropriate uses of printf with print. - Replace is_dir with -d from the Perl stdlib. - Replace resolve_directory with rel2abs from the Perl stdlib. - Rewrite getrevision to be more compact, cache the revision and return 'release' on non-Git builds. - Use consistent messages for all tests. - Use tput to clear the screen in a portable way. --- make/configure.pm | 64 +++++++++----------------------------------------- make/template/inspircd | 2 +- 2 files changed, 12 insertions(+), 54 deletions(-) (limited to 'make') diff --git a/make/configure.pm b/make/configure.pm index abb706ddd..de49bd53c 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -31,9 +31,9 @@ use warnings FATAL => qw(all); use Exporter 'import'; use POSIX; use make::utilities; -our @EXPORT = qw(get_compiler_info find_compiler test_file test_header promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s module_installed); +our @EXPORT = qw(get_compiler_info find_compiler test_file test_header promptnumeric dumphash getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic yesno showhelp promptstring_s module_installed); -my $no_git = 0; +my $revision; sub get_compiler_info($) { my %info = (NAME => shift, VERSION => '0.0'); @@ -103,30 +103,11 @@ sub yesno { return; } -sub resolve_directory -{ - my $ret = $_[0]; - eval - { - use File::Spec; - $ret = File::Spec->rel2abs($_[0]); - }; - return $ret; -} - sub getrevision { - if ($no_git) - { - return "0"; - } - my $data = `git describe --tags 2>/dev/null`; - if ($data eq "") - { - $no_git = 1; - return '0'; - } - chomp $data; # remove \n - return $data; + return $revision if defined $revision; + chomp(my $tags = `git describe --tags 2>/dev/null`); + $revision = $tags || 'release'; + return $revision; } sub getcompilerflags { @@ -269,6 +250,8 @@ sub dumphash() print "\n\e[1;32mPre-build configuration is complete!\e[0m\n\n"; print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n"; print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n"; + print "\e[0mData path:\e[1;32m\t\t\t$main::config{DATA_DIR}\e[0m\n"; + print "\e[0mLog path:\e[1;32m\t\t\t$main::config{LOG_DIR}\e[0m\n"; print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n"; print "\e[0mCompiler:\e[1;32m\t\t\t$main::cxx{NAME} $main::cxx{VERSION}\e[0m\n"; print "\e[0mSocket engine:\e[1;32m\t\t\t$main::config{SOCKETENGINE}\e[0m\n"; @@ -276,22 +259,6 @@ sub dumphash() print "\e[0mOpenSSL support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n"; } -sub is_dir -{ - my ($path) = @_; - if (chdir($path)) - { - chdir($main::this); - return 1; - } - else - { - # Just in case.. - chdir($main::this); - return 0; - } -} - sub showhelp { chomp(my $PWD = `pwd`); @@ -304,20 +271,13 @@ sub showhelp print <