blob: f0e2dd0e2a19bfaeb66410e8cd3a555fed45f772 (
plain)
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
|
#!/usr/bin/perl
use strict;
use warnings;
my $mode = shift;
my %installed;
for my $dir (qw(src src/modules)) {
opendir(DIRHANDLE, $dir);
for my $file (sort readdir(DIRHANDLE)) {
next unless $file =~ /\.cpp$/;
open CPP, '<', "$dir/$file" or die "Can't open $dir/$file to scan it: $!";
while (<CPP>) {
if (/\/\* \$CopyInstall: (\S+) (\S+) \*\//i) {
my($ifile, $idir) = ($1,$2);
next if exists $installed{$1.' '.$2};
$installed{$1.' '.$2}++;
$idir =~ s/\$\(([^)]+)\)/$ENV{$1}/eg;
if ($mode eq 'install') {
system "install $ifile $idir";
} else {
$ifile =~ s/.*\///g;
system "rm $idir/$ifile";
}
}
}
}
closedir(DIRHANDLE);
}
|