File: make_deps

package info (click to toggle)
libpostscriptbarcode 20140312-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,768 kB
  • ctags: 65
  • sloc: perl: 192; makefile: 180; sh: 107; lisp: 92; java: 49
file content (40 lines) | stat: -rwxr-xr-x 937 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -Tw

# $Id$

use strict;

my $srcfile=shift @ARGV || '';

open(SRC,$srcfile) || die "Unable to open source file: $srcfile";
my $src=join('',<SRC>);
close(SRC);

open(UPR,'src/uk.co.terryburton.bwipp.upr') || die 'Unable to open UPR file';
my $upr=join('',<UPR>);
close(UPR);

(my $begin, $_, my $resource, my $meta, $_, my $end)=$src=~/
  (^%\ --BEGIN\ (ENCODER|RENDERER|RESOURCE)\ ([\w-]+?)--$)
  (.*?)
  (^[^%].*?)
  (^%\ --END\ \2\ \3--$)
/msgx;

$resource='uk.co.terryburton.bwipp' if $resource eq 'preamble';

(my $reqs)=$meta=~/^% --REQUIRES (.*)--$/mg;
$reqs='' unless defined $reqs;

(my $provfile)=$upr=~/^$resource=(.*)$/m;

while (my $targetdir=shift @ARGV) {
  my $reqfiles="$targetdir/$provfile : ";
  foreach my $req (split /\s+/, $reqs) {
    $req='uk.co.terryburton.bwipp' if $req eq 'preamble';
    (my $reqfile)=$upr=~/^$req=(.*)$/m;
    $reqfiles.="$targetdir/$reqfile ";
  }
  print "$reqfiles\n";
}