summaryrefslogtreecommitdiff
path: root/scripts
authorkergoth <kergoth>2002-11-05 18:01:18 (UTC)
committer kergoth <kergoth>2002-11-05 18:01:18 (UTC)
commitbbacc58102236691c8161fac2674998ce428ac3c (patch) (unidiff)
tree11bdfeccc32ef606863fd19e8ff8c3e293721335 /scripts
parent19f22f15980791a734604a2323dc86a73787196c (diff)
downloadopie-bbacc58102236691c8161fac2674998ce428ac3c.zip
opie-bbacc58102236691c8161fac2674998ce428ac3c.tar.gz
opie-bbacc58102236691c8161fac2674998ce428ac3c.tar.bz2
Update dependency generation, and ensure it uses the opie default config when none exists
Diffstat (limited to 'scripts') (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/deps.pl73
1 files changed, 73 insertions, 0 deletions
diff --git a/scripts/deps.pl b/scripts/deps.pl
new file mode 100755
index 0000000..56c4e77
--- a/dev/null
+++ b/scripts/deps.pl
@@ -0,0 +1,73 @@
1#!/usr/bin/perl -w
2
3use strict;
4
5my %depends;
6my %tokenpath;
7
8sub getdepends ($$)
9{
10 my ($token, $path, $intoken);
11 $token = shift || return;
12 $token =~ s/CONFIG_//;
13 $path = shift || return;
14#print "opening $path/config.in\n";
15 #print "token is $token\n";
16 open( FILE, "< $path/config.in" ) || return;
17 $intoken = 0;
18 while( <FILE> ) {
19 if( $intoken == 1 ) {
20 /depends\S*(.*)/ && return $1;
21 if( /\S*(config|menu)/ ) {
22 $intoken = 0;
23 return;
24 }
25 } else {
26 /$token/ || next;
27 $intoken = 1;
28 }
29 /$token/ || next;
30 }
31 close( FILE );
32 return;
33}
34
35sub makedepends ($$)
36{
37 my ($depends, $tokenpath, $token, $depword, $mustbesep, $state);
38 $depends = shift || return;
39 $tokenpath = shift || return;
40 $mustbesep = 0;
41
42 for $token (keys %$depends){
43 print ${$tokenpath}{$token} . " : ";
44 for (split(/\s+/, ${$depends}{$token})){
45 /^\s+$/ && next;
46 /\&\&/ && next;
47 /\|\|/ && next;
48 /^$/ && next;
49 if(defined(${$tokenpath}{"CONFIG_" . $_})){
50 print '$(if $(CONFIG_' . $_ . '),' . ${$tokenpath}{"CONFIG_" . $_} . ') ';
51 } else {
52 print STDERR "ERROR in dependency generation, unable to locate path for token CONFIG_$_\n";
53 }
54 }
55 print "\n";
56 }
57}
58
59while( <> ) {
60 my $dep;
61 my ($token, $path, $pro);
62 chomp;
63 s/^\s*//g;
64 s/\s*$//g;
65 ($token, $path, $pro) = split(/\s+/,$_);
66 $tokenpath{$token} = $path;
67 $dep = getdepends($token, $path);
68 if( $dep ) {
69 $depends{$token} = $dep;
70 }
71}
72
73makedepends(\%depends, \%tokenpath);