MSWSP: add parse_CNatLanguageRestriction()
[wireshark-wip.git] / packaging / ws-manifest.pl
blob632f2e73048515abf03e9d99792bf4be31e740ad
2 # ws-manifest.pl - create a generic manifest file (including u3 information) from the wireshark.nsi
3 # $Id$
6 # These are the known directories in the distribution and where they should live on a U3 device
8 my %u3locs = qw(
9 $INSTDIR device
10 $INSTDIR\diameter device
11 $INSTDIR\dtds device
12 $INSTDIR\${GTK_ETC_DIR} host
13 $INSTDIR\${GTK_SCHEMAS_DIR} host
14 $INSTDIR\${GTK_ENGINES_DIR} host
15 $INSTDIR\${GTK_MODULES_DIR} host
16 $INSTDIR\etc\pango host
17 $INSTDIR\help device
18 $INSTDIR\platforms host
19 $INSTDIR\plugins\${VERSION} device
20 $INSTDIR\profiles\Bluetooth device
21 $INSTDIR\profiles\Classic device
22 $INSTDIR\radius device
23 $INSTDIR\snmp\mibs device
24 $INSTDIR\tpncp device
25 $INSTDIR\ui device
26 $INSTDIR\wimaxasncp device
29 my @dirs; # the directories in the manifest
30 my @defines; # stack of defines
32 while ($line = <>) {
33 $line =~ s/\r//g; # remove CR on Windows
34 if($line =~ /^SetOutPath (.+)$/) {
35 $outpath = $1;
36 $outpath =~ s/^'(.*)'$/$1/;
37 if($outpath ne '$PROFILE') { # ignore the PROFILE
38 push(@dirs, $outpath);
40 } elsif ($line =~ /!ifdef (.*)$/) {
41 push(@defines, $1);
42 } elsif ($line =~ /!endif/) {
43 pop(@defines);
44 if(scalar(@defines) == 0) {
45 undef @defines;
47 } elsif ($line =~/^File.*uninstall/i) {
48 next;
49 } elsif ($line =~ /^File[^\"]+\"([^\"]+)\"/) {
50 $file = $1;
51 # make things relative to the root rather than the NSIS directory
52 if($file =~ /^[^\.\$]/) { $file = "packaging\\nsis\\" . $file; }
53 $file =~ s/\.\.\\\.\.\\//; # remove ../../
54 push(@$outpath, $file);
56 if(defined @defines) {
57 push(@$file, "ifdef=" . $defines[-1]);
60 # there may be a parameter - copy it across
61 if($line =~ /\/(\S+)/) {
62 push(@$file, $1);
67 print "#\n# DO NOT EDIT - autogenerated from wireshark.nsi\n#\n";
69 foreach $dir(sort @dirs) {
71 if($prev ne $dir) {
72 print STDERR "looking for $dir\n";
73 $loc = $u3locs{$dir};
75 if(defined $loc) {
77 print "[". $dir . " u3loc=" . $loc . "]\n";
79 foreach $file(sort @$dir) {
80 print "\t" . $file;
82 foreach $param (sort(@$file)) {
83 print " " . $param;
86 if($dir eq '$INSTDIR') { # try and find a better location
87 if($file =~ /\.dll$|\.exe$|EXE}$|DLL}$/ && !($file =~ /WinPcap/) && !($file =~ /VCREDIST_EXE/)) {
88 print " u3loc=host";
92 print "\n";
94 } else {
96 push(@ignored, $dir);
100 $prev = $dir;
103 if(defined @ignored) {
105 print STDERR "ERROR\nThe following directories have no known location on a U3 device:\n";
107 foreach $dir(sort @ignored) {
108 print STDERR "\t" . $dir . " ";
111 print STDERR "\n";
113 exit -1;