From 00c5f39081fb8de9e0b77de4e21ba0862d4bf695 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 24 Nov 2010 20:21:06 -0600 Subject: Add module specific pris, and make syncqt create fwd includes The module specific pris define the modules name version dependencies include paths lib paths additional CONFIGs and DEFINES They are located in the modules source directory, with fwd includes created in QtBase/mkspecs/modules build directory. The pris use QT_MODULE_INCLUDE_BASE QT_MODULE_LIB_BASE to specify the locations for includes and libs. These paths are normally based on QT_INSTALL_HEADERS QT_INSTALL_LIBS for installed modules, but overridden to the module's build directory by syncqt for the fwd included pris. The path of the pris must be specified in the sync.profile for syncqt to create the fwding pris in QtBase. --- bin/syncqt | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/syncqt b/bin/syncqt index e3d941b109..ac540ea505 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -23,8 +23,16 @@ our $basedir; our $quoted_basedir; +# try to figure out where QtBase is located +# normally the script location should be enough, if not fall back to +# QTDIR environment variable. If that doesn't work, later ask the +# user to use the -qtdir option explicitly. +my $qtbasedir = dirname(dirname($0)); +$qtbasedir = $ENV{"QTDIR"} if ($qtbasedir !~ /qtbase/); +$qtbasedir =~ s=\\=/=g if (defined $qtbasedir); + # will be defined based on the modules sync.profile -our (%modules, %moduleheaders, %classnames, %mastercontent); +our (%modules, %moduleheaders, %classnames, %mastercontent, %modulepris); # global variables (modified by options) my $isunix = 0; @@ -38,6 +46,7 @@ my $check_includes = 0; my $copy_headers = 0; my $create_uic_class_map = 1; my $create_private_headers = 1; +my $no_module_fwd = 0; my @modules_to_sync ; $force_relative = 1 if ( -d "/System/Library/Frameworks" ); @@ -62,9 +71,12 @@ sub showUsage 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 Specify output directory for sync (default: $out_basedir)\n"; + print " -qtdir Set the path to QtBase (detected: " . (defined $qtbasedir ? $qtbasedir : "-none-") . ")\n"; print " -quiet Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n"; - print " -separate-module :: Create headers for with original headers in relative to \n"; + print " -separate-module ::\n"; + print " Create headers for with original headers in relative to \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 " -help This help\n"; exit 0; } @@ -558,7 +570,7 @@ while ( @ARGV ) { #parse my $arg = shift @ARGV; - if ($arg eq "-h" || $arg eq "-help" || $arg eq "?") { + if ($arg eq "-h" || $arg eq "-help" || $arg eq "-?" || $arg eq "?") { $var = "show_help"; $val = "yes"; } elsif($arg eq "-copy") { @@ -593,10 +605,16 @@ while ( @ARGV ) { } elsif($arg eq "-private") { $var = "create_private_headers"; $val = "yes"; + } elsif($arg eq "-qtdir") { + $var = "qtdir"; + $val = shift @ARGV; } elsif($arg eq "-base-dir") { # skip, it's been dealt with at the top of the file shift @ARGV; next; + } elsif($arg eq "-no-module-fwd") { + $var = "no_module_fwd"; + $val = "yes"; } elsif($arg =~/^-/) { print "Unknown option: $arg\n\n" if(!$var); showUsage(); @@ -664,6 +682,15 @@ while ( @ARGV ) { push @modules_to_sync, $module; $moduleheaders{$module} = $headerdir; $create_uic_class_map = 0; + } elsif ($var eq "qtdir") { + if($val) { + $qtbasedir = $val; + $qtbasedir =~ s=\\=/=g; + } else { + die "The -qtdir option requires an argument"; + } + } elsif ($var eq "no_module_fwd") { + $no_module_fwd = 1; } elsif ($var eq "output") { my $outdir = $val; if(checkRelative($outdir)) { @@ -678,6 +705,15 @@ while ( @ARGV ) { } } +# if the $qtbasedir neither has 'qtbase' somewhere in its path, nor a +# '.qmake.cache' file in its directory, we assume it's not a valid path +# (remember that a yet-to-be-built qtbase doesn't have this file either, +# thus the 'qtbase' path check!) +die "Cannot automatically detect/use provided path to QtBase's build directory!\n" . + "QTDIR detected/provided: " . (defined $qtbasedir ? $qtbasedir : "-none-") . "\n" . + "Please -qtdir option to provide the correct path.\nsyncqt failed" + if (!defined $qtbasedir || (!-e "$qtbasedir/.qmake.cache" && $qtbasedir !~ /qtbase/)); + # if we have no $basedir we cannot be sure which sources you want, so die die "Could not find any sync.profile for your module!\nPass to syncqt to sync your header files.\nsyncqt failed" if (!$basedir); @@ -962,6 +998,23 @@ foreach my $lib (@modules_to_sync) { print HEADERS_PRI_FILE $headers_pri_contents; close HEADERS_PRI_FILE; } + + # create forwarding module pri in qtbase/mkspecs/modules + unless ($no_module_fwd) { + my $modulepri = $modulepris{$lib}; + if (-e $modulepri) { + my $modulepriname = basename($modulepri); + my $moduleprifwd = "$qtbasedir/mkspecs/modules/$modulepriname"; + open MODULE_PRI_FILE, ">$moduleprifwd"; + print MODULE_PRI_FILE "QT_MODULE_INCLUDE_BASE = $out_basedir/include\n"; + print MODULE_PRI_FILE "QT_MODULE_LIB_BASE = $out_basedir/lib\n"; + print MODULE_PRI_FILE "include($modulepri)\n"; + close MODULE_PRI_FILE; + utime(time, (stat($modulepri))[9], $moduleprifwd); + } elsif ($modulepri) { + print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating forwarding pri for $lib.\n"; + } + } } } unless($showonly || !$create_uic_class_map) { -- cgit v1.2.3