bin/syncqt
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 8 3f74d0d4af4c
--- a/bin/syncqt	Tue Feb 02 00:43:10 2010 +0200
+++ b/bin/syncqt	Fri Feb 19 23:40:16 2010 +0200
@@ -3,7 +3,7 @@
 #
 # Synchronizes Qt header files - internal development tool.
 #
-# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 # Contact: Nokia Corporation (qt-info@nokia.com)
 #
 ######################################################################
@@ -15,6 +15,13 @@
 use Config;
 use strict;
 
+for (my $i = 0; $i < $#ARGV; $i++) {
+    if ($ARGV[$i] eq "-base-dir" && $i < $#ARGV - 1) {
+        $ENV{"QTDIR"} = $ARGV[$i + 1];
+        last;
+    }
+}
+
 die "syncqt: QTDIR not defined" if ! $ENV{"QTDIR"}; # sanity check
 
 # global variables
@@ -61,6 +68,8 @@
 my $force_relative = 0;
 my $check_includes = 0;
 my $copy_headers = 0;
+my $create_uic_class_map = 1;
+my $create_private_headers = 1;
 my @modules_to_sync ;
 $force_relative = 1 if ( -d "/System/Library/Frameworks" );
 my $out_basedir = $basedir;
@@ -84,6 +93,7 @@
     print "  -windows              Force platform to Windows          (default: " . ($force_win ? "yes" : "no") . ")\n";
     print "  -showonly             Show action but not perform        (default: " . ($showonly ? "yes" : "no") . ")\n";
     print "  -outdir <PATH>        Specify output directory for sync  (default: $out_basedir)\n";
+    print "  -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR> Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
     print "  -help                 This help\n";
     exit 0;
 }
@@ -576,9 +586,16 @@
     } elsif("$arg" eq "-module") {
 	$var = "module";
 	$val = shift @ARGV;
+    } elsif("$arg" eq "-separate-module") {
+	$var = "separate-module";
+	$val = shift @ARGV;
     } elsif("$arg" eq "-show") {
 	$var = "showonly";
 	$val = "yes";
+    } elsif("$arg" eq "-base-dir") {
+        # skip, it's been dealt with at the top of the file
+        shift @ARGV;
+        next;
     } elsif("$arg" eq '*') {
         # workaround for windows 9x where "%*" expands to "*"
         $var = 1;
@@ -628,6 +645,13 @@
 	print "module :$val:\n";
 	die "No such module: $val" unless(defined $modules{$val});
 	push @modules_to_sync, $val;
+    } elsif ("$var" eq "separate-module") {
+        my ($module, $prodir, $headerdir) = split(/:/, $val);
+        $modules{$module} = $prodir;
+        push @modules_to_sync, $module;
+        $moduleheaders{$module} = $headerdir;
+        $create_uic_class_map = 0;
+        $create_private_headers = 0;
     } elsif ("$var" eq "output") {
 	my $outdir = $val;
 	if(checkRelative($outdir)) {
@@ -800,13 +824,20 @@
 			    foreach(@classes) {
 				my $header_base = basename($header);
 				my $class = $_;
-				if ($class =~ m/::/) {
-				    $class =~ s,::,/,g;
-				}
+				# Strip namespaces:
+				$class =~ s/^.*:://;
+#				if ($class =~ m/::/) {
+#				   class =~ s,::,/,g;
+#				}
 				$class_lib_map_contents .= "QT_CLASS_LIB($_, $lib, $header_base)\n";
 				$header_copies++ if(syncHeader("$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0));
+
+				# KDE-Compat headers for Phonon
+				if ($lib eq "phonon") {
+				    $header_copies++ if (syncHeader("$out_basedir/include/phonon_compat/Phonon/$class", "$out_basedir/include/$lib/$header", 0));
+				}
 			    }
-			} else {
+			} elsif ($create_private_headers) {
 			    @headers = ( "$out_basedir/include/$lib/private/$header" );
 			    push @headers, "$out_basedir/include/Qt/private/$header"
                               if ("$lib" ne "phonon");
@@ -824,9 +855,11 @@
 				my $pri_install_iheader = fixPaths($iheader, $current_dir);
 				foreach(@classes) {
 				    my $class = $_;
-				    if ($class =~ m/::/) {
-					$class =~ s,::,/,g;
-				    }
+				    # 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
@@ -851,12 +884,8 @@
 
     unless($showonly) {
         my @master_includes;
-        if ($lib eq "phonon") {
-            push @master_includes, "$out_basedir/include/phonon_compat/phonon/phonon";
-            push @master_includes, "$out_basedir/include/phonon/Phonon/Phonon";
-        } else {
-            push @master_includes, "$out_basedir/include/$lib/$lib";
-        }
+	push @master_includes, "$out_basedir/include/$lib/$lib";
+	push @master_includes, "$out_basedir/include/phonon_compat/Phonon/Phonon" if ($lib eq "phonon");
         foreach my $master_include (@master_includes) {
             #generate the "master" include file
             $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too
@@ -904,7 +933,7 @@
         }
     }
 }
-unless($showonly) {
+unless($showonly || !$create_uic_class_map) {
     my $class_lib_map = "$out_basedir/src/tools/uic/qclass_lib_map.h";
     if(-e "$class_lib_map") {
 	open CLASS_LIB_MAP, "<$class_lib_map";