Make the frame_data_sequence structure opaque, and move some other
[obnox/wireshark/wip.git] / packaging / ws-manifest.pl
1 #
2 # ws-manifest.pl - create a generic manifest file (including u3 information) from the wireshark.nsi 
3 # $Id$
4 #
5
6 # These are the known directories in the distribution and where they should live on a U3 device
7
8 my %u3locs = qw(
9         $INSTDIR device
10         $INSTDIR\${GTK_WIMP_DLLDST_DIR} host
11         $INSTDIR\${GTK_WIMP_RCDST_DIR} host
12         $INSTDIR\diameter device
13         $INSTDIR\dtds device
14         $INSTDIR\etc\gtk-2.0 host
15         $INSTDIR\etc\pango host
16         $INSTDIR\help device
17         $INSTDIR\lib\gtk-2.0\${GTK_LIB_DIR}\engines host
18         $INSTDIR\lib\gtk-2.0\${GTK_LIB_DIR}\immodules host
19         $INSTDIR\lib\gtk-2.0\${GTK_LIB_DIR}\loaders host
20         $INSTDIR\lib\gtk-2.0\modules host
21         $INSTDIR\plugins\${VERSION} device
22         $INSTDIR\radius device
23         $INSTDIR\snmp\mibs device
24         $INSTDIR\tpncp device
25         $INSTDIR\wimaxasncp device
26         );
27
28 my @dirs; # the directories in the manifest
29 my @defines; # stack of defines
30
31 while ($line = <>) {
32     if($line =~ /^SetOutPath (.+)$/) {
33         $outpath = $1;
34         $outpath =~ s/^'(.*)'$/$1/;
35         if($outpath ne '$PROFILE') { # ignore the PROFILE
36             push(@dirs, $outpath);
37         }
38     } elsif ($line =~ /!ifdef (.*)$/) {
39         push(@defines, $1);
40     } elsif ($line =~ /!endif/) {
41         pop(@defines);
42         if(scalar(@defines) == 0) {
43             undef @defines;
44         }
45     } elsif ($line =~ /^File[^\"]+\"([^\"]+)\"/) {
46         $file = $1;
47         # make things relative to the root rather than the NSIS directory
48         if($file =~ /^[^\.\$]/) { $file = "packaging\\nsis\\" . $file; }
49         $file =~ s/\.\.\\\.\.\\//; # remove ../../
50         push(@$outpath, $file);
51
52         if(defined @defines) {
53             push(@$file, "ifdef=" . $defines[-1]);
54         }
55
56         # there may be a parameter - copy it across
57         if($line =~ /\/(\S+)/) {
58             push(@$file, $1);
59         }
60     }
61 }
62
63 print "#\n# DO NOT EDIT - autogenerated from wireshark.nsi\n#\n";
64
65 foreach $dir(sort @dirs) {
66
67     if($prev ne $dir) {
68         $loc = $u3locs{$dir};
69
70         if(defined $loc) { 
71             
72             print "[". $dir . " u3loc=" . $loc . "]\n";
73
74             foreach $file(sort @$dir) {
75                 print "\t" . $file;
76
77                 foreach $param (sort(@$file)) {
78                     print " " . $param;
79                 }
80
81                 if($dir eq '$INSTDIR') { # try and find a better location
82                     if($file =~ /\.dll$|\.exe$|EXE}$|DLL}$/ && !($file =~ /WinPcap/) && !($file =~ /VCREDIST_EXE/)) {
83                         print " u3loc=host";
84                     }
85         }
86
87                 print "\n";
88             }
89         } else {
90             
91             push(@ignored, $dir);
92             
93         }
94     }
95     $prev = $dir;
96 }
97
98 if(defined @ignored) {
99
100     print STDERR "ERROR\nThe following directories have no known location on a U3 device:\n";
101
102     foreach $dir(sort @ignored) {
103         print STDERR "\t" . $dir . " ";
104     }
105     
106     print STDERR "\n";
107
108     exit -1;
109 }