open(FH,"<.svn/entries") or $fail = 1;
if ($fail) {
print "This is not an SVN copy of InspIRCd.\n";
- exit;
+ exit 1;
}
else
{
close(FH);
}
- system("svn update");
- system("perl configure -update");
+ 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>))
+ {
+ my ($action, $file);
+ print $line;
+ $line =~ m/^([ADUCG])\s+(.*)$/ or next;
+ ($action, $file) = ($1, $2);
+ if ($action eq "C")
+ {
+ push @conflicted, $file;
+ if ($file eq "configure")
+ {
+ $configurechanged = 1;
+ }
+ elsif ($file =~ m#^src/modules#)
+ {
+ $moduledirchanged = 1;
+ }
+ elsif ($file =~ m#^src/#)
+ {
+ $coredirchanged = 1;
+ }
+ elsif ($file =~ m/^\..*\.inc$/)
+ {
+ $rootincchanged = 1;
+ }
+ }
+ elsif ($action eq "U" || $action eq "G")
+ {
+ if ($file eq "configure")
+ {
+ $configurechanged = 1;
+ }
+ elsif ($file =~ m/^\..*\.inc$/)
+ {
+ $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
+ {
+ if ($! == 0)
+ {
+ print STDERR "Problem updating from SVN, please check above for errors\n";
+ }
+ else
+ {
+ print STDERR "Failed to run SVN: $!\n";
+ }
+ exit 1;
+ }
+ 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 "Conflicted files: " . join ", ", @conflicted . "\n";
+ exit 1;
+ }
+ if ($configurechanged || $coredirchanged)
+ {
+ system("perl configure -update");
+ }
+ elsif ($moduledirchanged || $rootincchanged)
+ {
+ system("perl configure -modupdate");
+ }
+ else
+ {
+ print "No need to update Makefiles.\n";
+ }
if (defined $opt_rebuild) {
system("make install");
}
# Beware: Linux sets it's own cflags below for some retarded reason
$config{LDLIBS} = "-pthread -lstdc++";
- $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
- $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -g";
+ $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall $config{OPTIMISATI}";
+ $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -Wformat=2 -Wmissing-format-attribute -g";
$SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared" unless defined $opt_disablerpath;
$config{MAKEPROG} = "make";
if ($config{OSNAME} =~ /Linux/i) {
$config{LDLIBS} = "-ldl -lstdc++ -pthread";
- $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
+# $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
$config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
$config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
$config{MAKEPROG} = "make";
my $all = "all: ";
my $all_libsonly = "";
-
my $libraryext = "";
my $othercrap = "";
my $RPATH = "";
foreach my $cmd (@cmdlist) {
print FH <<ITEM;
cmd_$cmd.so: cmd_$cmd.cpp ../../include/base.h ../../include/modules.h ../../include/inspircd.h ../../include/channels.h ../../include/users.h ../../include/globals.h ../../include/inspircd_config.h ../../include/commands/cmd_$cmd.h
- \@../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
- \@../../make/run-cc.pl \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
+ \@../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic $SHARED -o cmd_$cmd.so cmd_$cmd.cpp
ITEM
}
-#try build a .so, no intermediate .o
-# @../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic $SHARED -o cmd_$cmd.so
-
-#this works for sure
-# @../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
-# @../../make/run-cc.pl \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
}
# Routine to list out the extra/ modules that have been enabled.