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) (side-by-side diff)
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 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my %depends;
+my %tokenpath;
+
+sub getdepends ($$)
+{
+ my ($token, $path, $intoken);
+ $token = shift || return;
+ $token =~ s/CONFIG_//;
+ $path = shift || return;
+#print "opening $path/config.in\n";
+# print "token is $token\n";
+ open( FILE, "< $path/config.in" ) || return;
+ $intoken = 0;
+ while( <FILE> ) {
+ if( $intoken == 1 ) {
+ /depends\S*(.*)/ && return $1;
+ if( /\S*(config|menu)/ ) {
+ $intoken = 0;
+ return;
+ }
+ } else {
+ /$token/ || next;
+ $intoken = 1;
+ }
+ /$token/ || next;
+ }
+ close( FILE );
+ return;
+}
+
+sub makedepends ($$)
+{
+ my ($depends, $tokenpath, $token, $depword, $mustbesep, $state);
+ $depends = shift || return;
+ $tokenpath = shift || return;
+ $mustbesep = 0;
+
+ for $token (keys %$depends){
+ print ${$tokenpath}{$token} . " : ";
+ for (split(/\s+/, ${$depends}{$token})){
+ /^\s+$/ && next;
+ /\&\&/ && next;
+ /\|\|/ && next;
+ /^$/ && next;
+ if(defined(${$tokenpath}{"CONFIG_" . $_})){
+ print '$(if $(CONFIG_' . $_ . '),' . ${$tokenpath}{"CONFIG_" . $_} . ') ';
+ } else {
+ print STDERR "ERROR in dependency generation, unable to locate path for token CONFIG_$_\n";
+ }
+ }
+ print "\n";
+ }
+}
+
+while( <> ) {
+ my $dep;
+ my ($token, $path, $pro);
+ chomp;
+ s/^\s*//g;
+ s/\s*$//g;
+ ($token, $path, $pro) = split(/\s+/,$_);
+ $tokenpath{$token} = $path;
+ $dep = getdepends($token, $path);
+ if( $dep ) {
+ $depends{$token} = $dep;
+ }
+}
+
+makedepends(\%depends, \%tokenpath);