author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 30 | 5dc02b23752f |
child 37 | 758a864f9613 |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/perl -w |
2 |
###################################################################### |
|
3 |
# |
|
4 |
# Synchronizes Qt header files - internal development tool. |
|
5 |
# |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
6 |
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 7 |
# Contact: Nokia Corporation (qt-info@nokia.com) |
8 |
# |
|
9 |
###################################################################### |
|
10 |
||
11 |
# use packages ------------------------------------------------------- |
|
12 |
use File::Basename; |
|
13 |
use File::Path; |
|
14 |
use Cwd; |
|
15 |
use Config; |
|
16 |
use strict; |
|
17 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
18 |
for (my $i = 0; $i < $#ARGV; $i++) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
19 |
if ($ARGV[$i] eq "-base-dir" && $i < $#ARGV - 1) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
20 |
$ENV{"QTDIR"} = $ARGV[$i + 1]; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
21 |
last; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
22 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
23 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
24 |
|
0 | 25 |
die "syncqt: QTDIR not defined" if ! $ENV{"QTDIR"}; # sanity check |
26 |
||
27 |
# global variables |
|
28 |
my $isunix = 0; |
|
29 |
my $basedir = $ENV{"QTDIR"}; |
|
30 |
$basedir =~ s=\\=/=g; |
|
31 |
my %modules = ( # path to module name map |
|
32 |
"QtGui" => "$basedir/src/gui", |
|
33 |
"QtOpenGL" => "$basedir/src/opengl", |
|
34 |
"QtOpenVG" => "$basedir/src/openvg", |
|
35 |
"QtCore" => "$basedir/src/corelib", |
|
36 |
"QtXml" => "$basedir/src/xml", |
|
37 |
"QtXmlPatterns" => "$basedir/src/xmlpatterns", |
|
38 |
"QtSql" => "$basedir/src/sql", |
|
39 |
"QtNetwork" => "$basedir/src/network", |
|
40 |
"QtSvg" => "$basedir/src/svg", |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
"QtDeclarative" => "$basedir/src/declarative", |
0 | 42 |
"QtScript" => "$basedir/src/script", |
43 |
"QtScriptTools" => "$basedir/src/scripttools", |
|
44 |
"Qt3Support" => "$basedir/src/qt3support", |
|
45 |
"ActiveQt" => "$basedir/src/activeqt/container;$basedir/src/activeqt/control;$basedir/src/activeqt/shared", |
|
46 |
"QtTest" => "$basedir/src/testlib", |
|
47 |
"QtHelp" => "$basedir/tools/assistant/lib", |
|
48 |
"QtDesigner" => "$basedir/tools/designer/src/lib", |
|
49 |
"QtUiTools" => "$basedir/tools/designer/src/uitools", |
|
50 |
"QtDBus" => "$basedir/src/dbus", |
|
51 |
"QtWebKit" => "$basedir/src/3rdparty/webkit/WebCore", |
|
52 |
"phonon" => "$basedir/src/phonon", |
|
53 |
"QtMultimedia" => "$basedir/src/multimedia", |
|
54 |
); |
|
55 |
my %moduleheaders = ( # restrict the module headers to those found in relative path |
|
56 |
"QtWebKit" => "../WebKit/qt/Api", |
|
57 |
"phonon" => "../3rdparty/phonon/phonon", |
|
58 |
); |
|
59 |
||
60 |
#$modules{"QtCore"} .= ";$basedir/mkspecs/" . $ENV{"MKSPEC"} if defined $ENV{"MKSPEC"}; |
|
61 |
||
62 |
# global variables (modified by options) |
|
63 |
my $module = 0; |
|
64 |
my $showonly = 0; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
65 |
my $quiet = 0; |
0 | 66 |
my $remove_stale = 1; |
67 |
my $force_win = 0; |
|
68 |
my $force_relative = 0; |
|
69 |
my $check_includes = 0; |
|
70 |
my $copy_headers = 0; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
71 |
my $create_uic_class_map = 1; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
72 |
my $create_private_headers = 1; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
73 |
my $oneway = 0; |
0 | 74 |
my @modules_to_sync ; |
75 |
$force_relative = 1 if ( -d "/System/Library/Frameworks" ); |
|
76 |
my $out_basedir = $basedir; |
|
77 |
$out_basedir =~ s=\\=/=g; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
78 |
my $out_subdir = 'include'; |
0 | 79 |
|
80 |
# functions ---------------------------------------------------------- |
|
81 |
||
82 |
###################################################################### |
|
83 |
# Syntax: showUsage() |
|
84 |
# Params: -none- |
|
85 |
# |
|
86 |
# Purpose: Show the usage of the script. |
|
87 |
# Returns: -none- |
|
88 |
###################################################################### |
|
89 |
sub showUsage |
|
90 |
{ |
|
91 |
print "$0 usage:\n"; |
|
92 |
print " -copy Copy headers instead of include-fwd(default: " . ($copy_headers ? "yes" : "no") . ")\n"; |
|
93 |
print " -remove-stale Removes stale headers (default: " . ($remove_stale ? "yes" : "no") . ")\n"; |
|
94 |
print " -relative Force relative symlinks (default: " . ($force_relative ? "yes" : "no") . ")\n"; |
|
95 |
print " -windows Force platform to Windows (default: " . ($force_win ? "yes" : "no") . ")\n"; |
|
96 |
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n"; |
|
97 |
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n"; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
98 |
print " -outsubdir <DIR> Target subdir under outdir (default: $out_subdir)\n"; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
99 |
print " -public Create only public headers (default: " . ($create_private_headers ? "no" : "yes") . ")\n"; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
100 |
print " -oneway Don't sync back from outdir (default: " . ($oneway ? "yes" : "no") . ")\n"; |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
101 |
print " -quiet Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n"; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
102 |
print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR> Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n"; |
0 | 103 |
print " -help This help\n"; |
104 |
exit 0; |
|
105 |
} |
|
106 |
||
107 |
###################################################################### |
|
108 |
# Syntax: checkUnix() |
|
109 |
# Params: -none- |
|
110 |
# |
|
111 |
# Purpose: Check if script runs on a Unix system or not. Cygwin |
|
112 |
# systems are _not_ detected as Unix systems. |
|
113 |
# Returns: 1 if a unix system, else 0. |
|
114 |
###################################################################### |
|
115 |
sub checkUnix { |
|
116 |
my ($r) = 0; |
|
117 |
if ( $force_win != 0) { |
|
118 |
return 0; |
|
119 |
} elsif ( -f "/bin/uname" ) { |
|
120 |
$r = 1; |
|
121 |
(-f "\\bin\\uname") && ($r = 0); |
|
122 |
} elsif ( -f "/usr/bin/uname" ) { |
|
123 |
$r = 1; |
|
124 |
(-f "\\usr\\bin\\uname") && ($r = 0); |
|
125 |
} |
|
126 |
if($r) { |
|
127 |
$_ = $Config{'osname'}; |
|
128 |
$r = 0 if( /(ms)|(cyg)win/i ); |
|
129 |
} |
|
130 |
return $r; |
|
131 |
} |
|
132 |
||
133 |
sub checkRelative { |
|
134 |
my ($dir) = @_; |
|
135 |
return 0 if($dir =~ /^\//); |
|
136 |
return 0 if(!checkUnix() && $dir =~ /[a-zA-Z]:[\/\\]/); |
|
137 |
return 1; |
|
138 |
} |
|
139 |
||
140 |
###################################################################### |
|
141 |
# Syntax: shouldMasterInclude(iheader) |
|
142 |
# Params: iheader, string, filename to verify inclusion |
|
143 |
# |
|
144 |
# Purpose: Determines if header should be in the master include file. |
|
145 |
# Returns: 0 if file contains "#pragma qt_no_master_include" or not |
|
146 |
# able to open, else 1. |
|
147 |
###################################################################### |
|
148 |
sub shouldMasterInclude { |
|
149 |
my ($iheader) = @_; |
|
150 |
return 0 if(basename($iheader) =~ /_/); |
|
151 |
return 0 if(basename($iheader) =~ /qconfig/); |
|
152 |
if(open(F, "<$iheader")) { |
|
153 |
while(<F>) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
154 |
chomp; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
155 |
return 0 if(/^\#pragma qt_no_master_include$/); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
156 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
157 |
close(F); |
0 | 158 |
} else { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
159 |
return 0; |
0 | 160 |
} |
161 |
return 1; |
|
162 |
} |
|
163 |
||
164 |
###################################################################### |
|
165 |
# Syntax: classNames(iheader) |
|
166 |
# Params: iheader, string, filename to parse for classname "symlinks" |
|
167 |
# |
|
168 |
# Purpose: Scans through iheader to find all classnames that should be |
|
169 |
# synced into library's include structure. |
|
170 |
# Returns: List of all class names in a file. |
|
171 |
###################################################################### |
|
172 |
sub classNames { |
|
173 |
my @ret; |
|
174 |
my ($iheader) = @_; |
|
175 |
if(basename($iheader) eq "qglobal.h") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
176 |
push @ret, "QtGlobal"; |
0 | 177 |
} elsif(basename($iheader) eq "qendian.h") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
178 |
push @ret, "QtEndian"; |
0 | 179 |
} elsif(basename($iheader) eq "qconfig.h") { |
180 |
push @ret, "QtConfig"; |
|
181 |
} elsif(basename($iheader) eq "qplugin.h") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
182 |
push @ret, "QtPlugin"; |
0 | 183 |
} elsif(basename($iheader) eq "qalgorithms.h") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
184 |
push @ret, "QtAlgorithms"; |
0 | 185 |
} elsif(basename($iheader) eq "qcontainerfwd.h") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
186 |
push @ret, "QtContainerFwd"; |
0 | 187 |
} elsif(basename($iheader) eq "qdebug.h") { |
188 |
push @ret, "QtDebug"; |
|
189 |
} elsif(basename($iheader) eq "qevent.h") { |
|
190 |
push @ret, "QtEvents"; |
|
191 |
} elsif(basename($iheader) eq "qnamespace.h") { |
|
192 |
push @ret, "Qt" |
|
193 |
} elsif(basename($iheader) eq "qssl.h") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
194 |
push @ret, "QSsl"; |
0 | 195 |
} elsif(basename($iheader) eq "qtest.h") { |
196 |
push @ret, "QTest" |
|
197 |
} elsif(basename($iheader) eq "qtconcurrentmap.h") { |
|
198 |
push @ret, "QtConcurrentMap" |
|
199 |
} elsif(basename($iheader) eq "qtconcurrentfilter.h") { |
|
200 |
push @ret, "QtConcurrentFilter" |
|
201 |
} elsif(basename($iheader) eq "qtconcurrentrun.h") { |
|
202 |
push @ret, "QtConcurrentRun" |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
203 |
} elsif(basename($iheader) eq "qaudio.h") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
204 |
push @ret, "QAudio" |
0 | 205 |
} |
206 |
||
207 |
my $parsable = ""; |
|
208 |
if(open(F, "<$iheader")) { |
|
209 |
while(<F>) { |
|
210 |
my $line = $_; |
|
211 |
chomp $line; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
212 |
chop $line if ($line =~ /\r$/); |
0 | 213 |
if($line =~ /^\#/) { |
214 |
if($line =~ /\\$/) { |
|
215 |
while($line = <F>) { |
|
216 |
chomp $line; |
|
217 |
last unless($line =~ /\\$/); |
|
218 |
} |
|
219 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
220 |
return @ret if($line =~ m/^#pragma qt_sync_stop_processing/); |
0 | 221 |
push(@ret, "$1") if($line =~ m/^#pragma qt_class\(([^)]*)\)[\r\n]*$/); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
222 |
$line = 0; |
0 | 223 |
} |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
224 |
if($line) { |
0 | 225 |
$line =~ s,//.*$,,; #remove c++ comments |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
226 |
$line .= ";" if($line =~ m/^Q_[A-Z_]*\(.*\)[\r\n]*$/); #qt macro |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
227 |
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
228 |
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE[\r\n]*$/); #qt macro |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
229 |
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro |
0 | 230 |
$parsable .= " " . $line; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
231 |
} |
0 | 232 |
} |
233 |
close(F); |
|
234 |
} |
|
235 |
||
236 |
my $last_definition = 0; |
|
237 |
my @namespaces; |
|
238 |
for(my $i = 0; $i < length($parsable); $i++) { |
|
239 |
my $definition = 0; |
|
240 |
my $character = substr($parsable, $i, 1); |
|
241 |
if($character eq "/" && substr($parsable, $i+1, 1) eq "*") { #I parse like this for greedy reasons |
|
242 |
for($i+=2; $i < length($parsable); $i++) { |
|
243 |
my $end = substr($parsable, $i, 2); |
|
244 |
if($end eq "*/") { |
|
245 |
$last_definition = $i+2; |
|
246 |
$i++; |
|
247 |
last; |
|
248 |
} |
|
249 |
} |
|
250 |
} elsif($character eq "{") { |
|
251 |
my $brace_depth = 1; |
|
252 |
my $block_start = $i + 1; |
|
253 |
BLOCK: for($i+=1; $i < length($parsable); $i++) { |
|
254 |
my $ignore = substr($parsable, $i, 1); |
|
255 |
if($ignore eq "{") { |
|
256 |
$brace_depth++; |
|
257 |
} elsif($ignore eq "}") { |
|
258 |
$brace_depth--; |
|
259 |
unless($brace_depth) { |
|
260 |
for(my $i2 = $i+1; $i2 < length($parsable); $i2++) { |
|
261 |
my $end = substr($parsable, $i2, 1); |
|
262 |
if($end eq ";" || $end ne " ") { |
|
263 |
$definition = substr($parsable, $last_definition, $block_start - $last_definition) . "}"; |
|
264 |
$i = $i2 if($end eq ";"); |
|
265 |
$last_definition = $i + 1; |
|
266 |
last BLOCK; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
267 |
} |
0 | 268 |
} |
269 |
} |
|
270 |
} |
|
271 |
} |
|
272 |
} elsif($character eq ";") { |
|
273 |
$definition = substr($parsable, $last_definition, $i - $last_definition + 1); |
|
274 |
$last_definition = $i + 1; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
275 |
} elsif($character eq "}") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
276 |
# a naked } must be a namespace ending |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
277 |
# if it's not a namespace, it's eaten by the loop above |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
278 |
pop @namespaces; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
279 |
$last_definition = $i + 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
280 |
} |
0 | 281 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
282 |
if (substr($parsable, $last_definition, $i - $last_definition + 1) =~ m/ namespace ([^ ]*) / |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
283 |
&& substr($parsable, $i+1, 1) eq "{") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
284 |
push @namespaces, $1; |
0 | 285 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
286 |
# Eat the opening { so that the condensing loop above doesn't see it |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
287 |
$i++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
288 |
$last_definition = $i + 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
289 |
} |
0 | 290 |
|
291 |
if($definition) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
292 |
$definition =~ s=[\n\r]==g; |
0 | 293 |
my @symbols; |
294 |
if($definition =~ m/^ *typedef *.*\(\*([^\)]*)\)\(.*\);$/) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
295 |
push @symbols, $1; |
0 | 296 |
} elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
297 |
push @symbols, $2; |
0 | 298 |
} elsif($definition =~ m/^ *(template *<.*> *)?(class|struct) +([^ ]* +)?([^<\s]+) ?(<[^>]*> ?)?\s*((,|:)\s*(public|protected|private) *.*)? *\{\}$/) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
299 |
push @symbols, $4; |
0 | 300 |
} elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
301 |
push @symbols, "Q" . $1 . "Iterator"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
302 |
push @symbols, "QMutable" . $1 . "Iterator"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
303 |
} |
0 | 304 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
305 |
foreach (@symbols) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
306 |
my $symbol = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
307 |
$symbol = (join("::", @namespaces) . "::" . $symbol) if (scalar @namespaces); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
308 |
push @ret, $symbol |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
309 |
if ($symbol =~ /^Q[^:]*$/ # no-namespace, starting with Q |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
310 |
|| $symbol =~ /^Phonon::/); # or in the Phonon namespace |
0 | 311 |
} |
312 |
} |
|
313 |
} |
|
314 |
return @ret; |
|
315 |
} |
|
316 |
||
317 |
###################################################################### |
|
318 |
# Syntax: syncHeader(header, iheader, copy) |
|
319 |
# Params: header, string, filename to create "symlink" for |
|
320 |
# iheader, string, destination name of symlink |
|
321 |
# copy, forces header to be a copy of iheader |
|
322 |
# |
|
323 |
# Purpose: Syncronizes header to iheader |
|
324 |
# Returns: 1 if successful, else 0. |
|
325 |
###################################################################### |
|
326 |
sub syncHeader { |
|
327 |
my ($header, $iheader, $copy) = @_; |
|
328 |
$iheader =~ s=\\=/=g; |
|
329 |
$header =~ s=\\=/=g; |
|
330 |
return copyFile($iheader, $header) if($copy); |
|
331 |
||
332 |
unless(-e "$header") { |
|
333 |
my $header_dir = dirname($header); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
334 |
mkpath $header_dir, !$quiet; |
0 | 335 |
|
336 |
#write it |
|
337 |
my $iheader_out = fixPaths($iheader, $header_dir); |
|
338 |
open HEADER, ">$header" || die "Could not open $header for writing!\n"; |
|
339 |
print HEADER "#include \"$iheader_out\"\n"; |
|
340 |
close HEADER; |
|
341 |
return 1; |
|
342 |
} |
|
343 |
return 0; |
|
344 |
} |
|
345 |
||
346 |
###################################################################### |
|
347 |
# Syntax: fixPaths(file, dir) |
|
348 |
# Params: file, string, filepath to be made relative to dir |
|
349 |
# dir, string, dirpath for point of origin |
|
350 |
# |
|
351 |
# Purpose: file is made relative (if possible) of dir. |
|
352 |
# Returns: String with the above applied conversion. |
|
353 |
###################################################################### |
|
354 |
sub fixPaths { |
|
355 |
my ($file, $dir) = @_; |
|
356 |
$dir =~ s=^$basedir/=$out_basedir/= if(!($basedir eq $out_basedir)); |
|
357 |
$file =~ s=\\=/=g; |
|
358 |
$file =~ s/\+/\\+/g; |
|
359 |
$dir =~ s=\\=/=g; |
|
360 |
$dir =~ s/\+/\\+/g; |
|
361 |
||
362 |
#setup |
|
363 |
my $ret = $file; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
364 |
$ret =~ s,/cygdrive/([a-zA-Z])/,$1:/,g; |
0 | 365 |
my $file_dir = dirname($file); |
366 |
if($file_dir eq ".") { |
|
367 |
$file_dir = getcwd(); |
|
368 |
$file_dir =~ s=\\=/=g; |
|
369 |
} |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
370 |
$file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g; |
0 | 371 |
if($dir eq ".") { |
372 |
$dir = getcwd(); |
|
373 |
$dir =~ s=\\=/=g; |
|
374 |
} |
|
375 |
$dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g; |
|
376 |
return basename($file) if("$file_dir" eq "$dir"); |
|
377 |
||
378 |
#guts |
|
379 |
my $match_dir = 0; |
|
380 |
for(my $i = 1; $i < length($file_dir); $i++) { |
|
381 |
my $slash = index($file_dir, "/", $i); |
|
382 |
last if($slash == -1); |
|
383 |
my $tmp = substr($file_dir, 0, $slash); |
|
384 |
last unless($dir =~ m,^$tmp/,); |
|
385 |
$match_dir = $tmp; |
|
386 |
$i = $slash; |
|
387 |
} |
|
388 |
if($match_dir) { |
|
389 |
my $after = substr($dir, length($match_dir)); |
|
390 |
my $count = ($after =~ tr,/,,); |
|
391 |
my $dots = ""; |
|
392 |
for(my $i = 0; $i < $count; $i++) { |
|
393 |
$dots .= "../"; |
|
394 |
} |
|
395 |
$ret =~ s,^$match_dir,$dots,; |
|
396 |
} |
|
397 |
$ret =~ s,/+,/,g; |
|
398 |
return $ret; |
|
399 |
} |
|
400 |
||
401 |
###################################################################### |
|
402 |
# Syntax: fileContents(filename) |
|
403 |
# Params: filename, string, filename of file to return contents |
|
404 |
# |
|
405 |
# Purpose: Get the contents of a file. |
|
406 |
# Returns: String with contents of the file, or empty string if file |
|
407 |
# doens't exist. |
|
408 |
# Warning: Dies if it does exist but script cannot get read access. |
|
409 |
###################################################################### |
|
410 |
sub fileContents { |
|
411 |
my ($filename) = @_; |
|
412 |
my $filecontents = ""; |
|
413 |
if (-e $filename) { |
|
414 |
open(I, "< $filename") || die "Could not open $filename for reading, read block?"; |
|
415 |
local $/; |
|
416 |
binmode I; |
|
417 |
$filecontents = <I>; |
|
418 |
close I; |
|
419 |
} |
|
420 |
return $filecontents; |
|
421 |
} |
|
422 |
||
423 |
###################################################################### |
|
424 |
# Syntax: fileCompare(file1, file2) |
|
425 |
# Params: file1, string, filename of first file |
|
426 |
# file2, string, filename of second file |
|
427 |
# |
|
428 |
# Purpose: Determines if files are equal, and which one is newer. |
|
429 |
# Returns: 0 if files are equal no matter the timestamp, -1 if file1 |
|
430 |
# is newer, 1 if file2 is newer. |
|
431 |
###################################################################### |
|
432 |
sub fileCompare { |
|
433 |
my ($file1, $file2) = @_; |
|
434 |
my $file1contents = fileContents($file1); |
|
435 |
my $file2contents = fileContents($file2); |
|
436 |
if (! -e $file1) { return 1; } |
|
437 |
if (! -e $file2) { return -1; } |
|
438 |
return $file1contents ne $file2contents ? (stat("$file2"))[9] <=> (stat("$file1"))[9] : 0; |
|
439 |
} |
|
440 |
||
441 |
###################################################################### |
|
442 |
# Syntax: copyFile(file, ifile) |
|
443 |
# Params: file, string, filename to create duplicate for |
|
444 |
# ifile, string, destination name of duplicate |
|
445 |
# |
|
446 |
# Purpose: Keeps files in sync so changes in the newer file will be |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
447 |
# written to the other. Don't sync back if $oneway is set. |
0 | 448 |
# Returns: 1 if files were synced, else 0. |
449 |
# Warning: Dies if script cannot get write access. |
|
450 |
###################################################################### |
|
451 |
sub copyFile |
|
452 |
{ |
|
453 |
my ($file,$ifile, $copy,$knowdiff,$filecontents,$ifilecontents) = @_; |
|
454 |
# Bi-directional synchronization |
|
455 |
open( I, "< " . $file ) || die "Could not open $file for reading"; |
|
456 |
local $/; |
|
457 |
binmode I; |
|
458 |
$filecontents = <I>; |
|
459 |
close I; |
|
460 |
if ( open(I, "< " . $ifile) ) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
461 |
local $/; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
462 |
binmode I; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
463 |
$ifilecontents = <I>; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
464 |
close I; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
465 |
$copy = fileCompare($file, $ifile); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
466 |
$knowdiff = 0, |
0 | 467 |
} else { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
468 |
$copy = -1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
469 |
$knowdiff = 1; |
0 | 470 |
} |
471 |
||
472 |
if ( $knowdiff || ($filecontents ne $ifilecontents) ) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
473 |
if ( $copy > 0 && !$oneway) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
474 |
my $file_dir = dirname($file); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
475 |
mkpath $file_dir, !$quiet unless(-e "$file_dir"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
476 |
open(O, "> " . $file) || die "Could not open $file for writing (no write permission?)"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
477 |
local $/; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
478 |
binmode O; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
479 |
print O $ifilecontents; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
480 |
close O; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
481 |
return 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
482 |
} elsif ( $copy < 0 ) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
483 |
my $ifile_dir = dirname($ifile); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
484 |
mkpath $ifile_dir, !$quiet unless(-e "$ifile_dir"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
485 |
open(O, "> " . $ifile) || die "Could not open $ifile for writing (no write permission?)"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
486 |
local $/; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
487 |
binmode O; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
488 |
print O $filecontents; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
489 |
close O; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
490 |
return 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
491 |
} |
0 | 492 |
} |
493 |
return 0; |
|
494 |
} |
|
495 |
||
496 |
###################################################################### |
|
497 |
# Syntax: symlinkFile(file, ifile) |
|
498 |
# Params: file, string, filename to create "symlink" for |
|
499 |
# ifile, string, destination name of symlink |
|
500 |
# |
|
501 |
# Purpose: File is symlinked to ifile (or copied if filesystem doesn't |
|
502 |
# support symlink). |
|
503 |
# Returns: 1 on success, else 0. |
|
504 |
###################################################################### |
|
505 |
sub symlinkFile |
|
506 |
{ |
|
507 |
my ($file,$ifile) = @_; |
|
508 |
||
509 |
if ($isunix) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
510 |
print "symlink created for $file " unless $quiet; |
0 | 511 |
if ( $force_relative && ($ifile =~ /^$basedir/)) { |
512 |
my $t = getcwd(); |
|
513 |
my $c = -1; |
|
514 |
my $p = "../"; |
|
515 |
$t =~ s-^$basedir/--; |
|
516 |
$p .= "../" while( ($c = index( $t, "/", $c + 1)) != -1 ); |
|
517 |
$file =~ s-^$basedir/-$p-; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
518 |
print " ($file)\n" unless $quiet; |
0 | 519 |
} |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
520 |
print "\n" unless $quiet; |
0 | 521 |
return symlink($file, $ifile); |
522 |
} |
|
523 |
return copyFile($file, $ifile); |
|
524 |
} |
|
525 |
||
526 |
###################################################################### |
|
527 |
# Syntax: findFiles(dir, match, descend) |
|
528 |
# Params: dir, string, directory to search for name |
|
529 |
# match, string, regular expression to match in dir |
|
530 |
# descend, integer, 0 = non-recursive search |
|
531 |
# 1 = recurse search into subdirectories |
|
532 |
# |
|
533 |
# Purpose: Finds files matching a regular expression. |
|
534 |
# Returns: List of matching files. |
|
535 |
# |
|
536 |
# Examples: |
|
537 |
# findFiles("/usr","\.cpp$",1) - finds .cpp files in /usr and below |
|
538 |
# findFiles("/tmp","^#",0) - finds #* files in /tmp |
|
539 |
###################################################################### |
|
540 |
sub findFiles { |
|
541 |
my ($dir,$match,$descend) = @_; |
|
542 |
my ($file,$p,@files); |
|
543 |
local(*D); |
|
544 |
$dir =~ s=\\=/=g; |
|
545 |
($dir eq "") && ($dir = "."); |
|
546 |
if ( opendir(D,$dir) ) { |
|
547 |
if ( $dir eq "." ) { |
|
548 |
$dir = ""; |
|
549 |
} else { |
|
550 |
($dir =~ /\/$/) || ($dir .= "/"); |
|
551 |
} |
|
552 |
foreach $file ( sort readdir(D) ) { |
|
553 |
next if ( $file =~ /^\.\.?$/ ); |
|
554 |
$p = $file; |
|
555 |
($file =~ /$match/) && (push @files, $p); |
|
556 |
if ( $descend && -d $p && ! -l $p ) { |
|
557 |
push @files, &findFiles($p,$match,$descend); |
|
558 |
} |
|
559 |
} |
|
560 |
closedir(D); |
|
561 |
} |
|
562 |
return @files; |
|
563 |
} |
|
564 |
||
565 |
# -------------------------------------------------------------------- |
|
566 |
# "main" function |
|
567 |
# -------------------------------------------------------------------- |
|
568 |
||
569 |
while ( @ARGV ) { |
|
570 |
my $var = 0; |
|
571 |
my $val = 0; |
|
572 |
||
573 |
#parse |
|
574 |
my $arg = shift @ARGV; |
|
575 |
if ("$arg" eq "-h" || "$arg" eq "-help" || "$arg" eq "?") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
576 |
$var = "show_help"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
577 |
$val = "yes"; |
0 | 578 |
} elsif("$arg" eq "-copy") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
579 |
$var = "copy"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
580 |
$val = "yes"; |
0 | 581 |
} elsif("$arg" eq "-o" || "$arg" eq "-outdir") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
582 |
$var = "output"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
583 |
$val = shift @ARGV; |
0 | 584 |
} elsif("$arg" eq "-showonly" || "$arg" eq "-remove-stale" || "$arg" eq "-windows" || |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
585 |
"$arg" eq "-relative" || "$arg" eq "-check-includes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
586 |
$var = substr($arg, 1); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
587 |
$val = "yes"; |
0 | 588 |
} elsif("$arg" =~ /^-no-(.*)$/) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
589 |
$var = $1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
590 |
$val = "no"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
591 |
#these are for commandline compat |
0 | 592 |
} elsif("$arg" eq "-inc") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
593 |
$var = "output"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
594 |
$val = shift @ARGV; |
0 | 595 |
} elsif("$arg" eq "-module") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
596 |
$var = "module"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
597 |
$val = shift @ARGV; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
598 |
} elsif("$arg" eq "-separate-module") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
599 |
$var = "separate-module"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
600 |
$val = shift @ARGV; |
0 | 601 |
} elsif("$arg" eq "-show") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
602 |
$var = "showonly"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
603 |
$val = "yes"; |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
604 |
} elsif("$arg" eq "-quiet") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
605 |
$var = "quiet"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
606 |
$val = "yes"; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
607 |
} elsif("$arg" eq "-base-dir") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
608 |
# skip, it's been dealt with at the top of the file |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
609 |
shift @ARGV; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
610 |
next; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
611 |
} elsif("$arg" eq "-outsubdir") { |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
612 |
$var = "outsubdir"; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
613 |
$val = shift @ARGV; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
614 |
} elsif("$arg" eq "-public") { |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
615 |
$var = "public"; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
616 |
$val = "yes"; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
617 |
} elsif("$arg" eq "-oneway") { |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
618 |
$var = "oneway"; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
619 |
$val = "yes"; |
0 | 620 |
} |
621 |
||
622 |
#do something |
|
623 |
if(!$var || "$var" eq "show_help") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
624 |
print "Unknown option: $arg\n\n" if(!$var); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
625 |
showUsage(); |
0 | 626 |
} elsif ("$var" eq "copy") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
627 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
628 |
$copy_headers++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
629 |
} elsif($showonly) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
630 |
$copy_headers--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
631 |
} |
0 | 632 |
} elsif ("$var" eq "showonly") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
633 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
634 |
$showonly++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
635 |
} elsif($showonly) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
636 |
$showonly--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
637 |
} |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
638 |
} elsif ("$var" eq "quiet") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
639 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
640 |
$quiet++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
641 |
} elsif($quiet) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
642 |
$quiet--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
643 |
} |
0 | 644 |
} elsif ("$var" eq "check-includes") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
645 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
646 |
$check_includes++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
647 |
} elsif($check_includes) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
648 |
$check_includes--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
649 |
} |
0 | 650 |
} elsif ("$var" eq "remove-stale") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
651 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
652 |
$remove_stale++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
653 |
} elsif($remove_stale) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
654 |
$remove_stale--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
655 |
} |
0 | 656 |
} elsif ("$var" eq "windows") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
657 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
658 |
$force_win++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
659 |
} elsif($force_win) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
660 |
$force_win--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
661 |
} |
0 | 662 |
} elsif ("$var" eq "relative") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
663 |
if("$val" eq "yes") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
664 |
$force_relative++; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
665 |
} elsif($force_relative) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
666 |
$force_relative--; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
667 |
} |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
668 |
} elsif ("$var" eq "public") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
669 |
$create_private_headers = ("$val" eq "yes" ? 0 : 1); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
670 |
} elsif ("$var" eq "oneway") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
671 |
$oneway = ("$val" eq "yes" ? 1 : 0); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
672 |
} elsif ("$var" eq "outsubdir") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
673 |
$out_subdir = $val; |
0 | 674 |
} elsif ("$var" eq "module") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
675 |
print "module :$val:\n" unless $quiet; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
676 |
die "No such module: $val" unless(defined $modules{$val}); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
677 |
push @modules_to_sync, $val; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
678 |
} elsif ("$var" eq "separate-module") { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
679 |
my ($module, $prodir, $headerdir) = split(/:/, $val); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
680 |
$modules{$module} = $prodir; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
681 |
push @modules_to_sync, $module; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
682 |
$moduleheaders{$module} = $headerdir; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
683 |
$create_uic_class_map = 0; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
684 |
$create_private_headers = 0; |
0 | 685 |
} elsif ("$var" eq "output") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
686 |
my $outdir = $val; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
687 |
if(checkRelative($outdir)) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
688 |
$out_basedir = getcwd(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
689 |
chomp $out_basedir; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
690 |
$out_basedir .= "/" . $outdir; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
691 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
692 |
$out_basedir = $outdir; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
693 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
694 |
# \ -> / |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
695 |
$out_basedir =~ s=\\=/=g; |
0 | 696 |
} |
697 |
} |
|
698 |
@modules_to_sync = keys(%modules) if($#modules_to_sync == -1); |
|
699 |
||
700 |
$isunix = checkUnix; #cache checkUnix |
|
701 |
||
702 |
# create path |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
703 |
mkpath "$out_basedir/$out_subdir/Qt", !$quiet; |
0 | 704 |
|
705 |
my @ignore_headers = (); |
|
706 |
my $class_lib_map_contents = ""; |
|
707 |
my @ignore_for_master_contents = ( "qt.h", "qpaintdevicedefs.h" ); |
|
708 |
my @ignore_for_include_check = ( "qatomic.h" ); |
|
709 |
my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" ); |
|
710 |
my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" ); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
711 |
my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" ); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
712 |
my %colliding_headers = (); |
0 | 713 |
|
714 |
foreach (@modules_to_sync) { |
|
715 |
#iteration info |
|
716 |
my $lib = $_; |
|
717 |
my $dir = "$modules{$lib}"; |
|
718 |
my $pathtoheaders = ""; |
|
719 |
$pathtoheaders = "$moduleheaders{$lib}" if ($moduleheaders{$lib}); |
|
720 |
||
721 |
#information used after the syncing |
|
722 |
my $pri_install_classes = ""; |
|
723 |
my $pri_install_files = ""; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
724 |
my $pri_install_pfiles = ""; |
0 | 725 |
|
726 |
my $libcapitals = $lib; |
|
727 |
$libcapitals =~ y/a-z/A-Z/; |
|
728 |
my $master_contents = "#ifndef QT_".$libcapitals."_MODULE_H\n#define QT_".$libcapitals."_MODULE_H\n"; |
|
729 |
||
730 |
#get dependencies |
|
731 |
if(-e "$dir/" . basename($dir) . ".pro") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
732 |
if(open(F, "<$dir/" . basename($dir) . ".pro")) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
733 |
while(<F>) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
734 |
my $line = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
735 |
chomp $line; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
736 |
if($line =~ /^ *QT *\+?= *([^\r\n]*)/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
737 |
foreach(split(/ /, "$1")) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
738 |
$master_contents .= "#include <QtCore/QtCore>\n" if("$_" eq "core"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
739 |
$master_contents .= "#include <QtGui/QtGui>\n" if("$_" eq "gui"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
740 |
$master_contents .= "#include <QtNetwork/QtNetwork>\n" if("$_" eq "network"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
741 |
$master_contents .= "#include <QtSvg/QtSvg>\n" if("$_" eq "svg"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
742 |
$master_contents .= "#include <QtDeclarative/QtDeclarative>\n" if("$_" eq "declarative"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
743 |
$master_contents .= "#include <QtScript/QtScript>\n" if("$_" eq "script"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
744 |
$master_contents .= "#include <QtScriptTools/QtScriptTools>\n" if("$_" eq "scripttools"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
745 |
$master_contents .= "#include <Qt3Support/Qt3Support>\n" if("$_" eq "qt3support"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
746 |
$master_contents .= "#include <QtSql/QtSql>\n" if("$_" eq "sql"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
747 |
$master_contents .= "#include <QtXml/QtXml>\n" if("$_" eq "xml"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
748 |
$master_contents .= "#include <QtXmlPatterns/QtXmlPatterns>\n" if("$_" eq "xmlpatterns"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
749 |
$master_contents .= "#include <QtOpenGL/QtOpenGL>\n" if("$_" eq "opengl"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
750 |
$master_contents .= "#include <QtOpenVG/QtOpenVG>\n" if("$_" eq "openvg"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
751 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
752 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
753 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
754 |
close(F); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
755 |
} |
0 | 756 |
} |
757 |
||
758 |
#remove the old files |
|
759 |
if($remove_stale) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
760 |
my @subdirs = ("$out_basedir/$out_subdir/$lib"); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
761 |
foreach (@subdirs) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
762 |
my $subdir = "$_"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
763 |
if (opendir DIR, "$subdir") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
764 |
while(my $t = readdir(DIR)) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
765 |
my $file = "$subdir/$t"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
766 |
if(-d "$file") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
767 |
push @subdirs, "$file" unless($t eq "." || $t eq ".."); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
768 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
769 |
my @files = ("$file"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
770 |
#push @files, "$out_basedir/$out_subdir/Qt/$t" if(-e "$out_basedir/$out_subdir/Qt/$t"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
771 |
foreach (@files) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
772 |
my $file = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
773 |
my $remove_file = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
774 |
if(open(F, "<$file")) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
775 |
while(<F>) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
776 |
my $line = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
777 |
chomp $line; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
778 |
if($line =~ /^\#include \"([^\"]*)\"$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
779 |
my $include = $1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
780 |
$include = $subdir . "/" . $include unless(substr($include, 0, 1) eq "/"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
781 |
$remove_file = 1 unless(-e "$include"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
782 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
783 |
$remove_file = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
784 |
last; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
785 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
786 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
787 |
close(F); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
788 |
unlink "$file" if($remove_file); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
789 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
790 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
791 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
792 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
793 |
closedir DIR; |
0 | 794 |
} |
795 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
796 |
} |
0 | 797 |
} |
798 |
||
799 |
#create the new ones |
|
800 |
foreach (split(/;/, $dir)) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
801 |
my $current_dir = "$_"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
802 |
my $headers_dir = $current_dir; |
0 | 803 |
$headers_dir .= "/$pathtoheaders" if ($pathtoheaders); |
804 |
#calc subdirs |
|
805 |
my @subdirs = ($headers_dir); |
|
806 |
foreach (@subdirs) { |
|
807 |
my $subdir = "$_"; |
|
808 |
opendir DIR, "$subdir" or next; |
|
809 |
while(my $t = readdir(DIR)) { |
|
810 |
push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") && |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
811 |
!($t eq "..") && !($t eq ".obj") && |
0 | 812 |
!($t eq ".moc") && !($t eq ".rcc") && |
813 |
!($t eq ".uic") && !($t eq "build")); |
|
814 |
} |
|
815 |
closedir DIR; |
|
816 |
} |
|
817 |
||
818 |
#calc files and "copy" them |
|
819 |
foreach (@subdirs) { |
|
820 |
my $subdir = "$_"; |
|
821 |
my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0); |
|
822 |
foreach (@headers) { |
|
823 |
my $header = "$_"; |
|
824 |
$header = 0 if("$header" =~ /^ui_.*.h/); |
|
825 |
foreach (@ignore_headers) { |
|
826 |
$header = 0 if("$header" eq "$_"); |
|
827 |
} |
|
828 |
if($header) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
829 |
my $header_copies = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
830 |
#figure out if it is a public header |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
831 |
my $public_header = $header; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
832 |
if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
833 |
$public_header = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
834 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
835 |
foreach (@ignore_for_master_contents) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
836 |
$public_header = 0 if("$header" eq "$_"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
837 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
838 |
} |
0 | 839 |
|
840 |
my $iheader = $subdir . "/" . $header; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
841 |
my @classes = $public_header ? classNames($iheader) : (); |
0 | 842 |
if($showonly) { |
843 |
print "$header [$lib]\n"; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
844 |
foreach(@classes) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
845 |
print "SYMBOL: $_\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
846 |
} |
0 | 847 |
} else { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
848 |
#find out all the places it goes.. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
849 |
my @headers; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
850 |
if ($public_header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
851 |
@headers = ( "$out_basedir/$out_subdir/$lib/$header" ); |
0 | 852 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
853 |
# write forwarding headers to include/Qt |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
854 |
if ("$lib" ne "phonon" && "$subdir" =~ /^$basedir\/src/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
855 |
my $file_name = "$out_basedir/$out_subdir/Qt/$header"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
856 |
my $file_op = '>'; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
857 |
my $header_content = ''; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
858 |
if (exists $colliding_headers{$file_name}) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
859 |
$file_op = '>>'; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
860 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
861 |
$colliding_headers{$file_name} = 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
862 |
my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.'; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
863 |
$header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" . |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
864 |
" #if defined(__GNUC__)\n" . |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
865 |
" #pragma warning \"$warning_msg\"\n" . |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
866 |
" #elif defined(_MSC_VER)\n" . |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
867 |
" #pragma message \"WARNING: $warning_msg\"\n" . |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
868 |
" #endif\n". |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
869 |
"#endif\n\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
870 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
871 |
$header_content .= '#include "' . "../$lib/$header" . "\"\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
872 |
open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
873 |
print HEADERFILE $header_content; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
874 |
close HEADERFILE; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
875 |
} |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
876 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
877 |
foreach(@classes) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
878 |
my $header_base = basename($header); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
879 |
my $class = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
880 |
# Strip namespaces: |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
881 |
$class =~ s/^.*:://; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
882 |
# if ($class =~ m/::/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
883 |
# class =~ s,::,/,g; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
884 |
# } |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
885 |
$class_lib_map_contents .= "QT_CLASS_LIB($_, $lib, $header_base)\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
886 |
$header_copies++ if(syncHeader("$out_basedir/$out_subdir/$lib/$class", "$out_basedir/$out_subdir/$lib/$header", 0)); |
0 | 887 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
888 |
# KDE-Compat headers for Phonon |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
889 |
if ($lib eq "phonon") { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
890 |
$header_copies++ if (syncHeader("$out_basedir/$out_subdir/phonon_compat/Phonon/$class", "$out_basedir/$out_subdir/$lib/$header", 0)); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
891 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
892 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
893 |
} elsif ($create_private_headers) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
894 |
@headers = ( "$out_basedir/$out_subdir/$lib/private/$header" ); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
895 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
896 |
foreach(@headers) { #sync them |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
897 |
$header_copies++ if(syncHeader($_, $iheader, $copy_headers)); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
898 |
} |
0 | 899 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
900 |
if($public_header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
901 |
#put it into the master file |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
902 |
$master_contents .= "#include \"$public_header\"\n" if(shouldMasterInclude($iheader)); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
903 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
904 |
#deal with the install directives |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
905 |
if($public_header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
906 |
my $pri_install_iheader = fixPaths($iheader, $current_dir); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
907 |
foreach(@classes) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
908 |
my $class = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
909 |
# Strip namespaces: |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
910 |
$class =~ s/^.*:://; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
911 |
# if ($class =~ m/::/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
912 |
# $class =~ s,::,/,g; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
913 |
# } |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
914 |
my $class_header = fixPaths("$out_basedir/$out_subdir/$lib/$class", |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
915 |
$current_dir) . " "; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
916 |
$pri_install_classes .= $class_header |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
917 |
unless($pri_install_classes =~ $class_header); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
918 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
919 |
$pri_install_files.= "$pri_install_iheader ";; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
920 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
921 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
922 |
else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
923 |
my $pri_install_iheader = fixPaths($iheader, $current_dir); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
924 |
$pri_install_pfiles.= "$pri_install_iheader ";; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
925 |
} |
0 | 926 |
} |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
927 |
print "header created for $iheader ($header_copies)\n" if($header_copies > 0 && !$quiet); |
0 | 928 |
} |
929 |
} |
|
930 |
} |
|
931 |
} |
|
932 |
||
933 |
# close the master include: |
|
934 |
$master_contents .= "#endif\n"; |
|
935 |
||
936 |
unless($showonly) { |
|
937 |
my @master_includes; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
938 |
push @master_includes, "$out_basedir/$out_subdir/$lib/$lib"; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
939 |
push @master_includes, "$out_basedir/$out_subdir/phonon_compat/Phonon/Phonon" if ($lib eq "phonon"); |
0 | 940 |
foreach my $master_include (@master_includes) { |
941 |
#generate the "master" include file |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
942 |
my @tmp = split(/;/,$modules{$lib}); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
943 |
$pri_install_files .= fixPaths($master_include, "$tmp[0]") . " "; #get the master file installed too |
0 | 944 |
if($master_include && -e "$master_include") { |
945 |
open MASTERINCLUDE, "<$master_include"; |
|
946 |
local $/; |
|
947 |
binmode MASTERINCLUDE; |
|
948 |
my $oldmaster = <MASTERINCLUDE>; |
|
949 |
close MASTERINCLUDE; |
|
950 |
$oldmaster =~ s/\r//g; # remove \r's , so comparison is ok on all platforms |
|
951 |
$master_include = 0 if($oldmaster eq $master_contents); |
|
952 |
} |
|
953 |
if($master_include && $master_contents) { |
|
954 |
my $master_dir = dirname($master_include); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
955 |
mkpath $master_dir, !$quiet; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
956 |
print "header (master) created for $lib\n" unless $quiet; |
0 | 957 |
open MASTERINCLUDE, ">$master_include"; |
958 |
print MASTERINCLUDE "$master_contents"; |
|
959 |
close MASTERINCLUDE; |
|
960 |
} |
|
961 |
} |
|
962 |
||
963 |
#handle the headers.pri for each module |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
964 |
my $headers_pri_contents = ""; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
965 |
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
966 |
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
967 |
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n"; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
968 |
my $headers_pri_file = "$out_basedir/$out_subdir/$lib/headers.pri"; |
0 | 969 |
if(-e "$headers_pri_file") { |
970 |
open HEADERS_PRI_FILE, "<$headers_pri_file"; |
|
971 |
local $/; |
|
972 |
binmode HEADERS_PRI_FILE; |
|
973 |
my $old_headers_pri_contents = <HEADERS_PRI_FILE>; |
|
974 |
close HEADERS_PRI_FILE; |
|
975 |
$old_headers_pri_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms |
|
976 |
$headers_pri_file = 0 if($old_headers_pri_contents eq $headers_pri_contents); |
|
977 |
} |
|
978 |
if($headers_pri_file && $master_contents) { |
|
979 |
my $headers_pri_dir = dirname($headers_pri_file); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
980 |
mkpath $headers_pri_dir, !$quiet; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
981 |
print "headers.pri file created for $lib\n" unless $quiet; |
0 | 982 |
open HEADERS_PRI_FILE, ">$headers_pri_file"; |
983 |
print HEADERS_PRI_FILE "$headers_pri_contents"; |
|
984 |
close HEADERS_PRI_FILE; |
|
985 |
} |
|
986 |
} |
|
987 |
} |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
988 |
unless($showonly || !$create_uic_class_map) { |
0 | 989 |
my $class_lib_map = "$out_basedir/src/tools/uic/qclass_lib_map.h"; |
990 |
if(-e "$class_lib_map") { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
991 |
open CLASS_LIB_MAP, "<$class_lib_map"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
992 |
local $/; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
993 |
binmode CLASS_LIB_MAP; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
994 |
my $old_class_lib_map_contents = <CLASS_LIB_MAP>; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
995 |
close CLASS_LIB_MAP; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
996 |
$old_class_lib_map_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
997 |
$class_lib_map = 0 if($old_class_lib_map_contents eq $class_lib_map_contents); |
0 | 998 |
} |
999 |
if($class_lib_map) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1000 |
my $class_lib_map_dir = dirname($class_lib_map); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1001 |
mkpath $class_lib_map_dir, !$quiet; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1002 |
open CLASS_LIB_MAP, ">$class_lib_map"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1003 |
print CLASS_LIB_MAP "$class_lib_map_contents"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1004 |
close CLASS_LIB_MAP; |
0 | 1005 |
} |
1006 |
} |
|
1007 |
||
1008 |
if($check_includes) { |
|
1009 |
for (keys(%modules)) { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1010 |
#iteration info |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1011 |
my $lib = $_; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1012 |
my $dir = "$modules{$lib}"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1013 |
foreach (split(/;/, $dir)) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1014 |
my $current_dir = "$_"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1015 |
#calc subdirs |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1016 |
my @subdirs = ($current_dir); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1017 |
foreach (@subdirs) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1018 |
my $subdir = "$_"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1019 |
opendir DIR, "$subdir"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1020 |
while(my $t = readdir(DIR)) { |
0 | 1021 |
push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") && |
1022 |
!($t eq "..") && !($t eq ".obj") && |
|
1023 |
!($t eq ".moc") && !($t eq ".rcc") && |
|
1024 |
!($t eq ".uic") && !($t eq "build")); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1025 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1026 |
closedir DIR; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1027 |
} |
0 | 1028 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1029 |
foreach (@subdirs) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1030 |
my $subdir = "$_"; |
0 | 1031 |
my $header_skip_qt_module_test = 0; |
1032 |
foreach(@ignore_for_qt_module_check) { |
|
1033 |
foreach (split(/;/, $_)) { |
|
1034 |
$header_skip_qt_module_test = 1 if ("$subdir" =~ /^$_/); |
|
1035 |
} |
|
1036 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1037 |
my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1038 |
foreach (@headers) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1039 |
my $header = "$_"; |
0 | 1040 |
my $header_skip_qt_begin_header_test = 0; |
1041 |
my $header_skip_qt_begin_namespace_test = 0; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1042 |
$header = 0 if("$header" =~ /^ui_.*.h/); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1043 |
foreach (@ignore_headers) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1044 |
$header = 0 if("$header" eq "$_"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1045 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1046 |
if($header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1047 |
my $public_header = $header; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1048 |
if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1049 |
$public_header = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1050 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1051 |
foreach (@ignore_for_master_contents) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1052 |
$public_header = 0 if("$header" eq "$_"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1053 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1054 |
if($public_header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1055 |
foreach (@ignore_for_include_check) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1056 |
$public_header = 0 if("$header" eq "$_"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1057 |
} |
0 | 1058 |
foreach(@ignore_for_qt_begin_header_check) { |
1059 |
$header_skip_qt_begin_header_test = 1 if ("$header" eq "$_"); |
|
1060 |
} |
|
1061 |
foreach(@ignore_for_qt_begin_namespace_check) { |
|
1062 |
$header_skip_qt_begin_namespace_test = 1 if ("$header" eq "$_"); |
|
1063 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1064 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1065 |
} |
0 | 1066 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1067 |
my $iheader = $subdir . "/" . $header; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1068 |
if($public_header) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1069 |
if(open(F, "<$iheader")) { |
0 | 1070 |
my $qt_module_found = 0; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1071 |
my $qt_begin_header_found = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1072 |
my $qt_end_header_found = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1073 |
my $qt_begin_namespace_found = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1074 |
my $qt_end_namespace_found = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1075 |
my $line; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1076 |
while($line = <F>) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1077 |
chomp $line; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1078 |
my $output_line = 1; |
0 | 1079 |
if($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1080 |
last; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1081 |
} elsif($line =~ /^ *\# *include/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1082 |
my $include = $line; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1083 |
if($line =~ /<.*>/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1084 |
$include =~ s,.*<(.*)>.*,$1,; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1085 |
} elsif($line =~ /".*"/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1086 |
$include =~ s,.*"(.*)".*,$1,; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1087 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1088 |
$include = 0; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1089 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1090 |
if($include) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1091 |
for (keys(%modules)) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1092 |
my $trylib = $_; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1093 |
if(-e "$out_basedir/$out_subdir/$trylib/$include") { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1094 |
print "WARNING: $iheader includes $include when it should include $trylib/$include\n"; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1095 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1096 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1097 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1098 |
} elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_BEGIN_HEADER\s*$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1099 |
$qt_begin_header_found = 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1100 |
} elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_END_HEADER\s*$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1101 |
$qt_end_header_found = 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1102 |
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE\s*$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1103 |
$qt_begin_namespace_found = 1; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1104 |
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE\s*$/) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1105 |
$qt_end_namespace_found = 1; |
0 | 1106 |
} elsif ($header_skip_qt_module_test == 0 and $line =~ /^QT_MODULE\(.*\)\s*$/) { |
1107 |
$qt_module_found = 1; |
|
1108 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1109 |
} |
0 | 1110 |
if ($header_skip_qt_begin_header_test == 0) { |
1111 |
if ($qt_begin_header_found == 0) { |
|
1112 |
print "WARNING: $iheader does not include QT_BEGIN_HEADER\n"; |
|
1113 |
} |
|
1114 |
||
1115 |
if ($qt_begin_header_found && $qt_end_header_found == 0) { |
|
1116 |
print "WARNING: $iheader has QT_BEGIN_HEADER but no QT_END_HEADER\n"; |
|
1117 |
} |
|
1118 |
} |
|
1119 |
||
1120 |
if ($header_skip_qt_begin_namespace_test == 0) { |
|
1121 |
if ($qt_begin_namespace_found == 0) { |
|
1122 |
print "WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; |
|
1123 |
} |
|
1124 |
||
1125 |
if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) { |
|
1126 |
print "WARNING: $iheader has QT_BEGIN_NAMESPACE but no QT_END_NAMESPACE\n"; |
|
1127 |
} |
|
1128 |
} |
|
1129 |
||
1130 |
if ($header_skip_qt_module_test == 0) { |
|
1131 |
if ($qt_module_found == 0) { |
|
1132 |
print "WARNING: $iheader does not include QT_MODULE\n"; |
|
1133 |
} |
|
1134 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1135 |
close(F); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1136 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1137 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1138 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1139 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1140 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1141 |
} |
0 | 1142 |
} |
1143 |
} |
|
1144 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
1145 |
exit 0; |