From 4712b0e99fdb90b6cbfe12ad16e534b49cd98343 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 24 Sep 2012 14:30:45 +0200 Subject: [PATCH] Add -archdatadir and change some of the default install dirs in Qt 5. Architecture-depedent Qt data defaults now to something under -archdatadir. Architecture-dependent data is everything that contains machine code (e.g., plugins) as well as anything that hardcodes build-specific data, like qconfig.pri and qmodule.pri. That is: QML imports: $archdatadir/imports (includes plugins) Qt plugins: $archdatadir/plugins (machine code) Mkspecs: $archdatadir/mkspecs (build-specific) Architecture-independent Qt data defaults now to something under -datadir. This option existed in Qt 4, but did not differentiate between arch-dependent and independent. Following Autoconf's lead, --datadir is the *independent* data root. translations: $datadir/translations (.qm files are arch-independent) docs: $datadir/doc By default, both new options are equal to the Qt install prefix. (Strictly speaking, for complete Autoconf compatibility, we'd need a --datarootdir=$prefix/share, --datadir=$datarootdir/qt5 and --docdir=$datarootdir/doc/qt5, but that's just nitpicking and unnecessary) Change-Id: I39c886a6a2d2d2c0b11923c50974179e21f2af76 Reviewed-by: Oswald Buddenhagen --- configure | 64 +++++++++++++++++------------ qmake/property.cpp | 1 + src/corelib/global/qlibraryinfo.cpp | 12 +++--- src/corelib/global/qlibraryinfo.h | 1 + tools/configure/configureapp.cpp | 34 ++++++++++----- 5 files changed, 70 insertions(+), 42 deletions(-) diff --git a/configure b/configure index d3df651a7b..a90b06d978 100755 --- a/configure +++ b/configure @@ -884,6 +884,7 @@ QT_INSTALL_LIBS= QT_INSTALL_BINS= QT_INSTALL_PLUGINS= QT_INSTALL_IMPORTS= +QT_INSTALL_ARCHDATA= QT_INSTALL_DATA= QT_INSTALL_TRANSLATIONS= QT_INSTALL_SETTINGS= @@ -992,7 +993,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style options that pass an argument - -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-archdatadir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1207,6 +1208,9 @@ while [ "$#" -gt 0 ]; do importdir) QT_INSTALL_IMPORTS="$VAL" ;; + archdatadir) + QT_INSTALL_ARCHDATA="$VAL" + ;; datadir) QT_INSTALL_DATA="$VAL" ;; @@ -2772,11 +2776,6 @@ if [ -z "$QT_INSTALL_PREFIX" ]; then fi QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"` -if [ -z "$QT_INSTALL_DOCS" ]; then #default - QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback -fi -QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"` - if [ -z "$QT_INSTALL_HEADERS" ]; then #default QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include" fi @@ -2787,28 +2786,38 @@ if [ -z "$QT_INSTALL_LIBS" ]; then #default fi QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"` +if [ -z "$QT_INSTALL_ARCHDATA" ]; then #default + QT_INSTALL_ARCHDATA="$QT_INSTALL_PREFIX" #fallback +fi +QT_INSTALL_ARCHDATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_ARCHDATA"` + +if [ -z "$QT_INSTALL_DATA" ]; then #default + QT_INSTALL_DATA="$QT_INSTALL_PREFIX" #fallback +fi +QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"` + if [ -z "$QT_INSTALL_BINS" ]; then #default QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback fi QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"` +if [ -z "$QT_INSTALL_DOCS" ]; then #default + QT_INSTALL_DOCS="$QT_INSTALL_DATA/doc" #fallback +fi +QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"` + if [ -z "$QT_INSTALL_PLUGINS" ]; then #default - QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback + QT_INSTALL_PLUGINS="$QT_INSTALL_ARCHDATA/plugins" #fallback fi QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"` if [ -z "$QT_INSTALL_IMPORTS" ]; then #default - QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback + QT_INSTALL_IMPORTS="$QT_INSTALL_ARCHDATA/imports" #fallback fi QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"` -if [ -z "$QT_INSTALL_DATA" ]; then #default - QT_INSTALL_DATA="$QT_INSTALL_PREFIX" -fi -QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"` - if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default - QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations" + QT_INSTALL_TRANSLATIONS="$QT_INSTALL_DATA/translations" #fallback fi QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"` @@ -2855,7 +2864,7 @@ if [ -z "$QT_HOST_DATA" ]; then #default if $haveHpx; then QT_HOST_DATA="$QT_HOST_PREFIX" else - QT_HOST_DATA="$QT_INSTALL_DATA" + QT_HOST_DATA="$QT_INSTALL_ARCHDATA" fi else QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"` @@ -2995,20 +3004,22 @@ Installation options: -bindir ......... Executables will be installed to (default PREFIX/bin) - -libdir ......... Libraries will be installed to - (default PREFIX/lib) - -docdir ......... Documentation will be installed to - (default PREFIX/doc) -headerdir ...... Headers will be installed to (default PREFIX/include) - -plugindir ...... Plugins will be installed to - (default PREFIX/plugins) - -importdir ...... Imports for QML will be installed to - (default PREFIX/imports) - -datadir ........ Data used by Qt programs will be installed to + -libdir ......... Libraries will be installed to + (default PREFIX/lib) + -archdatadir ..... Arch-dependent data used by Qt will be installed to (default PREFIX) + -plugindir ...... Plugins will be installed to + (default ARCHDATADIR/plugins) + -importdir ...... Imports for QML will be installed to + (default ARCHDATADIR/imports) + -datadir ........ Arch-independent data used by Qt will be installed to + (default PREFIX) + -docdir ......... Documentation will be installed to + (default DATADIR/doc) -translationdir . Translations of Qt programs will be installed to - (default PREFIX/translations) + (default DATADIR/translations) -sysconfdir ..... Settings used by Qt programs will be looked for in (default PREFIX/etc/settings) -examplesdir .... Examples will be installed to @@ -3486,6 +3497,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = { "qt_binspath=$QT_INSTALL_BINS", "qt_plugpath=$QT_INSTALL_PLUGINS", "qt_impspath=$QT_INSTALL_IMPORTS", + "qt_adatpath=$QT_INSTALL_ARCHDATA", "qt_datapath=$QT_INSTALL_DATA", "qt_trnspath=$QT_INSTALL_TRANSLATIONS", "qt_xmplpath=$QT_INSTALL_EXAMPLES", @@ -3644,7 +3656,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; fi QMAKE_BIN_DIR="$QT_INSTALL_BINS" [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin" - QMAKE_DATA_DIR="$QT_INSTALL_DATA" + QMAKE_DATA_DIR="$QT_INSTALL_ARCHDATA" [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}" echo >>"$mkfile" adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'` diff --git a/qmake/property.cpp b/qmake/property.cpp index f1e9ba63ac..35f0ba9e7b 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -56,6 +56,7 @@ static const struct { } propList[] = { { "QT_SYSROOT", QLibraryInfo::SysrootPath, true }, { "QT_INSTALL_PREFIX", QLibraryInfo::PrefixPath, false }, + { "QT_INSTALL_ARCHDATA", QLibraryInfo::ArchDataPath, false }, { "QT_INSTALL_DATA", QLibraryInfo::DataPath, false }, { "QT_INSTALL_DOCS", QLibraryInfo::DocumentationPath, false }, { "QT_INSTALL_HEADERS", QLibraryInfo::HeadersPath, false }, diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 25f827aed7..13d3a879c7 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -261,14 +261,15 @@ static const struct { char key[14], value[13]; } qtConfEntries[] = { { "Prefix", "." }, - { "Documentation", "doc" }, + { "Documentation", "doc" }, // should be ${Data}/doc { "Headers", "include" }, { "Libraries", "lib" }, { "Binaries", "bin" }, - { "Plugins", "plugins" }, - { "Imports", "imports" }, + { "Plugins", "plugins" }, // should be ${ArchData}/plugins + { "Imports", "imports" }, // should be ${ArchData}/imports + { "ArchData", "." }, { "Data", "." }, - { "Translations", "translations" }, + { "Translations", "translations" }, // should be ${Data}/translations { "Examples", "examples" }, { "Tests", "tests" }, #ifdef QT_BOOTSTRAPPED @@ -444,7 +445,8 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) \value BinariesPath The location of installed Qt binaries (tools and applications). \value PluginsPath The location of installed Qt plugins. \value ImportsPath The location of installed QML extensions to import. - \value DataPath The location of general Qt data. + \value ArchDataPath The location of general architecture-dependent Qt data. + \value DataPath The location of general architecture-independent Qt data. \value TranslationsPath The location of translation information for Qt strings. \value ExamplesPath The location for examples upon install. \value TestsPath The location of installed Qt testcases. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 93b0c81562..7f035194ef 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -70,6 +70,7 @@ public: BinariesPath, PluginsPath, ImportsPath, + ArchDataPath, DataPath, TranslationsPath, ExamplesPath, diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index cb853b3496..dfc3d216c3 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1066,6 +1066,13 @@ void Configure::parseCmdLine() break; dictionary[ "QT_INSTALL_IMPORTS" ] = 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) @@ -1577,12 +1584,13 @@ bool Configure::displayHelp() desc( "-bindir ", "Executables will be installed to \n(default PREFIX/bin)"); desc( "-libdir ", "Libraries will be installed to \n(default PREFIX/lib)"); - desc( "-docdir ", "Documentation will be installed to \n(default PREFIX/doc)"); desc( "-headerdir ", "Headers will be installed to \n(default PREFIX/include)"); - desc( "-plugindir ", "Plugins will be installed to \n(default PREFIX/plugins)"); - desc( "-importdir ", "Imports for QML will be installed to \n(default PREFIX/imports)"); + desc( "-archdatadir ", "Architecture-dependent data used by Qt will be installed to \n(default PREFIX)"); + desc( "-plugindir ", "Plugins will be installed to \n(default ARCHDATADIR/plugins)"); + desc( "-importdir ", "Imports for QML1 will be installed to \n(default ARCHDATADIR/imports)"); desc( "-datadir ", "Data used by Qt programs will be installed to \n(default PREFIX)"); - desc( "-translationdir ", "Translations of Qt programs will be installed to \n(default PREFIX/translations)"); + desc( "-docdir ", "Documentation will be installed to \n(default DATADIR/doc)"); + desc( "-translationdir ", "Translations of Qt programs will be installed to \n(default DATADIR/translations)"); desc( "-examplesdir ", "Examples will be installed to \n(default PREFIX/examples)"); desc( "-testsdir ", "Tests will be installed to \n(default PREFIX/tests)\n"); @@ -3387,11 +3395,12 @@ void Configure::displayConfig() sout << "Install prefix.............." << QDir::toNativeSeparators(dictionary["QT_INSTALL_PREFIX"]) << endl; sout << "Headers installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_HEADERS"]) << endl; sout << "Libraries installed to......" << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBS"]) << endl; + sout << "Arch-dep. data to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_ARCHDATA"]) << endl; sout << "Plugins installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << endl; sout << "Imports installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << endl; sout << "Binaries installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_BINS"]) << endl; + sout << "Arch-indep. data to........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DATA"]) << endl; sout << "Docs installed to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DOCS"]) << endl; - sout << "Data installed to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DATA"]) << endl; sout << "Translations installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << endl; sout << "Examples installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << endl; sout << "Tests installed to.........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_TESTS"]) << endl; @@ -3512,22 +3521,24 @@ void Configure::generateQConfigCpp() if (dictionary["QT_INSTALL_PREFIX"].isEmpty()) qipempty = true; - if (!dictionary["QT_INSTALL_DOCS"].size()) - dictionary["QT_INSTALL_DOCS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/doc"; if (!dictionary["QT_INSTALL_HEADERS"].size()) dictionary["QT_INSTALL_HEADERS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/include"; if (!dictionary["QT_INSTALL_LIBS"].size()) dictionary["QT_INSTALL_LIBS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/lib"; + if (!dictionary["QT_INSTALL_ARCHDATA"].size()) + dictionary["QT_INSTALL_ARCHDATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"]; if (!dictionary["QT_INSTALL_BINS"].size()) dictionary["QT_INSTALL_BINS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/bin"; if (!dictionary["QT_INSTALL_PLUGINS"].size()) - dictionary["QT_INSTALL_PLUGINS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/plugins"; + dictionary["QT_INSTALL_PLUGINS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/plugins"; if (!dictionary["QT_INSTALL_IMPORTS"].size()) - dictionary["QT_INSTALL_IMPORTS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/imports"; + dictionary["QT_INSTALL_IMPORTS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/imports"; if (!dictionary["QT_INSTALL_DATA"].size()) dictionary["QT_INSTALL_DATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"]; + if (!dictionary["QT_INSTALL_DOCS"].size()) + dictionary["QT_INSTALL_DOCS"] = qipempty ? "" : dictionary["QT_INSTALL_DATA"] + "/doc"; if (!dictionary["QT_INSTALL_TRANSLATIONS"].size()) - dictionary["QT_INSTALL_TRANSLATIONS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/translations"; + dictionary["QT_INSTALL_TRANSLATIONS"] = qipempty ? "" : dictionary["QT_INSTALL_DATA"] + "/translations"; if (!dictionary["QT_INSTALL_EXAMPLES"].size()) dictionary["QT_INSTALL_EXAMPLES"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/examples"; if (!dictionary["QT_INSTALL_TESTS"].size()) @@ -3541,7 +3552,7 @@ void Configure::generateQConfigCpp() if (dictionary["QT_HOST_BINS"].isEmpty()) dictionary["QT_HOST_BINS"] = haveHpx ? dictionary["QT_HOST_PREFIX"] + "/bin" : dictionary["QT_INSTALL_BINS"]; if (dictionary["QT_HOST_DATA"].isEmpty()) - dictionary["QT_HOST_DATA"] = haveHpx ? dictionary["QT_HOST_PREFIX"] : dictionary["QT_INSTALL_DATA"]; + dictionary["QT_HOST_DATA"] = haveHpx ? dictionary["QT_HOST_PREFIX"] : dictionary["QT_INSTALL_ARCHDATA"]; // Generate the new qconfig.cpp file QDir(buildPath).mkpath("src/corelib/global"); @@ -3569,6 +3580,7 @@ void Configure::generateQConfigCpp() << " \"qt_binspath=" << formatPath(dictionary["QT_INSTALL_BINS"]) << "\"," << endl << " \"qt_plugpath=" << formatPath(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl << " \"qt_impspath=" << formatPath(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl + << " \"qt_adatpath=" << formatPath(dictionary["QT_INSTALL_ARCHDATA"]) << "\"," << endl << " \"qt_datapath=" << formatPath(dictionary["QT_INSTALL_DATA"]) << "\"," << endl << " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl << " \"qt_xmplpath=" << formatPath(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl