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