summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure420
-rw-r--r--configure.json11
-rw-r--r--configure.pri231
-rw-r--r--mkspecs/features/qt_configure.prf2
-rw-r--r--qmake/Makefile.unix3
-rw-r--r--qmake/Makefile.win322
-rw-r--r--qmake/library/qmakebuiltins.cpp8
-rw-r--r--qmake/library/qmakeglobals.h1
-rw-r--r--qmake/option.cpp5
-rw-r--r--qmake/property.cpp6
-rw-r--r--qmake/property.h2
-rw-r--r--qmake/qmake-aux.pro20
-rw-r--r--src/corelib/global/qlibraryinfo.cpp116
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--tools/configure/configureapp.cpp405
-rw-r--r--tools/configure/configureapp.h8
-rw-r--r--tools/configure/main.cpp3
17 files changed, 397 insertions, 848 deletions
diff --git a/configure b/configure
index 09966e8e1b..78ff04a474 100755
--- a/configure
+++ b/configure
@@ -129,26 +129,6 @@ DEVICE_VARS_FILE=.device.vars
# utility functions
#-------------------------------------------------------------------------------
-makeabs()
-{
- local FILE="$1"
- local RES="$FILE"
- if [ -z "${FILE##/*}" ]; then
- true
- elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then
- true
- else
- RES=$PWD/$FILE
- fi
- RES=$RES/
- while true; do
- nres=`echo "$RES" | sed 's,/[^/][^/]*/\.\./,/,g; s,/\./,/,g'`
- test x"$nres" = x"$RES" && break
- RES=$nres
- done
- echo "$RES" | sed 's,//,/,g; s,/$,,'
-}
-
# Helper function for getQMakeConf. It parses include statements in
# qmake.conf and prints out the expanded file
expandQMakeConf()
@@ -443,29 +423,6 @@ CFG_SILENT=no
OPT_MAC_SDK=
CFG_DEV=no
-# initalize variables used for installation
-QT_INSTALL_PREFIX=
-QT_INSTALL_DOCS=
-QT_INSTALL_HEADERS=
-QT_INSTALL_LIBS=
-QT_INSTALL_BINS=
-QT_INSTALL_LIBEXECS=
-QT_INSTALL_PLUGINS=
-QT_INSTALL_IMPORTS=
-QT_INSTALL_QML=
-QT_INSTALL_ARCHDATA=
-QT_INSTALL_DATA=
-QT_INSTALL_TRANSLATIONS=
-QT_INSTALL_SETTINGS=
-QT_INSTALL_EXAMPLES=
-QT_INSTALL_TESTS=
-CFG_SYSROOT=
-QT_HOST_PREFIX=
-QT_HOST_BINS=
-QT_HOST_LIBS=
-QT_HOST_DATA=
-QT_EXT_PREFIX=
-
# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
@@ -590,72 +547,9 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=no
case "$VAR" in
- prefix)
- QT_INSTALL_PREFIX="$VAL"
- ;;
- hostprefix)
- QT_HOST_PREFIX="$VAL"
- ;;
- hostdatadir)
- QT_HOST_DATA="$VAL"
- ;;
- hostbindir)
- QT_HOST_BINS="$VAL"
- ;;
- hostlibdir)
- QT_HOST_LIBS="$VAL"
- ;;
- extprefix)
- QT_EXT_PREFIX="$VAL"
- ;;
- docdir)
- QT_INSTALL_DOCS="$VAL"
- ;;
- headerdir)
- QT_INSTALL_HEADERS="$VAL"
- ;;
- plugindir)
- QT_INSTALL_PLUGINS="$VAL"
- ;;
- importdir)
- QT_INSTALL_IMPORTS="$VAL"
- ;;
- qmldir)
- QT_INSTALL_QML="$VAL"
- ;;
- archdatadir)
- QT_INSTALL_ARCHDATA="$VAL"
- ;;
- datadir)
- QT_INSTALL_DATA="$VAL"
- ;;
- libdir)
- QT_INSTALL_LIBS="$VAL"
- ;;
- translationdir)
- QT_INSTALL_TRANSLATIONS="$VAL"
- ;;
- sysconfdir|settingsdir)
- QT_INSTALL_SETTINGS="$VAL"
- ;;
- examplesdir)
- QT_INSTALL_EXAMPLES="$VAL"
- ;;
- testsdir)
- QT_INSTALL_TESTS="$VAL"
- ;;
- sysroot)
- CFG_SYSROOT="$VAL"
- ;;
external-hostbindir)
CFG_HOST_QT_TOOLS_PATH="$VAL"
;;
- bindir)
- QT_INSTALL_BINS="$VAL"
- ;;
- libexecdir)
- QT_INSTALL_LIBEXECS="$VAL"
- ;;
sdk)
if [ "$BUILD_ON_MAC" = "yes" ]; then
DeviceVar set QMAKE_MAC_SDK "$VAL"
@@ -1090,274 +984,6 @@ if [ "$XPLATFORM_ANDROID" = "no" ]; then
fi
fi
-#-------------------------------------------------------------------------------
-# postprocess installation and deployment paths
-#-------------------------------------------------------------------------------
-
-if [ -z "$QT_INSTALL_PREFIX" ]; then
- if [ "$CFG_DEV" = "yes" ]; then
- QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
- else
- QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION
- fi
-fi
-QT_INSTALL_PREFIX=`makeabs "$QT_INSTALL_PREFIX"`
-
-if [ -z "$QT_EXT_PREFIX" ]; then
- QT_EXT_PREFIX=$QT_INSTALL_PREFIX
- if [ -n "$CFG_SYSROOT" ]; then
- QMAKE_SYSROOTIFY=true
- else
- QMAKE_SYSROOTIFY=false
- fi
-else
- QT_EXT_PREFIX=`makeabs "$QT_EXT_PREFIX"`
- QMAKE_SYSROOTIFY=false
-fi
-
-if [ -z "$QT_HOST_PREFIX" ]; then
- if $QMAKE_SYSROOTIFY; then
- QT_HOST_PREFIX=$CFG_SYSROOT$QT_EXT_PREFIX
- else
- QT_HOST_PREFIX=$QT_EXT_PREFIX
- fi
- HAVE_HOST_PATH=false
-else
- QT_HOST_PREFIX=`makeabs "$QT_HOST_PREFIX"`
- HAVE_HOST_PATH=true
-fi
-
-#------- make the paths relative to the prefixes --------
-
-PREFIX_COMPLAINTS=
-PREFIX_REMINDER=false
-while read basevar baseoption var option; do
- eval path=\$QT_${basevar}_$var
- [ -z "$path" ] && continue
- path=`makeabs "$path"`
- eval base=\$QT_${basevar}_PREFIX
- rel=${path##$base}
- if [ x"$rel" = x"$path" ]; then
- if [ x"$option" != x"sysconf" ]; then
- PREFIX_COMPLAINTS="$PREFIX_COMPLAINTS
- NOTICE: -${option}dir is not a subdirectory of ${baseoption}prefix."
- eval \$HAVE_${basevar}_PATH || PREFIX_REMINDER=true
- fi
- eval QT_REL_${basevar}_$var=\$rel
- elif [ -z "$rel" ]; then
- eval QT_REL_${basevar}_$var=.
- else
- eval QT_REL_${basevar}_$var=\${rel#/}
- fi
-done <<EOF
-INSTALL - DOCS doc
-INSTALL - HEADERS header
-INSTALL - LIBS lib
-INSTALL - LIBEXECS libexec
-INSTALL - BINS bin
-INSTALL - PLUGINS plugin
-INSTALL - IMPORTS import
-INSTALL - QML qml
-INSTALL - ARCHDATA archdata
-INSTALL - DATA data
-INSTALL - TRANSLATIONS translation
-INSTALL - EXAMPLES examples
-INSTALL - TESTS tests
-INSTALL - SETTINGS sysconf
-HOST -host BINS hostbin
-HOST -host LIBS hostlib
-HOST -host DATA hostdata
-EOF
-$PREFIX_REMINDER && PREFIX_COMPLAINTS="$PREFIX_COMPLAINTS
- Maybe you forgot to specify -prefix/-hostprefix?"
-
-if [ -z "$QT_REL_INSTALL_HEADERS" ]; then
- QT_REL_INSTALL_HEADERS=include
-fi
-
-if [ -z "$QT_REL_INSTALL_LIBS" ]; then
- QT_REL_INSTALL_LIBS=lib
-fi
-
-if [ -z "$QT_REL_INSTALL_BINS" ]; then
- QT_REL_INSTALL_BINS=bin
-fi
-
-if [ -z "$QT_REL_INSTALL_ARCHDATA" ]; then
- QT_REL_INSTALL_ARCHDATA=.
-fi
-if [ x"$QT_REL_INSTALL_ARCHDATA" != x. ]; then
- QT_REL_INSTALL_ARCHDATA_PREFIX=$QT_REL_INSTALL_ARCHDATA/
-fi
-
-if [ -z "$QT_REL_INSTALL_LIBEXECS" ]; then
- if [ "$XPLATFORM_MINGW" = "yes" ]; then
- QT_REL_INSTALL_LIBEXECS=${QT_REL_INSTALL_ARCHDATA_PREFIX}bin
- else
- QT_REL_INSTALL_LIBEXECS=${QT_REL_INSTALL_ARCHDATA_PREFIX}libexec
- fi
-fi
-
-if [ -z "$QT_REL_INSTALL_PLUGINS" ]; then
- QT_REL_INSTALL_PLUGINS=${QT_REL_INSTALL_ARCHDATA_PREFIX}plugins
-fi
-
-if [ -z "$QT_REL_INSTALL_IMPORTS" ]; then
- QT_REL_INSTALL_IMPORTS=${QT_REL_INSTALL_ARCHDATA_PREFIX}imports
-fi
-
-if [ -z "$QT_REL_INSTALL_QML" ]; then
- QT_REL_INSTALL_QML=${QT_REL_INSTALL_ARCHDATA_PREFIX}qml
-fi
-
-if [ -z "$QT_REL_INSTALL_DATA" ]; then
- QT_REL_INSTALL_DATA=.
-fi
-if [ x"$QT_REL_INSTALL_DATA" != x. ]; then
- QT_REL_INSTALL_DATA_PREFIX=$QT_REL_INSTALL_DATA/
-fi
-
-if [ -z "$QT_REL_INSTALL_DOCS" ]; then
- QT_REL_INSTALL_DOCS=${QT_REL_INSTALL_DATA_PREFIX}doc
-fi
-
-if [ -z "$QT_REL_INSTALL_TRANSLATIONS" ]; then
- QT_REL_INSTALL_TRANSLATIONS=${QT_REL_INSTALL_DATA_PREFIX}translations
-fi
-
-if [ -z "$QT_REL_INSTALL_EXAMPLES" ]; then
- QT_REL_INSTALL_EXAMPLES=examples
-fi
-
-if [ -z "$QT_REL_INSTALL_TESTS" ]; then
- QT_REL_INSTALL_TESTS=tests
-fi
-
-if [ -z "$QT_REL_INSTALL_SETTINGS" ]; then
- if [ "$XPLATFORM_MAC" = "yes" ]; then
- QT_REL_INSTALL_SETTINGS=/Library/Preferences/Qt
- else
- QT_REL_INSTALL_SETTINGS=etc/xdg
- fi
-fi
-
-#------- host paths --------
-
-if [ -z "$QT_REL_HOST_BINS" ]; then
- if $HAVE_HOST_PATH; then
- QT_REL_HOST_BINS=bin
- else
- QT_REL_HOST_BINS=$QT_REL_INSTALL_BINS
- fi
-fi
-
-if [ -z "$QT_REL_HOST_LIBS" ]; then
- if $HAVE_HOST_PATH; then
- QT_REL_HOST_LIBS=lib
- else
- QT_REL_HOST_LIBS=$QT_REL_INSTALL_LIBS
- fi
-fi
-
-if [ -z "$QT_REL_HOST_DATA" ]; then
- if $HAVE_HOST_PATH; then
- QT_REL_HOST_DATA=.
- else
- QT_REL_HOST_DATA=$QT_REL_INSTALL_ARCHDATA
- fi
-fi
-
-shortxspec=`echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
-shortspec=`echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
-
-QT_CONFIGURE_STR_OFF=0
-
-addConfStr()
-{
- QT_CONFIGURE_STR_OFFSETS="$QT_CONFIGURE_STR_OFFSETS $QT_CONFIGURE_STR_OFF,"
- QT_CONFIGURE_STRS="$QT_CONFIGURE_STRS \"$1\\0\"
-"
- count=`echo "$1" | wc -c`
- QT_CONFIGURE_STR_OFF=`expr $QT_CONFIGURE_STR_OFF + $count`
-}
-
-QT_CONFIGURE_STR_OFFSETS=
-QT_CONFIGURE_STRS=
-addConfStr "$QT_REL_INSTALL_DOCS"
-addConfStr "$QT_REL_INSTALL_HEADERS"
-addConfStr "$QT_REL_INSTALL_LIBS"
-addConfStr "$QT_REL_INSTALL_LIBEXECS"
-addConfStr "$QT_REL_INSTALL_BINS"
-addConfStr "$QT_REL_INSTALL_PLUGINS"
-addConfStr "$QT_REL_INSTALL_IMPORTS"
-addConfStr "$QT_REL_INSTALL_QML"
-addConfStr "$QT_REL_INSTALL_ARCHDATA"
-addConfStr "$QT_REL_INSTALL_DATA"
-addConfStr "$QT_REL_INSTALL_TRANSLATIONS"
-addConfStr "$QT_REL_INSTALL_EXAMPLES"
-addConfStr "$QT_REL_INSTALL_TESTS"
-QT_CONFIGURE_STR_OFFSETS_ALL=$QT_CONFIGURE_STR_OFFSETS
-QT_CONFIGURE_STRS_ALL=$QT_CONFIGURE_STRS
-
-QT_CONFIGURE_STR_OFFSETS=
-QT_CONFIGURE_STRS=
-addConfStr "$CFG_SYSROOT"
-addConfStr "$QT_REL_HOST_BINS"
-addConfStr "$QT_REL_HOST_LIBS"
-addConfStr "$QT_REL_HOST_DATA"
-addConfStr "$shortxspec"
-addConfStr "$shortspec"
-
-#-------------------------------------------------------------------------------
-# generate qconfig.cpp
-#-------------------------------------------------------------------------------
-[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
-
-cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
-/* Installation date */
-static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
-
-/* Installation Info */
-static const char qt_configure_prefix_path_str [256 + 12] = "qt_prfxpath=$QT_INSTALL_PREFIX";
-#ifdef QT_BUILD_QMAKE
-static const char qt_configure_ext_prefix_path_str [256 + 12] = "qt_epfxpath=$QT_EXT_PREFIX";
-static const char qt_configure_host_prefix_path_str [256 + 12] = "qt_hpfxpath=$QT_HOST_PREFIX";
-#endif
-
-static const short qt_configure_str_offsets[] = {
- $QT_CONFIGURE_STR_OFFSETS_ALL
-#ifdef QT_BUILD_QMAKE
- $QT_CONFIGURE_STR_OFFSETS
-#endif
-};
-static const char qt_configure_strs[] =
-$QT_CONFIGURE_STRS_ALL#ifdef QT_BUILD_QMAKE
-$QT_CONFIGURE_STRS#endif
-;
-
-#define QT_CONFIGURE_SETTINGS_PATH "$QT_REL_INSTALL_SETTINGS"
-
-#ifdef QT_BUILD_QMAKE
-# define QT_CONFIGURE_SYSROOTIFY_PREFIX $QMAKE_SYSROOTIFY
-#endif
-
-#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12
-#ifdef QT_BUILD_QMAKE
-# define QT_CONFIGURE_EXT_PREFIX_PATH qt_configure_ext_prefix_path_str + 12
-# define QT_CONFIGURE_HOST_PREFIX_PATH qt_configure_host_prefix_path_str + 12
-#endif
-EOF
-
-# avoid unecessary rebuilds by copying only if qconfig.cpp has changed
-if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then
- rm -f "$outpath/src/corelib/global/qconfig.cpp.new"
-else
- [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp"
- mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp"
- chmod -w "$outpath/src/corelib/global/qconfig.cpp"
-fi
-
-
# -----------------------------------------------------------------------------
# build qmake
# -----------------------------------------------------------------------------
@@ -1491,51 +1117,16 @@ setBootstrapVariable()
# create a qt.conf for the Qt build tree itself
#-------------------------------------------------------------------------------
-printInstallPaths()
-{
- cat <<EOF
-Documentation=$QT_REL_INSTALL_DOCS
-Headers=$QT_REL_INSTALL_HEADERS
-Libraries=$QT_REL_INSTALL_LIBS
-LibraryExecutables=$QT_REL_INSTALL_LIBEXECS
-Binaries=$QT_REL_INSTALL_BINS
-Plugins=$QT_REL_INSTALL_PLUGINS
-Imports=$QT_REL_INSTALL_IMPORTS
-Qml2Imports=$QT_REL_INSTALL_QML
-ArchData=$QT_REL_INSTALL_ARCHDATA
-Data=$QT_REL_INSTALL_DATA
-Translations=$QT_REL_INSTALL_TRANSLATIONS
-Examples=$QT_REL_INSTALL_EXAMPLES
-Tests=$QT_REL_INSTALL_TESTS
-EOF
-}
-
+# Note that this file is just sufficient to boot configure, by which it is
+# replaced in-place with a version which is suitable for building all of Qt.
QTCONFFILE="$outpath/bin/qt.conf"
cat > "$QTCONFFILE" <<EOF
[EffectivePaths]
Prefix=..
-EOF
-if [ -n "$CFG_HOST_QT_TOOLS_PATH" ]; then
- cat >> "$QTCONFFILE" <<EOF
-[DevicePaths]
-Prefix=$QT_INSTALL_PREFIX
-`printInstallPaths`
[Paths]
-Prefix=$QT_EXT_PREFIX
-`printInstallPaths`
-HostPrefix=$QT_HOST_PREFIX
-HostBinaries=$QT_REL_HOST_BINS
-HostLibraries=$QT_REL_HOST_LIBS
-HostData=$QT_REL_HOST_DATA
TargetSpec=$XPLATFORM
HostSpec=$PLATFORM
EOF
- if [ -n "$CFG_SYSROOT" ]; then
- cat >> "$QTCONFFILE" <<EOF
-Sysroot=$CFG_SYSROOT
-EOF
- fi
-fi
if [ x"$relpath" != x"$outpath" ]; then
cat >> "$QTCONFFILE" <<EOF
[EffectiveSourcePaths]
@@ -1594,12 +1185,7 @@ else
echo
fi
-if [ -n "$PREFIX_COMPLAINTS" ]; then
- echo
- echo "$PREFIX_COMPLAINTS"
- echo
-fi
-
+QT_INSTALL_PREFIX=`sed -ne 's/^Prefix=//p' < "$outpath/qmake/builtin-qt.conf"`
MAKE=`basename "$MAKE"`
echo
echo Qt is now configured for building. Just run \'$MAKE\'.
diff --git a/configure.json b/configure.json
index 9c6248549e..537a6ff526 100644
--- a/configure.json
+++ b/configure.json
@@ -1,5 +1,7 @@
{
"files": {
+ "builtinQtConf": "qmake/builtin-qt.conf",
+ "qconfigSource": "src/corelib/global/qconfig.cpp",
"publicHeader": "src/corelib/global/qconfig.h",
"privateHeader": "src/corelib/global/qconfig_p.h",
"publicPro": "mkspecs/qconfig.pri",
@@ -43,7 +45,7 @@
"libexecdir": "string",
"plugindir": "string",
"qmldir": "string",
- "settingsdir": "string",
+ "settingsdir": { "type": "string", "name": "sysconfdir" },
"sysconfdir": "string",
"testsdir": "string",
"translationdir": "string",
@@ -416,6 +418,9 @@
},
"features": {
+ "prepare": {
+ "output": [ "preparePaths" ]
+ },
"android-style-assets": {
"label": "Android Style Assets",
"condition": "config.android",
@@ -968,6 +973,10 @@
"earlyReport": [
{
+ "condition": "!features.prepare",
+ "comment": "This is not an actual report - instead, it activates the early setup."
+ },
+ {
"type": "fatal",
"condition": "!call.licenseCheck",
"message": "You are not licensed to use this software."
diff --git a/configure.pri b/configure.pri
index 93e2fe894a..2c70f271b0 100644
--- a/configure.pri
+++ b/configure.pri
@@ -437,6 +437,237 @@ defineTest(qtConfTest_checkCompiler) {
# custom outputs
+# type (empty or 'host'), option name, default value
+defineTest(processQtPath) {
+ out_var = config.rel_input.$${2}
+ path = $$eval(config.input.$${2})
+ isEmpty(path) {
+ $$out_var = $$3
+ } else {
+ path = $$absolute_path($$path, $$OUT_PWD)
+ rel = $$relative_path($$path, $$eval(config.input.$${1}prefix))
+ isEmpty(rel) {
+ $$out_var = .
+ } else: contains(rel, \.\..*) {
+ !equals(2, sysconfdir) {
+ PREFIX_COMPLAINTS += "-$$2 is not a subdirectory of -$${1}prefix."
+ export(PREFIX_COMPLAINTS)
+ !$$eval(have_$${1}prefix) {
+ PREFIX_REMINDER = true
+ export(PREFIX_REMINDER)
+ }
+ }
+ $$out_var = $$path
+ } else {
+ $$out_var = $$rel
+ }
+ }
+ export($$out_var)
+}
+
+defineTest(addConfStr) {
+ QT_CONFIGURE_STR_OFFSETS += " $$QT_CONFIGURE_STR_OFF,"
+ QT_CONFIGURE_STRS += " \"$$1\\0\""
+ QT_CONFIGURE_STR_OFF = $$num_add($$QT_CONFIGURE_STR_OFF, $$str_size($$1), 1)
+ export(QT_CONFIGURE_STR_OFFSETS)
+ export(QT_CONFIGURE_STRS)
+ export(QT_CONFIGURE_STR_OFF)
+}
+
+defineReplace(printInstallPath) {
+ val = $$eval(config.rel_input.$$2)
+ equals(val, $$3): return()
+ return("$$1=$$val")
+}
+
+defineReplace(printInstallPaths) {
+ ret = \
+ $$printInstallPath(Documentation, docdir, doc) \
+ $$printInstallPath(Headers, headerdir, include) \
+ $$printInstallPath(Libraries, libdir, lib) \
+ $$printInstallPath(LibraryExecutables, libexecdir, $$DEFAULT_LIBEXEC) \
+ $$printInstallPath(Binaries, bindir, bin) \
+ $$printInstallPath(Plugins, plugindir, plugins) \
+ $$printInstallPath(Imports, importdir, imports) \
+ $$printInstallPath(Qml2Imports, qmldir, qml) \
+ $$printInstallPath(ArchData, archdatadir, .) \
+ $$printInstallPath(Data, datadir, .) \
+ $$printInstallPath(Translations, translationdir, translations) \
+ $$printInstallPath(Examples, examplesdir, examples) \
+ $$printInstallPath(Tests, testsdir, tests)
+ return($$ret)
+}
+
+defineReplace(printHostPaths) {
+ ret = \
+ "HostPrefix=$$config.input.hostprefix" \
+ $$printInstallPath(HostBinaries, hostbindir, bin) \
+ $$printInstallPath(HostLibraries, hostlibdir, lib) \
+ $$printInstallPath(HostData, hostdatadir, .) \
+ "Sysroot=$$config.input.sysroot" \
+ "TargetSpec=$$[QMAKE_XSPEC]" \
+ "HostSpec=$$[QMAKE_SPEC]"
+ return($$ret)
+}
+
+defineTest(qtConfOutput_preparePaths) {
+ isEmpty(config.input.prefix) {
+ $$qtConfEvaluate("features.developer-build"): \
+ config.input.prefix = $$QT_BUILD_TREE # In Development, we use sandboxed builds by default
+ else: \
+ config.input.prefix = /usr/local/Qt-$$[QT_VERSION]
+ have_prefix = false
+ } else {
+ config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)
+ have_prefix = true
+ }
+
+ isEmpty(config.input.extprefix) {
+ config.input.extprefix = $$config.input.prefix
+ !isEmpty(config.input.sysroot): \
+ qmake_sysrootify = true
+ else: \
+ qmake_sysrootify = false
+ } else {
+ config.input.extprefix = $$absolute_path($$config.input.extprefix, $$OUT_PWD)
+ qmake_sysrootify = false
+ }
+
+ isEmpty(config.input.hostprefix) {
+ $$qmake_sysrootify: \
+ config.input.hostprefix = $$config.input.sysroot$$config.input.extprefix
+ else: \
+ config.input.hostprefix = $$config.input.extprefix
+ have_hostprefix = false
+ } else {
+ isEqual(config.input.hostprefix, yes): \
+ config.input.hostprefix = $$QT_BUILD_TREE
+ else: \
+ config.input.hostprefix = $$absolute_path($$config.input.hostprefix, $$OUT_PWD)
+ have_hostprefix = true
+ }
+
+ PREFIX_COMPLAINTS =
+ PREFIX_REMINDER = false
+ win32: \
+ DEFAULT_LIBEXEC = bin
+ else: \
+ DEFAULT_LIBEXEC = libexec
+ darwin: \
+ DEFAULT_SYSCONFDIR = /Library/Preferences/Qt
+ else: \
+ DEFAULT_SYSCONFDIR = etc/xdg
+
+ processQtPath("", headerdir, include)
+ processQtPath("", libdir, lib)
+ processQtPath("", bindir, bin)
+ processQtPath("", datadir, .)
+ !equals(config.rel_input.datadir, .): \
+ data_pfx = $$config.rel_input.datadir/
+ processQtPath("", docdir, $${data_pfx}doc)
+ processQtPath("", translationdir, $${data_pfx}translations)
+ processQtPath("", examplesdir, $${data_pfx}examples)
+ processQtPath("", testsdir, tests)
+ processQtPath("", archdatadir, .)
+ !equals(config.rel_input.archdatadir, .): \
+ archdata_pfx = $$config.rel_input.archdatadir/
+ processQtPath("", libexecdir, $${archdata_pfx}$$DEFAULT_LIBEXEC)
+ processQtPath("", plugindir, $${archdata_pfx}plugins)
+ processQtPath("", importdir, $${archdata_pfx}imports)
+ processQtPath("", qmldir, $${archdata_pfx}qml)
+ processQtPath("", sysconfdir, $$DEFAULT_SYSCONFDIR)
+ $$have_hostprefix {
+ processQtPath(host, hostbindir, bin)
+ processQtPath(host, hostlibdir, lib)
+ processQtPath(host, hostdatadir, .)
+ } else {
+ processQtPath(host, hostbindir, $$config.rel_input.bindir)
+ processQtPath(host, hostlibdir, $$config.rel_input.libdir)
+ processQtPath(host, hostdatadir, $$config.rel_input.archdatadir)
+ }
+
+ !isEmpty(PREFIX_COMPLAINTS) {
+ PREFIX_COMPLAINTS = "$$join(PREFIX_COMPLAINTS, "$$escape_expand(\\n)Note: ")"
+ $$PREFIX_REMINDER: \
+ PREFIX_COMPLAINTS += "Maybe you forgot to specify -prefix/-hostprefix?"
+ qtConfAddNote($$PREFIX_COMPLAINTS)
+ }
+
+ # populate qconfig.cpp (for qtcore)
+
+ QT_CONFIGURE_STR_OFF = 0
+ QT_CONFIGURE_STR_OFFSETS =
+ QT_CONFIGURE_STRS =
+
+ addConfStr($$config.rel_input.docdir)
+ addConfStr($$config.rel_input.headerdir)
+ addConfStr($$config.rel_input.libdir)
+ addConfStr($$config.rel_input.libexecdir)
+ addConfStr($$config.rel_input.bindir)
+ addConfStr($$config.rel_input.plugindir)
+ addConfStr($$config.rel_input.importdir)
+ addConfStr($$config.rel_input.qmldir)
+ addConfStr($$config.rel_input.archdatadir)
+ addConfStr($$config.rel_input.datadir)
+ addConfStr($$config.rel_input.translationdir)
+ addConfStr($$config.rel_input.examplesdir)
+ addConfStr($$config.rel_input.testsdir)
+
+ $${currentConfig}.output.qconfigSource = \
+ "/* Installation date */" \
+ "static const char qt_configure_installation [12+11] = \"qt_instdate=2012-12-20\";" \
+ "" \
+ "/* Installation Info */" \
+ "static const char qt_configure_prefix_path_str [12+256] = \"qt_prfxpath=$$config.input.prefix\";" \
+ "" \
+ "static const short qt_configure_str_offsets[] = {" \
+ $$QT_CONFIGURE_STR_OFFSETS \
+ "};" \
+ "static const char qt_configure_strs[] =" \
+ $$QT_CONFIGURE_STRS \
+ ";" \
+ "" \
+ "$${LITERAL_HASH}define QT_CONFIGURE_SETTINGS_PATH \"$$config.rel_input.sysconfdir\"" \
+ "" \
+ "$${LITERAL_HASH}define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12"
+ export($${currentConfig}.output.qconfigSource)
+
+ # populate qmake/builtin-qt.conf
+
+ $${currentConfig}.output.builtinQtConf = \
+ " " \
+ "===========================================================" \
+ "==================== qt.conf beginning ====================" \
+ "===========================================================" \
+ "[Paths]" \
+ "ExtPrefix=$$config.input.extprefix" \
+ "Prefix=$$config.input.prefix" \
+ $$printInstallPaths() \
+ "Settings=$$config.rel_input.sysconfdir" \
+ $$printHostPaths()
+ export($${currentConfig}.output.builtinQtConf)
+
+ # create bin/qt.conf. this doesn't use the regular file output
+ # mechanism, as the file is relied upon by configure tests.
+
+ cont = \
+ "[EffectivePaths]" \
+ "Prefix=.." \
+ "[DevicePaths]" \
+ "Prefix=$$config.input.prefix" \
+ $$printInstallPaths() \
+ "[Paths]" \
+ "Prefix=$$config.input.extprefix" \
+ $$printInstallPaths() \
+ $$printHostPaths()
+ !equals(QT_SOURCE_TREE, $$QT_BUILD_TREE): \
+ cont += \
+ "[EffectiveSourcePaths]" \
+ "Prefix=$$QT_SOURCE_TREE"
+ write_file($$QT_BUILD_TREE/bin/qt.conf, cont)|error()
+ reload_properties()
+}
+
defineTest(qtConfOutput_shared) {
!$${2}: return()
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 936a563b9e..cd4d36251e 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -1675,7 +1675,7 @@ defineTest(qtConfProcessOutput) {
$${currentConfig}.output.$$type += "$$k -= $$eval($${currentConfig}.output.$${type}.remove.$$k)"
for (k, $${currentConfig}.output.$${type}.append._KEYS_): \
$${currentConfig}.output.$$type += "$$k += $$eval($${currentConfig}.output.$${type}.append.$$k)"
- } else {
+ } else: contains(type, ".*Header") {
for (define, $${currentConfig}.output.$${type}._KEYS_) {
value = $$eval($${currentConfig}.output.$${type}.$${define})
$${currentConfig}.output.$$type += "$${LITERAL_HASH}define $$define $$value"
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index 808a6d8233..aa6c876c73 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -66,7 +66,6 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/io/qdir.cpp $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp \
$(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \
- $(SOURCE_PATH)/src/corelib/global/qconfig.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \
@@ -225,7 +224,7 @@ qsettings.o: $(SOURCE_PATH)/src/corelib/io/qsettings.cpp
qsystemerror.o: $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
-qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp $(BUILD_PATH)/src/corelib/global/qconfig.cpp
+qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp
qnumeric.o: $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index cd2cdd9c40..862c1e833e 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -154,8 +154,6 @@ $(OBJS): $(PCH_OBJECT)
$(QTOBJS): $(PCH_OBJECT)
-qlibraryinfo.obj: $(BUILD_PATH)\src\corelib\global\qconfig.cpp
-
qmake_pch.obj:
$(CXX) $(CXXFLAGS_BARE) -c -Yc -Fpqmake_pch.pch -TP $(QMKSRC)\qmake_pch.h
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 7648b9373d..b30373b596 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -101,7 +101,7 @@ enum TestFunc {
T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM,
T_DEFINED, T_DISCARD_FROM, T_CONTAINS, T_INFILE,
T_COUNT, T_ISEMPTY, T_PARSE_JSON, T_INCLUDE, T_LOAD, T_DEBUG, T_LOG, T_MESSAGE, T_WARNING, T_ERROR, T_IF,
- T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE
+ T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE, T_RELOAD_PROPERTIES
};
void QMakeEvaluator::initFunctionStatics()
@@ -200,6 +200,7 @@ void QMakeEvaluator::initFunctionStatics()
{ "write_file", T_WRITE_FILE },
{ "touch", T_TOUCH },
{ "cache", T_CACHE },
+ { "reload_properties", T_RELOAD_PROPERTIES },
};
statics.functions.reserve((int)(sizeof(testInits)/sizeof(testInits[0])));
for (unsigned i = 0; i < sizeof(testInits)/sizeof(testInits[0]); ++i)
@@ -2015,6 +2016,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
return writeFile(fL1S("cache "), fn, QIODevice::Append, false, varstr);
}
+ case T_RELOAD_PROPERTIES:
+#ifdef QT_BUILD_QMAKE
+ m_option->reloadProperties();
+#endif
+ return ReturnTrue;
default:
evalError(fL1S("Function '%1' is not implemented.").arg(function.toQString(m_tmp1)));
return ReturnFalse;
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 96c39fa168..1bb8632883 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -125,6 +125,7 @@ public:
void setDirectories(const QString &input_dir, const QString &output_dir);
#ifdef QT_BUILD_QMAKE
void setQMakeProperty(QMakeProperty *prop) { property = prop; }
+ void reloadProperties() { property->reload(); }
ProString propertyValue(const ProKey &name) const { return property->value(name); }
#else
# ifdef PROEVALUATOR_INIT_PROPS
diff --git a/qmake/option.cpp b/qmake/option.cpp
index fb49f5a100..b8102ecf06 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -638,6 +638,11 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data)
cache_items.append(new QMakeCacheClearItem(func, data));
}
+QString qmake_absoluteLocation()
+{
+ return Option::globals->qmake_abslocation;
+}
+
QString qmake_libraryInfoFile()
{
if (!Option::globals->qtconf.isEmpty())
diff --git a/qmake/property.cpp b/qmake/property.cpp
index d17d62481a..9a8db8904d 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -70,6 +70,12 @@ static const struct {
QMakeProperty::QMakeProperty() : settings(0)
{
+ reload();
+}
+
+void QMakeProperty::reload()
+{
+ QLibraryInfo::reload();
for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
QString name = QString::fromLatin1(propList[i].name);
if (!propList[i].singular) {
diff --git a/qmake/property.h b/qmake/property.h
index cd04e4bc03..b0129196eb 100644
--- a/qmake/property.h
+++ b/qmake/property.h
@@ -50,6 +50,8 @@ public:
QMakeProperty();
~QMakeProperty();
+ void reload();
+
bool hasValue(const ProKey &);
ProString value(const ProKey &);
diff --git a/qmake/qmake-aux.pro b/qmake/qmake-aux.pro
index 33a7fbfd2d..357ebc7367 100644
--- a/qmake/qmake-aux.pro
+++ b/qmake/qmake-aux.pro
@@ -6,6 +6,24 @@ QMAKE_DOCS = $$PWD/doc/qmake.qdocconf
# qmake binary
win32: EXTENSION = .exe
+
+!build_pass {
+ qmake_exe.target = $$OUT_PWD/qmake$$EXTENSION
+ qmake_exe.depends = ../bin/qmake$$EXTENSION builtin-qt.conf
+ equals(QMAKE_DIR_SEP, /): \
+ qmake_exe.commands = cat ../bin/qmake$$EXTENSION builtin-qt.conf > qmake$$EXTENSION && chmod +x qmake$$EXTENSION
+ else: \
+ qmake_exe.commands = copy /B ..\bin\qmake$$EXTENSION + builtin-qt.conf qmake$$EXTENSION
+ QMAKE_EXTRA_TARGETS += qmake_exe
+
+ QMAKE_CLEAN += builtin-qt.conf
+ QMAKE_DISTCLEAN += qmake$$EXTENSION
+
+ first.depends += qmake_exe
+ QMAKE_EXTRA_TARGETS += first
+}
+
qmake.path = $$[QT_HOST_BINS]
-qmake.files = $$OUT_PWD/../bin/qmake$$EXTENSION
+qmake.files = $$OUT_PWD/qmake$$EXTENSION
+qmake.CONFIG = no_check_exist executable
INSTALLS += qmake
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 27fe10a79e..87ee75fa45 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -41,15 +41,18 @@
#include "qdir.h"
#include "qstringlist.h"
#include "qfile.h"
+#include "qtemporaryfile.h"
#include "qsettings.h"
#include "qlibraryinfo.h"
#include "qscopedpointer.h"
#ifdef QT_BUILD_QMAKE
QT_BEGIN_NAMESPACE
+extern QString qmake_absoluteLocation();
extern QString qmake_libraryInfoFile();
QT_END_NAMESPACE
#else
+# include "qconfig.cpp"
# include "qcoreapplication.h"
#endif
@@ -57,7 +60,6 @@ QT_END_NAMESPACE
# include "private/qcore_mac_p.h"
#endif
-#include "qconfig.cpp"
#include "archdetect.cpp"
QT_BEGIN_NAMESPACE
@@ -70,9 +72,16 @@ struct QLibrarySettings
{
QLibrarySettings();
void load();
+#ifdef QT_BUILD_QMAKE
+ void loadBuiltinValues(QSettings *config);
+#endif
QScopedPointer<QSettings> settings;
#ifdef QT_BUILD_QMAKE
+ QString builtinValues[QLibraryInfo::LastHostPath + 1];
+# ifndef Q_OS_WIN
+ QString builtinSettingsPath;
+# endif
bool haveDevicePaths;
bool haveEffectiveSourcePaths;
bool haveEffectivePaths;
@@ -88,6 +97,11 @@ class QLibraryInfoPrivate
public:
static QSettings *findConfiguration();
#ifdef QT_BUILD_QMAKE
+ static void reload()
+ {
+ if (qt_library_settings.exists())
+ qt_library_settings->load();
+ }
static bool haveGroup(QLibraryInfo::PathGroup group)
{
QLibrarySettings *ls = qt_library_settings();
@@ -99,6 +113,25 @@ public:
? ls->haveDevicePaths
: ls->havePaths) : false;
}
+ static bool sysrootify()
+ {
+ // This is actually bogus, as it does not consider post-configure settings.
+ QLibrarySettings *ls = qt_library_settings();
+ return ls ? (!ls->builtinValues[QLibraryInfo::SysrootPath].isEmpty()
+ && ls->builtinValues[QLibraryInfo::ExtPrefixPath].isEmpty()) : false;
+ }
+ static QString builtinValue(int loc)
+ {
+ QLibrarySettings *ls = qt_library_settings();
+ return ls ? ls->builtinValues[loc] : QString();
+ }
+# ifndef Q_OS_WIN
+ static QString builtinSettingsPath()
+ {
+ QLibrarySettings *ls = qt_library_settings();
+ return ls ? ls->builtinSettingsPath : QString();
+ }
+# endif
#endif
static QSettings *configuration()
{
@@ -122,6 +155,20 @@ QLibrarySettings::QLibrarySettings()
load();
}
+#ifdef QT_BUILD_QMAKE
+static QByteArray qtconfSeparator()
+{
+# ifdef Q_OS_WIN
+ QByteArray header = QByteArrayLiteral("\r\n===========================================================\r\n");
+# else
+ QByteArray header = QByteArrayLiteral("\n===========================================================\n");
+# endif
+ QByteArray content = QByteArrayLiteral("==================== qt.conf beginning ====================");
+ // Assemble from pieces to avoid that the string appears in a raw executable
+ return header + content + header;
+}
+#endif
+
void QLibrarySettings::load()
{
// If we get any settings here, those won't change when the application shows up.
@@ -159,6 +206,27 @@ void QLibrarySettings::load()
havePaths = false;
#endif
}
+
+#ifdef QT_BUILD_QMAKE
+ // Try to use an embedded qt.conf appended to the QMake executable.
+ QFile qmakeFile(qmake_absoluteLocation());
+ if (!qmakeFile.open(QIODevice::ReadOnly))
+ return;
+ qmakeFile.seek(qmakeFile.size() - 10000);
+ QByteArray tail = qmakeFile.read(10000);
+ QByteArray separator = qtconfSeparator();
+ int qtconfOffset = tail.lastIndexOf(separator);
+ if (qtconfOffset < 0)
+ return;
+ tail.remove(0, qtconfOffset + separator.size());
+ // If QSettings had a c'tor taking a QIODevice, we'd pass a QBuffer ...
+ QTemporaryFile tmpFile;
+ tmpFile.open();
+ tmpFile.write(tail);
+ tmpFile.close();
+ QSettings builtinSettings(tmpFile.fileName(), QSettings::IniFormat);
+ loadBuiltinValues(&builtinSettings);
+#endif
}
QSettings *QLibraryInfoPrivate::findConfiguration()
@@ -420,10 +488,30 @@ static const struct {
{ "HostData", "." },
{ "TargetSpec", "" },
{ "HostSpec", "" },
+ { "ExtPrefix", "" },
{ "HostPrefix", "" },
#endif
};
+#ifdef QT_BUILD_QMAKE
+void QLibrarySettings::loadBuiltinValues(QSettings *config)
+{
+ config->beginGroup(QLatin1String("Paths"));
+ for (int i = 0; i <= QLibraryInfo::LastHostPath; i++)
+ builtinValues[i] = config->value(QLatin1String(qtConfEntries[i].key),
+ QLatin1String(qtConfEntries[i].value)).toString();
+# ifndef Q_OS_WIN
+ builtinSettingsPath = config->value(QLatin1String("Settings")).toString();
+# endif
+ config->endGroup();
+}
+
+void QLibraryInfo::reload()
+{
+ QLibraryInfoPrivate::reload();
+}
+#endif
+
/*!
Returns the location specified by \a loc.
*/
@@ -434,7 +522,7 @@ QLibraryInfo::location(LibraryLocation loc)
QString ret = rawLocation(loc, FinalPaths);
// Automatically prepend the sysroot to target paths
- if ((loc < SysrootPath || loc > LastHostPath) && QT_CONFIGURE_SYSROOTIFY_PREFIX) {
+ if ((loc < SysrootPath || loc > LastHostPath) && QLibraryInfoPrivate::sysrootify()) {
QString sysroot = rawLocation(SysrootPath, FinalPaths);
if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
&& (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
@@ -528,28 +616,32 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
#endif // QT_NO_SETTINGS
if (!fromConf) {
+#ifdef QT_BUILD_QMAKE
+ if ((unsigned)loc <= (unsigned)LastHostPath) {
+ if (loc == PrefixPath && group != DevicePaths)
+ ret = QLibraryInfoPrivate::builtinValue(ExtPrefixPath);
+ else
+ ret = QLibraryInfoPrivate::builtinValue(loc);
+# ifndef Q_OS_WIN // On Windows we use the registry
+ } else if (loc == SettingsPath) {
+ ret = QLibraryInfoPrivate::builtinSettingsPath();
+# endif
+ }
+#else // QT_BUILD_QMAKE
const char * volatile path = 0;
if (loc == PrefixPath) {
- path =
-#ifdef QT_BUILD_QMAKE
- (group != DevicePaths) ?
- QT_CONFIGURE_EXT_PREFIX_PATH :
-#endif
- QT_CONFIGURE_PREFIX_PATH;
+ path = QT_CONFIGURE_PREFIX_PATH;
} else if (unsigned(loc) <= sizeof(qt_configure_str_offsets)/sizeof(qt_configure_str_offsets[0])) {
path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
#ifndef Q_OS_WIN // On Windows we use the registry
} else if (loc == SettingsPath) {
path = QT_CONFIGURE_SETTINGS_PATH;
#endif
-#ifdef QT_BUILD_QMAKE
- } else if (loc == HostPrefixPath) {
- path = QT_CONFIGURE_HOST_PREFIX_PATH;
-#endif
}
if (path)
ret = QString::fromLocal8Bit(path);
+#endif
}
#ifdef QT_BUILD_QMAKE
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 55be706382..9d794ce1da 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -96,6 +96,7 @@ public:
HostDataPath,
TargetSpecPath,
HostSpecPath,
+ ExtPrefixPath,
HostPrefixPath,
LastHostPath = HostPrefixPath,
#endif
@@ -105,6 +106,7 @@ public:
#ifdef QT_BUILD_QMAKE
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
static QString rawLocation(LibraryLocation, PathGroup);
+ static void reload();
#endif
static QStringList platformPluginArguments(const QString &platformName);
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 49dab2fcd4..630e58d818 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -48,14 +48,6 @@
QT_BEGIN_NAMESPACE
-enum Platforms {
- WINDOWS,
- WINDOWS_RT,
- QNX,
- ANDROID,
- OTHER
-};
-
std::ostream &operator<<(std::ostream &s, const QString &val) {
s << val.toLocal8Bit().data();
return s;
@@ -84,19 +76,12 @@ Configure::Configure(int& argc, char** argv)
sourceDir = sourcePathInfo.dir();
}
buildPath = QDir::currentPath();
-#if 0
- const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
-#else
- const QString installPath = buildPath;
-#endif
if (sourceDir != buildDir) { //shadow builds!
QDir(buildPath).mkpath("bin");
buildDir.mkpath("mkspecs");
}
- dictionary[ "QT_INSTALL_PREFIX" ] = installPath;
-
if (dictionary[ "QMAKESPEC" ].size() == 0) {
dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
dictionary[ "QMAKESPEC_FROM" ] = "detected";
@@ -104,9 +89,6 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "SYNCQT" ] = "auto";
- //Only used when cross compiling.
- dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
-
QString tmp = dictionary[ "QMAKESPEC" ];
if (tmp.contains("\\")) {
tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
@@ -197,148 +179,6 @@ void Configure::parseCmdLine()
else if (configCmdLine.at(i) == "-no-syncqt")
dictionary[ "SYNCQT" ] = "no";
- // Directories ----------------------------------------------
- else if (configCmdLine.at(i) == "-prefix") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-bindir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-libexecdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_LIBEXECS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-libdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-docdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-headerdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-plugindir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-importdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-qmldir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_QML" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-archdatadir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_ARCHDATA" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-datadir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-translationdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-examplesdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-testsdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-sysroot") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-hostprefix") {
- ++i;
- if (i == argCount || configCmdLine.at(i).startsWith('-'))
- dictionary[ "QT_HOST_PREFIX" ] = buildPath;
- else
- dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-hostbindir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-hostlibdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_HOST_LIBS" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-hostdatadir") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_HOST_DATA" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-extprefix") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i);
- }
-
else if (configCmdLine.at(i) == "-make-tool") {
++i;
if (i == argCount)
@@ -346,13 +186,6 @@ void Configure::parseCmdLine()
dictionary[ "MAKE" ] = configCmdLine.at(i);
}
- else if (configCmdLine.at(i) == "-sysconfdir") {
- ++i;
- if (i == argCount)
- break;
- dictionary["QT_INSTALL_SETTINGS"] = configCmdLine.at(i);
- }
-
else if (configCmdLine.at(i) == "-android-ndk") {
++i;
if (i == argCount)
@@ -531,219 +364,6 @@ void Configure::generateHeaders()
}
}
-void Configure::addConfStr(int group, const QString &val)
-{
- confStrOffsets[group] += ' ' + QString::number(confStringOff) + ',';
- confStrings[group] += " \"" + val + "\\0\"\n";
- confStringOff += val.length() + 1;
-}
-
-void Configure::generateQConfigCpp()
-{
- QString hostSpec = dictionary["QMAKESPEC"];
- QString targSpec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : hostSpec;
-
- dictionary["CFG_SYSROOT"] = QDir::cleanPath(dictionary["CFG_SYSROOT"]);
-
- bool qipempty = false;
- if (dictionary["QT_INSTALL_PREFIX"].isEmpty())
- qipempty = true;
- else
- dictionary["QT_INSTALL_PREFIX"] = QDir::cleanPath(dictionary["QT_INSTALL_PREFIX"]);
-
- bool sysrootifyPrefix;
- if (dictionary["QT_EXT_PREFIX"].isEmpty()) {
- dictionary["QT_EXT_PREFIX"] = dictionary["QT_INSTALL_PREFIX"];
- sysrootifyPrefix = !dictionary["CFG_SYSROOT"].isEmpty();
- } else {
- dictionary["QT_EXT_PREFIX"] = QDir::cleanPath(dictionary["QT_EXT_PREFIX"]);
- sysrootifyPrefix = false;
- }
-
- bool haveHpx;
- if (dictionary["QT_HOST_PREFIX"].isEmpty()) {
- dictionary["QT_HOST_PREFIX"] = (sysrootifyPrefix ? dictionary["CFG_SYSROOT"] : QString())
- + dictionary["QT_INSTALL_PREFIX"];
- haveHpx = false;
- } else {
- dictionary["QT_HOST_PREFIX"] = QDir::cleanPath(dictionary["QT_HOST_PREFIX"]);
- haveHpx = true;
- }
-
- static const struct {
- const char *basevar, *baseoption, *var, *option;
- } varmod[] = {
- { "INSTALL_", "-prefix", "DOCS", "-docdir" },
- { "INSTALL_", "-prefix", "HEADERS", "-headerdir" },
- { "INSTALL_", "-prefix", "LIBS", "-libdir" },
- { "INSTALL_", "-prefix", "LIBEXECS", "-libexecdir" },
- { "INSTALL_", "-prefix", "BINS", "-bindir" },
- { "INSTALL_", "-prefix", "PLUGINS", "-plugindir" },
- { "INSTALL_", "-prefix", "IMPORTS", "-importdir" },
- { "INSTALL_", "-prefix", "QML", "-qmldir" },
- { "INSTALL_", "-prefix", "ARCHDATA", "-archdatadir" },
- { "INSTALL_", "-prefix", "DATA", "-datadir" },
- { "INSTALL_", "-prefix", "TRANSLATIONS", "-translationdir" },
- { "INSTALL_", "-prefix", "EXAMPLES", "-examplesdir" },
- { "INSTALL_", "-prefix", "TESTS", "-testsdir" },
- { "INSTALL_", "-prefix", "SETTINGS", "-sysconfdir" },
- { "HOST_", "-hostprefix", "BINS", "-hostbindir" },
- { "HOST_", "-hostprefix", "LIBS", "-hostlibdir" },
- { "HOST_", "-hostprefix", "DATA", "-hostdatadir" },
- };
-
- bool prefixReminder = false;
- for (uint i = 0; i < sizeof(varmod) / sizeof(varmod[0]); i++) {
- QString path = QDir::cleanPath(
- dictionary[QLatin1String("QT_") + varmod[i].basevar + varmod[i].var]);
- if (path.isEmpty())
- continue;
- QString base = dictionary[QLatin1String("QT_") + varmod[i].basevar + "PREFIX"];
- if (!path.startsWith(base)) {
- if (i != 13) {
- dictionary["PREFIX_COMPLAINTS"] += QLatin1String("\n NOTICE: ")
- + varmod[i].option + " is not a subdirectory of " + varmod[i].baseoption + ".";
- if (i < 13 ? qipempty : !haveHpx)
- prefixReminder = true;
- }
- } else {
- path.remove(0, base.size());
- if (path.startsWith('/'))
- path.remove(0, 1);
- }
- dictionary[QLatin1String("QT_REL_") + varmod[i].basevar + varmod[i].var]
- = path.isEmpty() ? "." : path;
- }
- if (prefixReminder) {
- dictionary["PREFIX_COMPLAINTS"]
- += "\n Maybe you forgot to specify -prefix/-hostprefix?";
- }
-
- if (!qipempty) {
- // If QT_INSTALL_* have not been specified on the command line,
- // default them here, unless prefix is empty (WinCE).
-
- if (dictionary["QT_REL_INSTALL_HEADERS"].isEmpty())
- dictionary["QT_REL_INSTALL_HEADERS"] = "include";
-
- if (dictionary["QT_REL_INSTALL_LIBS"].isEmpty())
- dictionary["QT_REL_INSTALL_LIBS"] = "lib";
-
- if (dictionary["QT_REL_INSTALL_BINS"].isEmpty())
- dictionary["QT_REL_INSTALL_BINS"] = "bin";
-
- if (dictionary["QT_REL_INSTALL_ARCHDATA"].isEmpty())
- dictionary["QT_REL_INSTALL_ARCHDATA"] = ".";
- if (dictionary["QT_REL_INSTALL_ARCHDATA"] != ".")
- dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] = dictionary["QT_REL_INSTALL_ARCHDATA"] + '/';
-
- if (dictionary["QT_REL_INSTALL_LIBEXECS"].isEmpty()) {
- if (targSpec.startsWith("win"))
- dictionary["QT_REL_INSTALL_LIBEXECS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "bin";
- else
- dictionary["QT_REL_INSTALL_LIBEXECS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "libexec";
- }
-
- if (dictionary["QT_REL_INSTALL_PLUGINS"].isEmpty())
- dictionary["QT_REL_INSTALL_PLUGINS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "plugins";
-
- if (dictionary["QT_REL_INSTALL_IMPORTS"].isEmpty())
- dictionary["QT_REL_INSTALL_IMPORTS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "imports";
-
- if (dictionary["QT_REL_INSTALL_QML"].isEmpty())
- dictionary["QT_REL_INSTALL_QML"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "qml";
-
- if (dictionary["QT_REL_INSTALL_DATA"].isEmpty())
- dictionary["QT_REL_INSTALL_DATA"] = ".";
- if (dictionary["QT_REL_INSTALL_DATA"] != ".")
- dictionary["QT_REL_INSTALL_DATA_PREFIX"] = dictionary["QT_REL_INSTALL_DATA"] + '/';
-
- if (dictionary["QT_REL_INSTALL_DOCS"].isEmpty())
- dictionary["QT_REL_INSTALL_DOCS"] = dictionary["QT_REL_INSTALL_DATA_PREFIX"] + "doc";
-
- if (dictionary["QT_REL_INSTALL_TRANSLATIONS"].isEmpty())
- dictionary["QT_REL_INSTALL_TRANSLATIONS"] = dictionary["QT_REL_INSTALL_DATA_PREFIX"] + "translations";
-
- if (dictionary["QT_REL_INSTALL_EXAMPLES"].isEmpty())
- dictionary["QT_REL_INSTALL_EXAMPLES"] = "examples";
-
- if (dictionary["QT_REL_INSTALL_TESTS"].isEmpty())
- dictionary["QT_REL_INSTALL_TESTS"] = "tests";
- }
-
- if (dictionary["QT_REL_HOST_BINS"].isEmpty())
- dictionary["QT_REL_HOST_BINS"] = haveHpx ? "bin" : dictionary["QT_REL_INSTALL_BINS"];
-
- if (dictionary["QT_REL_HOST_LIBS"].isEmpty())
- dictionary["QT_REL_HOST_LIBS"] = haveHpx ? "lib" : dictionary["QT_REL_INSTALL_LIBS"];
-
- if (dictionary["QT_REL_HOST_DATA"].isEmpty())
- dictionary["QT_REL_HOST_DATA"] = haveHpx ? "." : dictionary["QT_REL_INSTALL_ARCHDATA"];
-
- confStringOff = 0;
- addConfStr(0, dictionary["QT_REL_INSTALL_DOCS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_HEADERS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_LIBS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_LIBEXECS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_BINS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_PLUGINS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_IMPORTS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_QML"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_ARCHDATA"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_DATA"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_TRANSLATIONS"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_EXAMPLES"]);
- addConfStr(0, dictionary["QT_REL_INSTALL_TESTS"]);
- addConfStr(1, dictionary["CFG_SYSROOT"]);
- addConfStr(1, dictionary["QT_REL_HOST_BINS"]);
- addConfStr(1, dictionary["QT_REL_HOST_LIBS"]);
- addConfStr(1, dictionary["QT_REL_HOST_DATA"]);
- addConfStr(1, targSpec);
- addConfStr(1, hostSpec);
-
- // Generate the new qconfig.cpp file
- {
- FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.cpp");
- tmpStream << "/* Build date */" << endl
- << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=2012-12-20\";" << endl
- << endl
- << "/* Installation Info */" << endl
- << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << dictionary["QT_INSTALL_PREFIX"] << "\";" << endl
- << "#ifdef QT_BUILD_QMAKE" << endl
- << "static const char qt_configure_ext_prefix_path_str [512 + 12] = \"qt_epfxpath=" << dictionary["QT_EXT_PREFIX"] << "\";" << endl
- << "static const char qt_configure_host_prefix_path_str [512 + 12] = \"qt_hpfxpath=" << dictionary["QT_HOST_PREFIX"] << "\";" << endl
- << "#endif" << endl
- << endl
- << "static const short qt_configure_str_offsets[] = {\n"
- << " " << confStrOffsets[0] << endl
- << "#ifdef QT_BUILD_QMAKE\n"
- << " " << confStrOffsets[1] << endl
- << "#endif\n"
- << "};\n"
- << "static const char qt_configure_strs[] =\n"
- << confStrings[0] << "#ifdef QT_BUILD_QMAKE\n"
- << confStrings[1] << "#endif\n"
- << ";\n"
- << endl;
- if ((platform() != WINDOWS) && (platform() != WINDOWS_RT))
- tmpStream << "#define QT_CONFIGURE_SETTINGS_PATH \"" << dictionary["QT_REL_INSTALL_SETTINGS"] << "\"" << endl;
-
- tmpStream << endl
- << "#ifdef QT_BUILD_QMAKE\n"
- << "# define QT_CONFIGURE_SYSROOTIFY_PREFIX " << (sysrootifyPrefix ? "true" : "false") << endl
- << "#endif\n\n"
- << endl
- << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12\n"
- << "#ifdef QT_BUILD_QMAKE\n"
- << "# define QT_CONFIGURE_EXT_PREFIX_PATH qt_configure_ext_prefix_path_str + 12\n"
- << "# define QT_CONFIGURE_HOST_PREFIX_PATH qt_configure_host_prefix_path_str + 12\n"
- << "#endif\n";
-
- if (!tmpStream.flush())
- dictionary[ "DONE" ] = "error";
- }
-}
-
void Configure::buildQmake()
{
{
@@ -841,7 +461,11 @@ void Configure::buildQmake()
if (confFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
QTextStream confStream(&confFile);
confStream << "[EffectivePaths]" << endl
- << "Prefix=.." << endl;
+ << "Prefix=.." << endl
+ << "[Paths]" << endl
+ << "TargetSpec=" << (dictionary.contains("XQMAKESPEC")
+ ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]) << endl
+ << "HostSpec=" << dictionary["QMAKESPEC"] << endl;
if (sourcePath != buildPath)
confStream << "[EffectiveSourcePaths]" << endl
<< "Prefix=" << sourcePath << endl;
@@ -897,25 +521,6 @@ bool Configure::isOk()
return (dictionary[ "DONE" ] != "error");
}
-int Configure::platform() const
-{
- const QString xQMakeSpec = dictionary.value("XQMAKESPEC");
-
- if ((xQMakeSpec.startsWith("winphone") || xQMakeSpec.startsWith("winrt")))
- return WINDOWS_RT;
-
- if (xQMakeSpec.contains("qnx"))
- return QNX;
-
- if (xQMakeSpec.contains("android"))
- return ANDROID;
-
- if (!xQMakeSpec.isEmpty())
- return OTHER;
-
- return WINDOWS;
-}
-
FileWriter::FileWriter(const QString &name)
: QTextStream()
, m_name(name)
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 755a2e2696..32ba7d3444 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -44,7 +44,6 @@ public:
void parseCmdLine();
- void generateQConfigCpp();
void buildQmake();
void prepareConfigureInput();
@@ -56,8 +55,6 @@ public:
bool isDone();
bool isOk();
- int platform() const;
-
private:
int verbose;
@@ -72,11 +69,6 @@ private:
QString sourcePathMangled, buildPathMangled;
QDir sourceDir, buildDir;
- QString confStrOffsets[2];
- QString confStrings[2];
- int confStringOff;
-
- void addConfStr(int group, const QString &val);
QString formatPath(const QString &path);
bool reloadCmdLine(int idx);
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
index 3fce934da5..e4b9c12e3d 100644
--- a/tools/configure/main.cpp
+++ b/tools/configure/main.cpp
@@ -45,9 +45,6 @@ int runConfigure( int argc, char** argv )
if (!app.isOk())
return 3;
- // Source file with path settings. Needed by qmake.
- app.generateQConfigCpp();
-
// Bootstrapped includes. Needed by qmake.
app.generateHeaders();
if (!app.isOk())