Teach syncqt to handle multiple %moduleheaders directories
Each directory is separated by a ';'. The syntax was chosen over the regular perl [] syntax as ';' was used already in other places. Change-Id: I7a07a1facb7c08d7a9de6ec45ad57f6057cb0150 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
9f1aa866bd
commit
17eef6a4c4
289
bin/syncqt
289
bin/syncqt
@ -961,164 +961,171 @@ foreach my $lib (@modules_to_sync) {
|
||||
|
||||
#create the new ones
|
||||
foreach my $current_dir (split(/;/, $dir)) {
|
||||
my $headers_dir = $current_dir;
|
||||
$headers_dir .= "/$pathtoheaders" if ($pathtoheaders);
|
||||
#calc subdirs
|
||||
my @subdirs = ($headers_dir);
|
||||
foreach my $subdir (@subdirs) {
|
||||
opendir DIR, $subdir or next;
|
||||
foreach my $t (sort readdir(DIR)) {
|
||||
push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") &&
|
||||
!($t eq "..") && !($t eq ".obj") &&
|
||||
!($t eq ".moc") && !($t eq ".rcc") &&
|
||||
!($t eq ".uic") && !($t eq "build"));
|
||||
}
|
||||
closedir DIR;
|
||||
my @headers_paths = split(/;/, $pathtoheaders);
|
||||
if (@headers_paths) {
|
||||
@headers_paths = map { "$current_dir/$_" } @headers_paths;
|
||||
} else {
|
||||
push @headers_paths, $current_dir;
|
||||
}
|
||||
|
||||
#calc files and "copy" them
|
||||
foreach my $subdir (@subdirs) {
|
||||
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
|
||||
if (defined $inject_headers{$subdir}) {
|
||||
foreach my $if ($inject_headers{$subdir}) {
|
||||
@headers = grep(!/^\Q$if\E$/, @headers); #in case we configure'd previously
|
||||
push @headers, "*".$if;
|
||||
foreach my $headers_dir (@headers_paths) {
|
||||
#calc subdirs
|
||||
my @subdirs = ($headers_dir);
|
||||
foreach my $subdir (@subdirs) {
|
||||
opendir DIR, $subdir or next;
|
||||
foreach my $t (sort readdir(DIR)) {
|
||||
push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") &&
|
||||
!($t eq "..") && !($t eq ".obj") &&
|
||||
!($t eq ".moc") && !($t eq ".rcc") &&
|
||||
!($t eq ".uic") && !($t eq "build"));
|
||||
}
|
||||
closedir DIR;
|
||||
}
|
||||
my $header_dirname = "";
|
||||
foreach my $header (@headers) {
|
||||
my $shadow = ($header =~ s/^\*//);
|
||||
$header = 0 if($header =~ /^ui_.*.h/);
|
||||
foreach (@ignore_headers) {
|
||||
$header = 0 if($header eq $_);
|
||||
}
|
||||
if($header) {
|
||||
my $header_copies = 0;
|
||||
#figure out if it is a public header
|
||||
my $public_header = $header;
|
||||
if($allheadersprivate || $public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
|
||||
$public_header = 0;
|
||||
} else {
|
||||
foreach (@ignore_for_master_contents) {
|
||||
$public_header = 0 if($header eq $_);
|
||||
}
|
||||
|
||||
#calc files and "copy" them
|
||||
foreach my $subdir (@subdirs) {
|
||||
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
|
||||
if (defined $inject_headers{$subdir}) {
|
||||
foreach my $if ($inject_headers{$subdir}) {
|
||||
@headers = grep(!/^\Q$if\E$/, @headers); #in case we configure'd previously
|
||||
push @headers, "*".$if;
|
||||
}
|
||||
|
||||
my $iheader = $subdir . "/" . $header;
|
||||
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
||||
my @classes = $public_header ? classNames($iheader) : ();
|
||||
if($showonly) {
|
||||
print "$header [$lib]\n";
|
||||
foreach(@classes) {
|
||||
print "SYMBOL: $_\n";
|
||||
}
|
||||
my $header_dirname = "";
|
||||
foreach my $header (@headers) {
|
||||
my $shadow = ($header =~ s/^\*//);
|
||||
$header = 0 if($header =~ /^ui_.*.h/);
|
||||
foreach (@ignore_headers) {
|
||||
$header = 0 if($header eq $_);
|
||||
}
|
||||
if($header) {
|
||||
my $header_copies = 0;
|
||||
#figure out if it is a public header
|
||||
my $public_header = $header;
|
||||
if($allheadersprivate || $public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
|
||||
$public_header = 0;
|
||||
} else {
|
||||
foreach (@ignore_for_master_contents) {
|
||||
$public_header = 0 if($header eq $_);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $ts = (stat($iheader))[9];
|
||||
#find out all the places it goes..
|
||||
my @headers;
|
||||
if ($public_header) {
|
||||
@headers = ( "$out_basedir/include/$lib/$header" );
|
||||
|
||||
# write forwarding headers to include/Qt
|
||||
if ($lib ne "phonon" && $subdir =~ /^$quoted_basedir\/src/) {
|
||||
my $file_name = "$out_basedir/include/Qt/$header";
|
||||
my $file_op = '>';
|
||||
my $header_content = '';
|
||||
if (exists $colliding_headers{$file_name}) {
|
||||
$file_op = '>>';
|
||||
} else {
|
||||
$colliding_headers{$file_name} = 1;
|
||||
my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.';
|
||||
$header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" .
|
||||
" #if defined(__GNUC__)\n" .
|
||||
" #warning \"$warning_msg\"\n" .
|
||||
" #elif defined(_MSC_VER)\n" .
|
||||
" #pragma message(\"WARNING: $warning_msg\")\n" .
|
||||
" #endif\n".
|
||||
"#endif\n\n";
|
||||
my $iheader = $subdir . "/" . $header;
|
||||
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
||||
my @classes = $public_header ? classNames($iheader) : ();
|
||||
if($showonly) {
|
||||
print "$header [$lib]\n";
|
||||
foreach(@classes) {
|
||||
print "SYMBOL: $_\n";
|
||||
}
|
||||
} else {
|
||||
my $ts = (stat($iheader))[9];
|
||||
#find out all the places it goes..
|
||||
my @headers;
|
||||
if ($public_header) {
|
||||
@headers = ( "$out_basedir/include/$lib/$header" );
|
||||
|
||||
# write forwarding headers to include/Qt
|
||||
if ($lib ne "phonon" && $subdir =~ /^$quoted_basedir\/src/) {
|
||||
my $file_name = "$out_basedir/include/Qt/$header";
|
||||
my $file_op = '>';
|
||||
my $header_content = '';
|
||||
if (exists $colliding_headers{$file_name}) {
|
||||
$file_op = '>>';
|
||||
} else {
|
||||
$colliding_headers{$file_name} = 1;
|
||||
my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.';
|
||||
$header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" .
|
||||
" #if defined(__GNUC__)\n" .
|
||||
" #warning \"$warning_msg\"\n" .
|
||||
" #elif defined(_MSC_VER)\n" .
|
||||
" #pragma message(\"WARNING: $warning_msg\")\n" .
|
||||
" #endif\n".
|
||||
"#endif\n\n";
|
||||
}
|
||||
$header_content .= '#include "' . "../$lib/$header" . "\"\n";
|
||||
open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n";
|
||||
print HEADERFILE $header_content;
|
||||
close HEADERFILE;
|
||||
}
|
||||
$header_content .= '#include "' . "../$lib/$header" . "\"\n";
|
||||
open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n";
|
||||
print HEADERFILE $header_content;
|
||||
close HEADERFILE;
|
||||
}
|
||||
|
||||
foreach my $full_class (@classes) {
|
||||
my $header_base = basename($header);
|
||||
# Strip namespaces:
|
||||
my $class = $full_class;
|
||||
$class =~ s/^.*:://;
|
||||
# if ($class =~ m/::/) {
|
||||
# class =~ s,::,/,g;
|
||||
# }
|
||||
$class_lib_map_contents .= "QT_CLASS_LIB($full_class, $lib, $header_base)\n";
|
||||
$header_copies++ if(syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
|
||||
# KDE-Compat headers for Phonon
|
||||
if ($lib eq "phonon") {
|
||||
$header_copies++ if (syncHeader($lib, "$out_basedir/include/phonon_compat/Phonon/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
}
|
||||
}
|
||||
} elsif ($create_private_headers) {
|
||||
if ($module_version) {
|
||||
@headers = ( "$out_basedir/include/$lib/$module_version/$lib/private/$header" );
|
||||
} else {
|
||||
@headers = ( "$out_basedir/include/$lib/private/$header" );
|
||||
}
|
||||
}
|
||||
foreach(@headers) { #sync them
|
||||
$header_copies++ if(syncHeader($lib, $_, $iheader, $copy_headers && !$shadow, $ts));
|
||||
}
|
||||
|
||||
if($public_header) {
|
||||
#put it into the master file
|
||||
$master_contents .= "#include \"$public_header\"\n" if(shouldMasterInclude($iheader));
|
||||
|
||||
#deal with the install directives
|
||||
if($public_header) {
|
||||
my $pri_install_iheader = fixPaths($iheader, $current_dir);
|
||||
foreach my $class (@classes) {
|
||||
foreach my $full_class (@classes) {
|
||||
my $header_base = basename($header);
|
||||
# Strip namespaces:
|
||||
my $class = $full_class;
|
||||
$class =~ s/^.*:://;
|
||||
# if ($class =~ m/::/) {
|
||||
# $class =~ s,::,/,g;
|
||||
# }
|
||||
my $class_header = fixPaths("$out_basedir/include/$lib/$class",
|
||||
$current_dir) . " ";
|
||||
$pri_install_classes .= $class_header
|
||||
unless($pri_install_classes =~ $class_header);
|
||||
}
|
||||
$pri_install_files.= "$pri_install_iheader ";;
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $pri_install_iheader = fixPaths($iheader, $current_dir);
|
||||
$pri_install_pfiles.= "$pri_install_iheader ";;
|
||||
}
|
||||
}
|
||||
# if ($class =~ m/::/) {
|
||||
# class =~ s,::,/,g;
|
||||
# }
|
||||
$class_lib_map_contents .= "QT_CLASS_LIB($full_class, $lib, $header_base)\n";
|
||||
$header_copies++ if(syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
|
||||
if ($verbose_level && $header_copies) {
|
||||
my $new_header_dirname = dirname($iheader);
|
||||
$new_header_dirname = "<srcbase>" . substr($new_header_dirname, length($basedir)) if ($new_header_dirname && $verbose_level < 2);
|
||||
my $header_base = basename($iheader);
|
||||
if ($verbose_level < 3) {
|
||||
my $line_prefix = ",";
|
||||
if ($new_header_dirname ne $header_dirname) {
|
||||
$line_prefix = "$lib: created fwd-include header(s) for $new_header_dirname/ {";
|
||||
$line_prefix = " }\n".$line_prefix if ($header_dirname);
|
||||
$header_dirname = $new_header_dirname;
|
||||
} else {
|
||||
$line_prefix = ",";
|
||||
# KDE-Compat headers for Phonon
|
||||
if ($lib eq "phonon") {
|
||||
$header_copies++ if (syncHeader($lib, "$out_basedir/include/phonon_compat/Phonon/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
}
|
||||
}
|
||||
} elsif ($create_private_headers) {
|
||||
if ($module_version) {
|
||||
@headers = ( "$out_basedir/include/$lib/$module_version/$lib/private/$header" );
|
||||
} else {
|
||||
@headers = ( "$out_basedir/include/$lib/private/$header" );
|
||||
}
|
||||
}
|
||||
foreach(@headers) { #sync them
|
||||
$header_copies++ if(syncHeader($lib, $_, $iheader, $copy_headers && !$shadow, $ts));
|
||||
}
|
||||
|
||||
if($public_header) {
|
||||
#put it into the master file
|
||||
$master_contents .= "#include \"$public_header\"\n" if(shouldMasterInclude($iheader));
|
||||
|
||||
#deal with the install directives
|
||||
if($public_header) {
|
||||
my $pri_install_iheader = fixPaths($iheader, $current_dir);
|
||||
foreach my $class (@classes) {
|
||||
# Strip namespaces:
|
||||
$class =~ s/^.*:://;
|
||||
# if ($class =~ m/::/) {
|
||||
# $class =~ s,::,/,g;
|
||||
# }
|
||||
my $class_header = fixPaths("$out_basedir/include/$lib/$class",
|
||||
$current_dir) . " ";
|
||||
$pri_install_classes .= $class_header
|
||||
unless($pri_install_classes =~ $class_header);
|
||||
}
|
||||
$pri_install_files.= "$pri_install_iheader ";;
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $pri_install_iheader = fixPaths($iheader, $current_dir);
|
||||
$pri_install_pfiles.= "$pri_install_iheader ";;
|
||||
}
|
||||
}
|
||||
|
||||
if ($verbose_level && $header_copies) {
|
||||
my $new_header_dirname = dirname($iheader);
|
||||
$new_header_dirname = "<srcbase>" . substr($new_header_dirname, length($basedir)) if ($new_header_dirname && $verbose_level < 2);
|
||||
my $header_base = basename($iheader);
|
||||
if ($verbose_level < 3) {
|
||||
my $line_prefix = ",";
|
||||
if ($new_header_dirname ne $header_dirname) {
|
||||
$line_prefix = "$lib: created fwd-include header(s) for $new_header_dirname/ {";
|
||||
$line_prefix = " }\n".$line_prefix if ($header_dirname);
|
||||
$header_dirname = $new_header_dirname;
|
||||
} else {
|
||||
$line_prefix = ",";
|
||||
}
|
||||
print "$line_prefix $header_base ($header_copies)";
|
||||
} else { # $verbose_level >= 3
|
||||
$iheader = "<srcbase>" . substr($iheader, length($basedir)) if ($verbose_level == 3);
|
||||
print "$lib: created $header_copies fwd-include headers for $iheader\n";
|
||||
}
|
||||
print "$line_prefix $header_base ($header_copies)";
|
||||
} else { # $verbose_level >= 3
|
||||
$iheader = "<srcbase>" . substr($iheader, length($basedir)) if ($verbose_level == 3);
|
||||
print "$lib: created $header_copies fwd-include headers for $iheader\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
print " }\n" if ($header_dirname && $verbose_level > 0 && $verbose_level < 3);
|
||||
}
|
||||
print " }\n" if ($header_dirname && $verbose_level > 0 && $verbose_level < 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user