boot 1.99 KB
Newer Older
1 2 3 4 5
#!/usr/bin/perl -w

use strict;

use Cwd;
6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
my %required_tag;

$required_tag{"-"} = 1;

while ($#ARGV ne -1) {
    my $arg = shift @ARGV;

    if ($arg =~ /^--required-tag=(.*)/) {
        $required_tag{$1} = 1;
    }
    else {
        die "Bad arg: $arg";
    }
}

22
# Create libraries/*/{ghc.mk,GNUmakefile}
23 24 25
system("/usr/bin/perl", "-w", "boot-pkgs") == 0
    or die "Running boot-pkgs failed: $?";

26
my $tag;
27 28 29
my $dir;
my $curdir;

30 31
$curdir = &cwd()
    or die "Can't find current directory: $!";
32

33
# Check that we have all boot packages.
34 35 36 37 38
open PACKAGES, "< packages";
while (<PACKAGES>) {
    if (/^#/) {
        # Comment; do nothing
    }
39
    elsif (/^([a-zA-Z0-9\/.-]+) +([^ ]+) +[^ ]+ +[^ ]+ +[^ ]+$/) {
40
        $dir = $1;
41
        $tag = $2;
42
        
43
        # If $tag is not "-" then it is an optional repository, so its
44
        # absence isn't an error.
45
        if (defined($required_tag{$tag})) {
46 47 48 49 50 51 52 53 54
            # We would like to just check for an _darcs directory here,
            # but in an lndir tree we avoid making _darcs directories,
            # so it doesn't exist. We therefore require that every repo
            # has a LICENSE file instead.
            if (! -f "$dir/LICENSE") {
                print STDERR "Error: $dir/LICENSE doesn't exist.\n";
                die "Maybe you haven't done './darcs-all get'?";
            }
        }
55 56 57 58 59 60
    }
    else {
        die "Bad line in packages file: $_";
    }
}
close PACKAGES;
61

Ian Lynagh's avatar
Ian Lynagh committed
62
# autoreconf everything that needs it.
63 64 65
foreach $dir (".", glob("libraries/*/")) {
    if (-f "$dir/configure.ac") {
        print "Booting $dir\n";
66 67 68 69
        chdir $dir or die "can't change to $dir: $!";
        system("autoreconf") == 0
            or die "Running autoreconf failed with exitcode $?";
        chdir $curdir or die "can't change to $curdir: $!";
70 71
    }
}
72

sven.panne@aedion.de's avatar
sven.panne@aedion.de committed
73
# Alas, darcs doesn't handle file permissions, so fix a few of them.
74
for my $file ("boot", "darcs-all", "validate") {
75 76 77 78
    if (-f $file) {
        chmod 0755, $file
            or die "Can't chmod 0755 $file: $!";
    }
79
}