public
Description: A wiki engine written in Perl 6
Homepage:
Clone URL: git://github.com/viklund/november.git
viklund (author)
Sun Jun 28 10:27:27 -0700 2009
commit  e5984250deb4079b267ef458ff6b4d156beb7727
tree    d0bceb0b14b53498e0cf33f374728a59fc830396
parent  3be6afd61e505a25998b4afa6f6ec4dae945d2f0
november / Makefile.PL
100644 70 lines (57 sloc) 1.988 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl
$|++;
 
use strict;
use warnings;
 
use File::Spec;
 
my $parrot_dir = $ENV{PARROT_DIR}
    or die 'Please set $PARROT_DIR (see README).'."\n";
 
my $rakudo_dir = $ENV{RAKUDO_DIR}
    or die 'Please set $RAKUDO_DIR (see README).'."\n";
 
$ENV{PERL6LIB}
    or die 'Please set $PERL6LIB (see README).'."\n";
 
my $parrot_exec = $^O eq 'MSWin32' ? 'parrot.exe' : 'parrot';
if ( ! -d $parrot_dir ) {
     print STDERR "Not a directory $parrot_dir, exiting...\n";
     exit 1;
} elsif ( ! -x File::Spec->catfile( $parrot_dir, $parrot_exec )) {
    print STDERR "Couldn't find parrot executable in $parrot_dir, "
                 . "have you compiled?\n";
    exit 1;
}
 
if ( ! -d $rakudo_dir ) {
    print STDERR "Not a directory $rakudo_dir, exiting...\n";
    exit 1;
} elsif ( ! -f File::Spec->catfile( $rakudo_dir, 'perl6.pbc' )) {
    print STDERR "Couldn't find perl6.pbc file in $rakudo_dir, "
                 . "have you compiled?\n";
    exit 1;
}
 
my @scripts = qw< test_wiki.sh wiki.sh >;
my @infiles = map { $_.'.in' } qw< Makefile test_wiki.sh wiki.sh >;
 
my %replacements = (
    PARROT_DIR => $parrot_dir,
    PARROT_EXEC => $parrot_exec,
    RAKUDO_DIR => $rakudo_dir,
);
 
if ( !-e 'lib/Test.pm' ) {
    !system("ln -s $parrot_dir/languages/rakudo/Test.pm lib/") or die @!;
    print "Symlinked Test.pm from the Rakudo directory \n";
}
 
for my $infile (@infiles) {
    if ((my $outfile = $infile) =~ s/\.in$//g) {
        open my $IN, '<', $infile or die "Couldn't open $infile, $!, $?";
        open my $OUT, '>', $outfile or die "Couldn't open $outfile, $!, $?";
        while (my $line = <$IN>) {
            while ( $line =~ /<(.*?)>/g ) {
                my $repl = $1;
                if (exists $replacements{$repl}) {
                    $line =~ s/<$repl>/$replacements{$repl}/g;
                }
            }
            print $OUT $line;
        }
        print "Created $outfile \n";
    }
}
 
# Make shell-scripts executable
chmod 0744, @scripts;