perl make script for massive tarballs

Matthew Weier OPhinney matthew-lists at weierophinney.net
Thu Jul 24 15:04:02 CEST 2003


I'd been using the update-xfce script to build xfce4 from cvs up until
the release candidates came out. Then I downloaded an rc, and well, got
very frustrated at having to manually unzip each archive, try and
remember the order in which they needed to be compiled, and then execute
the necessary steps. So I created a very quick perl script to do this
for me.

I've attached it here, along with an 'INSTALL' file that gives basic
directions for installing xfce4 with the script. Put the 'Make'
script in the src directory of your enormous tarball (where all the
individual tarballs reside), edit it to include the packages you desire,
make sure the various paths to system commands are correct, and fire it
up.

Several assumptions it makes:
(1) You are compiling and configuring with default values
(2) You are installing globally as root
(3) You have sudo access to make and su

If these assumptions are incorrect, the script is easily modifiable if
you know any perl at all.

Enjoy!

-- 
Matthew Weier O'Phinney
http://weierophinney.net/matthew/
-------------- next part --------------
#!/usr/bin/perl -w
use strict;
use Cwd;

# Edit this list to suit your installation
my @tarballs = ('libxfce4util', 'libxfce4mcs', 'libxfcegui4', 'xfce-mcs-manager', 'xfce-mcs-plugins', 'xfwm4', 'xfce4-panel', 'xfce-utils', 'xfprint', 'xfwm4-themes', 'xfce4-themes', 'xfce4-systray', 'xfce4-toys');

# Executable paths
my $tar      = '/bin/tar';
my $make     = '/usr/bin/make';
my $sudo     = '/usr/bin/sudo';
my $ldconfig = '/sbin/ldconfig';

# Stop editing here!
my $wd = getcwd();

for (my $i = 0; $i < $#tarballs; $i++) {
    chdir($wd);
    my $tarball = $tarballs[$i];
    my @tgz = glob($tarball . "-*.tar.gz");
    my $dir = '';
    if (@tgz) {
        $tarball = $tgz[0];
        print "Found $tarball; processing...\n";
        ($dir = $tarball) =~ s/(.*?)\.tar\.gz/$1/;
    } else {
        print STDERR "Unable to find corresponding tarball for $tarball!\n\n";
        next;
    }

    print "    Attempting to unzip... ";
    my $trap = system("$tar -xzf $tarball");
    if ($trap != 0) {
        print STDERR "Unable to unzip $tarball: $?\n\n";
        next;
    } else {
        print "Done!\n";
    }


    print "    Descending into $wd/$dir... ";
    chdir("$wd/$dir");
    my $cwd = getcwd();
    if ("$wd/$dir" ne $cwd) {
        print "Failure!\n\n";
        next;
    } else {
        print "Success!\n";
    }

    print "    Configuring... ";
    $trap = system("$cwd/configure");
    if ($trap != 0) {
        print STDERR "ERROR!\n $?\n\n";
        next;
    } else {
        print "Done!\n";
    }

    print "    Compiling... ";
    $trap = system($make);
    if ($trap != 0) {
        print STDERR "ERROR!\n $?\n\n";
        next;
    } else {
        print "Done!\n";
    }

    print "    Installing... ";
    $trap = system("$sudo $make install");
    if ($trap != 0) {
        print STDERR "ERROR!\n $?\n\n";
        next;
    } else {
        print "Done!\n\n\n";
    }

    print "    Running ldconfig... ";
    $trap = system("$sudo su -c $ldconfig");
    if ($trap != 0) {
        print STDERR "ERROR!\n $?\n\n";
        next;
    } else {
        print "Done!\n";
    }

    print "Done!\n\n\n";
}

print "Done! Check output for errors.\n";

1;



More information about the Xfce4-dev mailing list