From e79e1c1a166b8841724b6cd33b27b37a5ef6f4a0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Mar 2013 16:51:32 +0100 Subject: 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 Reviewed-by: Jocelyn Turcotte Reviewed-by: Joerg Bornemann --- bin/syncqt | 39 ++++++++++++---------------------- configure | 2 +- mkspecs/features/qt_module_headers.prf | 2 +- src/angle/angle.pro | 2 +- src/tools/bootstrap/bootstrap.pro | 2 +- tools/configure/configureapp.cpp | 2 +- 6 files changed, 18 insertions(+), 31 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index 3e7aea96a5..acfc6c4d57 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -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 Specify output directory for sync (default: $out_basedir)\n"; - print " -mkspecsdir Set the path to the mkspecs (detected: " . (defined $mkspecsdir ? $mkspecsdir : "-none-") . ")\n"; + print " -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 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 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}); diff --git a/configure b/configure index 7bb32db7ba..1d5c406e67 100755 --- a/configure +++ b/configure @@ -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 diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 10d3fe3c0b..40d6bb0d40 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -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") } diff --git a/src/angle/angle.pro b/src/angle/angle.pro index 00e0501d60..b4dbf8cf21 100644 --- a/src/angle/angle.pro +++ b/src/angle/angle.pro @@ -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") } diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 0d4b62fd16..1ec54deeb5 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -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") diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 58ec3bf001..d27a633c72 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -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(); } } -- cgit v1.2.3