pass module version to syncqt

this is cleaner than having it parse qmake project files.
the only remaining built-in version extraction is the fallback to
qglobal.h needed for bootstrapping.

as a "side effect", this fixes the build of modules with mismatched
versions centralized in .qmake.conf, as this was simply not handled so
far.

the -mkspecsdir syncqt option goes away, as there is no use case for it
any more.

Task-number: QTBUG-29838
Change-Id: I6912a38f0e93a26bc267a9e3d738506fd3ad431b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-03-20 16:51:32 +01:00 committed by The Qt Project
parent 678320788e
commit e79e1c1a16
6 changed files with 18 additions and 31 deletions

View File

@ -83,9 +83,6 @@ our $quoted_basedir;
# Make sure we use Windows line endings for chomp and friends on Windows.
$INPUT_RECORD_SEPARATOR = "\r\n" if ($^O eq "msys");
my $mkspecsdir = dirname(dirname($0));
normalizePath(\$mkspecsdir) if (defined $mkspecsdir);
# will be defined based on the modules sync.profile
our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %explicitheaders, %deprecatedheaders);
our @qpa_headers = ();
@ -103,6 +100,7 @@ my $copy_headers = 0;
my $create_uic_class_map = 0;
my $create_private_headers = 1;
my $minimal = 0;
my $module_version = 0;
my @modules_to_sync ;
$force_relative = 1 if ( -d "/System/Library/Frameworks" );
@ -128,7 +126,7 @@ sub showUsage
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n";
print " -minimal Do not create CamelCase headers (default: " . ($minimal ? "yes" : "no") . ")\n";
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
print " -mkspecsdir <PATH> Set the path to the mkspecs (detected: " . (defined $mkspecsdir ? $mkspecsdir : "-none-") . ")\n";
print " -version <VERSION> Specify the module's version (default: detect from qglobal.h)\n";
print " -quiet Only report problems, not activity (same as -verbose 0)\n";
print " -v, -verbose <level> Sets the verbosity level (max. 4) (default: $verbose_level)\n";
print " The short form increases the level by +1\n";
@ -662,8 +660,8 @@ while ( @ARGV ) {
} elsif($arg eq "-private") {
$var = "create_private_headers";
$val = "yes";
} elsif($arg eq "-mkspecsdir") {
$var = "mkspecsdir";
} elsif($arg eq "-version") {
$var = "version";
$val = shift @ARGV;
} elsif($arg =~/^-/) {
print "Unknown option: $arg\n\n" if(!$var);
@ -739,12 +737,11 @@ while ( @ARGV ) {
push @modules_to_sync, $module;
$moduleheaders{$module} = $headerdir;
$create_uic_class_map = 0;
} elsif ($var eq "mkspecsdir") {
} elsif ($var eq "version") {
if($val) {
$mkspecsdir = $val;
normalizePath(\$mkspecsdir);
$module_version = $val;
} else {
die "The -mkspecsdir option requires an argument";
die "The -version option requires an argument";
}
} elsif ($var eq "output") {
my $outdir = $val;
@ -759,11 +756,6 @@ while ( @ARGV ) {
}
}
die "Cannot automatically detect/use provided path to QtBase's build directory!\n" .
"QTDIR detected/provided: " . (defined $mkspecsdir ? $mkspecsdir : "-none-") . "\n" .
"Please use the -mkspecsdir option to provide the correct path.\nsyncqt failed"
if (!$mkspecsdir || !-d $mkspecsdir);
# 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 <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
@ -785,12 +777,12 @@ my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
$isunix = checkUnix; #cache checkUnix
my $qt_version = fileContents($mkspecsdir."/qconfig.pri");
if (length($qt_version)) {
$qt_version =~ s,.*^QT_VERSION[ \t]*=[ \t]*(\S+).*,$1,sm;
} else {
$qt_version = fileContents($basedir."/src/corelib/global/qglobal.h");
$qt_version =~ s,.*^#[ \t]*define[ \t]+QT_VERSION_STR[ \t]+"([^"]+)".*,$1,sm;
if (!$module_version) {
my $filco = fileContents($basedir."/src/corelib/global/qglobal.h");
if ($filco !~ m,.*^#[ \t]*define[ \t]+QT_VERSION_STR[ \t]+"([^"]+)".*,sm) {
die "Cannot determine Qt/Module version. Use -version.\n";
}
$module_version = $1;
}
foreach my $lib (@modules_to_sync) {
die "No such module: $lib" unless(defined $modules{$lib});
@ -799,11 +791,6 @@ foreach my $lib (@modules_to_sync) {
my @dirs = split(/;/, $modules{$lib});
my $dir = $dirs[0];
my $project = $dir;
$project =~ s,/([^/]+)$,/$1/$1.pro,;
my $module_version = fileContents($project);
$module_version = $qt_version unless ($module_version =~ s,.*^VERSION[ \t]*=[ \t]*(\S+).*,$1,sm);
my $pathtoheaders = "";
$pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib});

2
configure vendored
View File

@ -2239,7 +2239,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then
if [ -x "$relpath/bin/syncqt" ]; then
mkdir -p "$outpath/bin"
echo "#!/bin/sh" >"$outpath/bin/syncqt"
echo "perl \"$relpath/bin/syncqt\" -mkspecsdir \"$outpath/mkspecs\" \"\$@\"" >>"$outpath/bin/syncqt"
echo "perl \"$relpath/bin/syncqt\" \"\$@\"" >>"$outpath/bin/syncqt"
chmod 755 "$outpath/bin/syncqt"
fi

View File

@ -15,7 +15,7 @@ load(qt_build_paths)
qtPrepareTool(QMAKE_SYNCQT, syncqt)
contains(QT_CONFIG, private_tests): \ # -developer-build
QMAKE_SYNCQT += -check-includes
QMAKE_SYNCQT += -module $$MODULE_INCNAME -mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$MODULE_BASE_OUTDIR $$MODULE_BASE_DIR
QMAKE_SYNCQT += -module $$MODULE_INCNAME -version $$VERSION -outdir $$MODULE_BASE_OUTDIR $$MODULE_BASE_DIR
!silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
}

View File

@ -13,7 +13,7 @@ SUBDIRS += src
else: \
mod_component_base = $$dirname(_QMAKE_CACHE_)
QMAKE_SYNCQT += -minimal -module KHR -module EGL -module GLES2 \
-mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$mod_component_base $$dirname(_QMAKE_CONF_)
-version none -outdir $$mod_component_base $$dirname(_QMAKE_CONF_)
!silent:message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
}

View File

@ -139,7 +139,7 @@ INSTALLS += lib
else: \
mod_component_base = $$dirname(_QMAKE_CACHE_)
QMAKE_SYNCQT += -minimal -module QtCore -module QtDBus -module QtXml \
-mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$mod_component_base $$dirname(_QMAKE_CONF_)
-version $$VERSION -outdir $$mod_component_base $$dirname(_QMAKE_CONF_)
contains(QT_CONFIG, zlib):QMAKE_SYNCQT += -module QtZlib
!silent:message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")

View File

@ -171,7 +171,7 @@ Configure::Configure(int& argc, char** argv)
QTextStream stream(&syncqt_bat);
stream << "@echo off" << endl
<< "call " << QDir::toNativeSeparators(sourcePath + "/bin/syncqt.bat")
<< " -mkspecsdir \"" << QDir::toNativeSeparators(buildPath) << "/mkspecs\" %*" << endl;
<< " %*" << endl;
syncqt_bat.close();
}
}