diff options
Diffstat (limited to 'bin/syncqt')
-rwxr-xr-x | bin/syncqt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/syncqt b/bin/syncqt index 3d25ecc817..2ac67fe51d 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -47,6 +47,7 @@ my $copy_headers = 0; my $create_uic_class_map = 0; my $create_private_headers = 1; my $no_module_fwd = 0; +my $no_module_version_header = 0; my @modules_to_sync ; $force_relative = 1 if ( -d "/System/Library/Frameworks" ); @@ -77,6 +78,8 @@ sub showUsage print " Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n"; print " -private Force copy private headers (default: " . ($create_private_headers ? "yes" : "no") . ")\n"; print " -no-module-fwd Don't create fwd includes for module pri files\n"; + print " -no-module-version-header\n"; + print " Don't create module version header file\n"; print " -help This help\n"; exit 0; } @@ -619,6 +622,9 @@ while ( @ARGV ) { } elsif($arg eq "-no-module-fwd") { $var = "no_module_fwd"; $val = "yes"; + } elsif($arg eq "-no-module-version-header") { + $var = "no_module_version_header"; + $val = "yes"; } elsif($arg =~/^-/) { print "Unknown option: $arg\n\n" if(!$var); showUsage(); @@ -696,6 +702,8 @@ while ( @ARGV ) { } } elsif ($var eq "no_module_fwd") { $no_module_fwd = 1; + } elsif ($var eq "no_module_version_header") { + $no_module_version_header = 1; } elsif ($var eq "output") { my $outdir = $val; if(checkRelative($outdir)) { @@ -748,6 +756,9 @@ foreach my $lib (@modules_to_sync) { #iteration info my $dir = $modules{$lib}; my $module_version = ""; + my $module_major_version = ""; + my $module_minor_version = ""; + my $module_patch_version = ""; if (-e "$modulepris{$lib}") { my $content = fileContents($modulepris{$lib}); @@ -758,6 +769,13 @@ foreach my $lib (@modules_to_sync) { chomp $module_version; $module_version =~ s/^\s*QT\..*\.VERSION\s*=\s*([^#]+).*$/$1/; $module_version =~ s/\s+$//; + my @versions = split(/\./, $module_version); + $module_major_version = $versions[0]; + chomp $module_major_version; + $module_minor_version = $versions[1]; + chomp $module_minor_version; + $module_patch_version = $versions[2]; + chomp $module_patch_version; } } print "WARNING: Module $lib\'s pri missing QT.<module>.VERSION variable! Private headers not versioned!\n" if (!$module_version); @@ -1045,6 +1063,28 @@ foreach my $lib (@modules_to_sync) { print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating forwarding pri for $lib.\n"; } } + + # create the version header files for each module + unless ($no_module_version_header) { + my $modulepri = $modulepris{$lib}; + if (-e $modulepri) { + my $modulepriname = basename($modulepri); + my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h"; + my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version)); + open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader"; + print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n"; + print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n"; + print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n"; + print MODULE_VERSION_HEADER_FILE "\n"; + print MODULE_VERSION_HEADER_FILE "#define " .uc($lib) . "_VERSION_STR \"" . $module_version . "\"\n"; + print MODULE_VERSION_HEADER_FILE "\n"; + print MODULE_VERSION_HEADER_FILE "#define " .uc($lib) . "_VERSION $modulehexstring\n", ; + print MODULE_VERSION_HEADER_FILE "\n"; + print MODULE_VERSION_HEADER_FILE "#endif // QT_". uc($lib) . "_VERSION_H\n"; + } elsif ($modulepri) { + print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating module version header for $lib.\n"; + } + } } } unless($showonly || !$create_uic_class_map) { |