From 94d5c29f63f806f0c1de5d8eda2ae98d268b84f1 Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 1 Sep 2009 15:05:18 +0000 Subject: ./configure fixes: -modupdate is no longer needed, -update no longer forces a full rebuild git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11560 e03df62e-2008-0410-955e-edbf42e46eb7 --- .Makefile.inc | 6 +- configure | 159 +++++++++---------------------------------------- make/install-extras.pl | 29 +++++++++ 3 files changed, 61 insertions(+), 133 deletions(-) create mode 100755 make/install-extras.pl diff --git a/.Makefile.inc b/.Makefile.inc index 1d816a57b..d39c91b0d 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -46,6 +46,7 @@ SOCKETENGINE = @SOCKETENGINE@ @ENDIF @DO_EXPORT RUNCC FLAGS NICEFLAGS CC LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORE_FLAGS +@DO_EXPORT BASE CONPATH MODPATH BINPATH LIBPATH # Default target @@ -108,7 +109,8 @@ install: allreal@EXTRA_DIR@ -install -m $(INSTMODE) src/commands/*.so $(LIBPATH) -install -m $(INSTMODE) src/modules/*.so $(MODPATH) -install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null -@INSTALL_LIST@ -install -m $(INSTMODE) src/inspircd $(BINPATH) + -install -m $(INSTMODE) src/inspircd $(BINPATH) + @$(MAKEENV) make/install-extras.pl install @echo "" @echo "*************************************" @echo "* INSTALL COMPLETE! *" @@ -141,7 +143,7 @@ deinstall: -rm $(BINPATH)/inspircd -rm $(LIBPATH)/*.so -rm $(MODPATH)/*.so -@UNINSTALL_LIST@ + @make/install-extras.pl deinstall squeakyclean: distclean diff --git a/configure b/configure index 0754c8f79..09dbafd2d 100755 --- a/configure +++ b/configure @@ -36,41 +36,15 @@ use make::configure; use make::gnutlscert; 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 <include/inspircd_se_config.h"); + open(FILEHANDLE, ">include/inspircd_se_config.h.tmp"); print FILEHANDLE <; + 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 = )) - { - 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.'; diff --git a/make/install-extras.pl b/make/install-extras.pl new file mode 100755 index 000000000..f0e2dd0e2 --- /dev/null +++ b/make/install-extras.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl +use strict; +use warnings; + +my $mode = shift; +my %installed; + +for my $dir (qw(src src/modules)) { + opendir(DIRHANDLE, $dir); + for my $file (sort readdir(DIRHANDLE)) { + next unless $file =~ /\.cpp$/; + open CPP, '<', "$dir/$file" or die "Can't open $dir/$file to scan it: $!"; + while () { + if (/\/\* \$CopyInstall: (\S+) (\S+) \*\//i) { + my($ifile, $idir) = ($1,$2); + next if exists $installed{$1.' '.$2}; + $installed{$1.' '.$2}++; + $idir =~ s/\$\(([^)]+)\)/$ENV{$1}/eg; + if ($mode eq 'install') { + system "install $ifile $idir"; + } else { + $ifile =~ s/.*\///g; + system "rm $idir/$ifile"; + } + } + } + } + closedir(DIRHANDLE); +} -- cgit v1.2.3