#!/usr/bin/perl -w
use Cwd;

#local variables specific to your installation
$prefix= "/opt/gnome";
$gtk="/opt/gnome";

@order=qw(
	  glib
	  gtk+
	  libgtop
	  imlib
	  ORBit
	  gnome-libs
	  gnome-objc
	  gnome-core
	  gnome-guile
	  gnome-admin
	  gnome-games
	  gnome-network
	  gnome-utils
	  gnome-media
	  gedit
	  fnlib
	  ee
	  balsa
	  achtung
	  mc
	  gnumeric
	  pharmacy);

$ENV{"CVSROOT"} = ":pserver:anonymous\@anoncvs.gnome.org:/cvs/gnome";
$ENV{"ACLOCAL_FLAGS"} = "-I $prefix/share/aclocal";

#open (ERRORLOG, "/tmp/update.errors") || die "Could not open error log: $!";

foreach $name (@order) {
    print "Updating $name...\n";
    system "cvs -z3 update -d -P $name";
    print "$name updated...\n";
}

print "All updates complete. Compile phase beginning...\n\n";

print "Temporary hack: type yes to compile or no to abort: ";
$yesno = <STDIN>;
chomp ($yesno);
$yesno =~ tr/A-Z/a-z/;
exit 0 if ($yesno eq "no");

foreach $this (@order) {
    chdir $this;
    print "Compiling $this...\n";
    system "aclocal -I macros -I /opt/gnome/share/aclocal";
    system "make maintainer-clean";
    system "./autogen.sh --prefix=$prefix --with-gtk=$gtk && make && make install && /sbin/ldconfig";
    print "Made $this...\n";
    chdir "..";
}



