diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 159 |
1 files changed, 28 insertions, 131 deletions
@@ -38,39 +38,13 @@ use make::opensslcert; ############################################################################################### # -# EDITABLE VARIABLES -# -############################################################################################### - -# If you wish to ignore a dependency throughout the entire core, add it here. - -our @ignoredeps = ( - "inspircd_win32wrapper.h", # windows has its own configure program -); - -# If you wish for all files in the entire core to have a given dependency, insert it here. -# You should keep this to an absolute minimum to avoid rebuilds that are not neccessary. - -our @immutabledeps = ( - "inspircd_config.h", # auto re-generated by configure - "inspircd.h", -); - -############################################################################################### -# # NON-EDITABLE VARIABLES # ############################################################################################### -# List of commands that make up 'make install' and 'make deinstall' - -our $install_list = ""; -our $uninstall_list = ""; - our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue, - $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_maxbuf, $opt_disable_debug, - $opt_freebsd_port); + $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_maxbuf, $opt_disable_debug, $opt_freebsd_port); our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir, $opt_library_dir); @@ -108,7 +82,6 @@ GetOptions ( 'library-dir=s' => \$opt_library_dir, 'disable-debuginfo' => sub { $opt_disable_debug = 1 }, 'help' => sub { showhelp(); }, - 'modupdate' => sub { modupdate(); }, 'update' => sub { update(); }, 'svnupdate' => sub { svnupdate(); }, 'clean' => sub { clean(); }, @@ -126,7 +99,6 @@ if (scalar(@opt_enableextras) + scalar(@opt_disableextras) > 0) { disable_extras(@opt_disableextras); list_extras; print "Remember: YOU are responsible for making sure any libraries needed have been installed!\n"; - print "Run $0 -modupdate after you've done this to update the makefiles.\n"; exit 0; } @@ -364,39 +336,6 @@ sub update exit; } -sub modupdate -{ - eval { - chomp($topdir = getcwd()); - $this = resolve_directory($topdir); # PWD, Regardless. - getmodules(); - # Does the cache file exist? - if (!getcache()) { - # No, No it doesn't.. *BASH* - print "You have not run ./configure before. Please do this before trying to run the update script.\n"; - exit 0; - } else { - # We've Loaded the cache file and all our variables.. - print "Updating files...\n"; - getosflags(); - $has_epoll = $config{HAS_EPOLL}; - $has_ports = $config{HAS_PORTS}; - $has_kqueue = $config{HAS_KQUEUE}; - writefiles(0); - makecache(); - print "Complete.\n"; - exit; - } - }; - if ($@) - { - print "Module update failed: $@\n"; - } - exit; -} - - - sub svnupdate { my $fail = 0; @@ -411,8 +350,6 @@ sub svnupdate } open my $fd, "-|", "svn update"; my $configurechanged = 0; # Needs ./configure -update - my $coredirchanged = 0; # Needs ./configure -update - my $moduledirchanged = 0; # Needs ./configure -modupdate my $rootincchanged = 0; my @conflicted = (); while (defined(my $line = <$fd>)) @@ -428,14 +365,6 @@ sub svnupdate { $configurechanged = 1; } - elsif ($file =~ m#^src/modules#) - { - $moduledirchanged = 1; - } - elsif ($file =~ m#^src/#) - { - $coredirchanged = 1; - } elsif ($file =~ m/^\..*\.inc$/) { $rootincchanged = 1; @@ -452,17 +381,6 @@ sub svnupdate $rootincchanged = 1; } } - elsif ($action eq "A" || $action eq "D") - { - if ($file =~ m#^src/modules#) - { - $moduledirchanged = 1; - } - elsif ($file =~ m#^src/#) - { - $coredirchanged = 1; - } - } } unless (close $fd) # close() waits for exit and returns false if the command failed { @@ -479,18 +397,14 @@ sub svnupdate if (scalar(@conflicted) > 0) { print STDERR "\e[0;33;1mERROR:\e[0m You have local modifications which conflicted with the updates from SVN\n"; - printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate\n", (($coredirchanged || $configurechanged) ? "" : "mod"); + print STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -update\n"; print "Conflicted files: " . join ", ", @conflicted . "\n"; exit 1; } - if ($configurechanged || $coredirchanged) + if ($configurechanged) { system("perl configure -update"); } - elsif ($moduledirchanged || $rootincchanged) - { - system("perl configure -modupdate"); - } else { print "No need to update Makefiles.\n"; @@ -1109,7 +1023,7 @@ sub writefiles { if ($writeheader == 1) { print "Writing \e[1;32minspircd_config.h\e[0m\n"; - open(FILEHANDLE, ">include/inspircd_config.h"); + open(FILEHANDLE, ">include/inspircd_config.h.tmp"); print FILEHANDLE <<EOF; /* Auto generated by configure, do not modify! */ #ifndef __CONFIGURATION_AUTO__ @@ -1196,11 +1110,8 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n"; } print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n\n#endif\n"; close(FILEHANDLE); - } - if ($writeheader) - { - open(FILEHANDLE, ">include/inspircd_se_config.h"); + open(FILEHANDLE, ">include/inspircd_se_config.h.tmp"); print FILEHANDLE <<EOF; /* Auto generated by configure, do not modify or commit to svn! */ #ifndef __CONFIGURATION_SOCKETENGINE__ @@ -1211,8 +1122,30 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n"; #endif EOF close(FILEHANDLE); - } + for my $file (qw(include/inspircd_config.h include/inspircd_se_config.h)) { + my $diff = 0; + open my $fh1, $file or $diff = 1; + open my $fh2, $file.'.tmp' or die "Can't read $file.tmp that we just wrote: $!"; + while (!$diff) { + my $line1 = <$fh1>; + my $line2 = <$fh2>; + if (defined($line1) != defined($line2)) { + $diff = 1; + } elsif (!defined $line1) { + last; + } else { + $diff = ($line1 ne $line2); + } + } + if ($diff) { + unlink $file; + rename "$file.tmp", $file; + } else { + unlink "$file.tmp"; + } + } + } # Write all .in files. my $tmp = ""; @@ -1257,8 +1190,6 @@ EOF } s/\@EXECUTABLE\@/$exe/ if defined $exe; s/\@VERSION\@/$version/ if defined $version; - s/\@INSTALL_LIST\@/$install_list/ if defined $install_list; - s/\@UNINSTALL_LIST\@/$uninstall_list/ if defined $uninstall_list; if ($file eq 'Makefile') { my $mk_tmp = $_; @@ -1300,7 +1231,6 @@ EOF sub prepare_dynamic_makefile { my $i = 0; - my %existing_install_list = (); if (!$has_epoll) { @@ -1315,39 +1245,6 @@ sub prepare_dynamic_makefile $config{USE_PORTS} = 0; } - foreach my $dir ("src/modules") - { - print "Scanning \e[1;32m$dir\e[0m for installation files "; - opendir(DIRHANDLE, $dir); - foreach my $name (sort readdir(DIRHANDLE)) - { - if ($name =~ /\.cpp$/) - { - open (CPP, "<$dir/$name") or die("Can't open $dir/$name to scan it! oh bugger"); - print "."; - while (defined(my $line = <CPP>)) - { - chomp($line); - if ($line =~ /\/\* \$CopyInstall: (.*?) \*\//i) - { - if (!exists($existing_install_list{$1})) - { - $existing_install_list{$1} = 1; - my $idir = (split(' ',$1))[1]; - my $ifile = (split(' ',$1))[0]; - $install_list = $install_list . " -cp $1\n"; - $ifile =~ s/.*\///g; - $uninstall_list = $uninstall_list . " -rm $idir/$ifile\n"; - } - } - } - close CPP; - } - } - closedir(DIRHANDLE); - print " done!\n"; - } - if ($config{IS_DARWIN} eq "YES") { $config{CORE_FLAGS} = '-dynamic -bind_at_load -L.'; |