add configure -extprefix option
this adds the possibility to put the actual qt installation outside the sysroot it is configured for. this makes it possible to install an x-built qt without "polluting" the sysroot, which makes it possible to have read-only sysroots, and multiple qt builds for one sysroot. -prefix is the location within the sysroot as seen by the target itself, and gets "burned" into QLibraryInfo in QtCore. -extprefix is the location in the host file system and gets "burned" into QLibraryInfo in qmake. if it is not specified, it defaults to the sysrootified prefix, which is the previous behavior. Task-number: QTBUG-26680 Change-Id: Ia43833c4e27733159afeb8c8b9b2d981378d0cd1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
3e283402e1
commit
a6eb28d3f6
80
configure
vendored
80
configure
vendored
@ -384,6 +384,16 @@ filterLibraryOptions()
|
||||
filterPathOptions -L "$DEFAULT_LIBDIRS"
|
||||
}
|
||||
|
||||
substPrefix()
|
||||
{
|
||||
base=${1#$QT_SYSROOT_PREFIX}
|
||||
if [ x"$base" != x"$1" ]; then
|
||||
echo "$QT_EXT_PREFIX$base"
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# device options
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -1014,6 +1024,7 @@ QT_HOST_PREFIX=
|
||||
QT_HOST_BINS=
|
||||
QT_HOST_LIBS=
|
||||
QT_HOST_DATA=
|
||||
QT_EXT_PREFIX=
|
||||
|
||||
#flags for SQL drivers
|
||||
QT_CFLAGS_PSQL=
|
||||
@ -1139,6 +1150,7 @@ while [ "$#" -gt 0 ]; do
|
||||
-hostdatadir| \
|
||||
-hostbindir| \
|
||||
-hostlibdir| \
|
||||
-extprefix| \
|
||||
-sysroot| \
|
||||
-depths| \
|
||||
-make| \
|
||||
@ -1347,6 +1359,9 @@ while [ "$#" -gt 0 ]; do
|
||||
hostlibdir)
|
||||
QT_HOST_LIBS="$VAL"
|
||||
;;
|
||||
extprefix)
|
||||
QT_EXT_PREFIX="$VAL"
|
||||
;;
|
||||
pkg-config)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_PKGCONFIG="$VAL"
|
||||
@ -3174,6 +3189,39 @@ if [ -z "$QT_INSTALL_TESTS" ]; then #default
|
||||
fi
|
||||
QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
|
||||
|
||||
#------- sysroot-external install paths --------
|
||||
|
||||
QT_SYSROOT_PREFIX=$QT_INSTALL_PREFIX
|
||||
QT_SYSROOT_DOCS=$QT_INSTALL_DOCS
|
||||
QT_SYSROOT_HEADERS=$QT_INSTALL_HEADERS
|
||||
QT_SYSROOT_LIBS=$QT_INSTALL_LIBS
|
||||
QT_SYSROOT_LIBEXECS=$QT_INSTALL_LIBEXECS
|
||||
QT_SYSROOT_BINS=$QT_INSTALL_BINS
|
||||
QT_SYSROOT_PLUGINS=$QT_INSTALL_PLUGINS
|
||||
QT_SYSROOT_IMPORTS=$QT_INSTALL_IMPORTS
|
||||
QT_SYSROOT_QML=$QT_INSTALL_QML
|
||||
QT_SYSROOT_ARCHDATA=$QT_INSTALL_ARCHDATA
|
||||
QT_SYSROOT_DATA=$QT_INSTALL_DATA
|
||||
QT_SYSROOT_TRANSLATIONS=$QT_INSTALL_TRANSLATIONS
|
||||
QT_SYSROOT_EXAMPLES=$QT_INSTALL_EXAMPLES
|
||||
QT_SYSROOT_TESTS=$QT_INSTALL_TESTS
|
||||
if [ -n "$QT_EXT_PREFIX" ]; then
|
||||
QT_INSTALL_PREFIX=$QT_EXT_PREFIX
|
||||
QT_INSTALL_DOCS=`substPrefix "$QT_INSTALL_DOCS"`
|
||||
QT_INSTALL_HEADERS=`substPrefix "$QT_INSTALL_HEADERS"`
|
||||
QT_INSTALL_LIBS=`substPrefix "$QT_INSTALL_LIBS"`
|
||||
QT_INSTALL_LIBEXECS=`substPrefix "$QT_INSTALL_LIBEXECS"`
|
||||
QT_INSTALL_BINS=`substPrefix "$QT_INSTALL_BINS"`
|
||||
QT_INSTALL_PLUGINS=`substPrefix "$QT_INSTALL_PLUGINS"`
|
||||
QT_INSTALL_IMPORTS=`substPrefix "$QT_INSTALL_IMPORTS"`
|
||||
QT_INSTALL_QML=`substPrefix "$QT_INSTALL_QML"`
|
||||
QT_INSTALL_ARCHDATA=`substPrefix "$QT_INSTALL_ARCHDATA"`
|
||||
QT_INSTALL_DATA=`substPrefix "$QT_INSTALL_DATA"`
|
||||
QT_INSTALL_TRANSLATIONS=`substPrefix "$QT_INSTALL_TRANSLATIONS"`
|
||||
QT_INSTALL_EXAMPLES=`substPrefix "$QT_INSTALL_EXAMPLES"`
|
||||
QT_INSTALL_TESTS=`substPrefix "$QT_INSTALL_TESTS"`
|
||||
fi
|
||||
|
||||
#------- host paths --------
|
||||
|
||||
if [ -z "$QT_HOST_PREFIX" ]; then
|
||||
@ -3341,10 +3389,13 @@ Installation options:
|
||||
-prefix <dir> ...... This will install everything relative to <dir>
|
||||
(default $QT_INSTALL_PREFIX)
|
||||
|
||||
-extprefix <dir> ... When -sysroot is used, install everything to <dir>,
|
||||
rather than into SYSROOT/PREFIX.
|
||||
|
||||
-hostprefix [dir] .. Tools and libraries needed when developing
|
||||
applications are installed in [dir]. If [dir] is
|
||||
not given, the current build directory will be used.
|
||||
(default PREFIX)
|
||||
(default EXTPREFIX)
|
||||
|
||||
You may use these to separate different parts of the install:
|
||||
|
||||
@ -3869,6 +3920,12 @@ esac
|
||||
shortxspec=`echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
|
||||
shortspec=`echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
|
||||
|
||||
if [ -z "$QT_EXT_PREFIX" ]; then
|
||||
QMAKE_SYSROOTIFY=y
|
||||
else
|
||||
QMAKE_SYSROOTIFY=n
|
||||
fi
|
||||
|
||||
cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
|
||||
/* License Info */
|
||||
static const char qt_configure_licensee_str [256 + 12] = "qt_lcnsuser=$Licensee";
|
||||
@ -3879,6 +3936,22 @@ static const char qt_configure_installation [12+11] = "qt_instdate=`
|
||||
|
||||
/* Installation Info */
|
||||
static const char qt_configure_prefix_path_strs[][256 + 12] = {
|
||||
#ifndef QT_BUILD_QMAKE
|
||||
"qt_prfxpath=$QT_SYSROOT_PREFIX",
|
||||
"qt_docspath=$QT_SYSROOT_DOCS",
|
||||
"qt_hdrspath=$QT_SYSROOT_HEADERS",
|
||||
"qt_libspath=$QT_SYSROOT_LIBS",
|
||||
"qt_lbexpath=$QT_SYSROOT_LIBEXECS",
|
||||
"qt_binspath=$QT_SYSROOT_BINS",
|
||||
"qt_plugpath=$QT_SYSROOT_PLUGINS",
|
||||
"qt_impspath=$QT_SYSROOT_IMPORTS",
|
||||
"qt_qml2path=$QT_SYSROOT_QML",
|
||||
"qt_adatpath=$QT_SYSROOT_ARCHDATA",
|
||||
"qt_datapath=$QT_SYSROOT_DATA",
|
||||
"qt_trnspath=$QT_SYSROOT_TRANSLATIONS",
|
||||
"qt_xmplpath=$QT_SYSROOT_EXAMPLES",
|
||||
"qt_tstspath=$QT_SYSROOT_TESTS",
|
||||
#else
|
||||
"qt_prfxpath=$QT_INSTALL_PREFIX",
|
||||
"qt_docspath=$QT_INSTALL_DOCS",
|
||||
"qt_hdrspath=$QT_INSTALL_HEADERS",
|
||||
@ -3893,7 +3966,6 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
|
||||
"qt_trnspath=$QT_INSTALL_TRANSLATIONS",
|
||||
"qt_xmplpath=$QT_INSTALL_EXAMPLES",
|
||||
"qt_tstspath=$QT_INSTALL_TESTS",
|
||||
#ifdef QT_BUILD_QMAKE
|
||||
"qt_ssrtpath=$CFG_SYSROOT",
|
||||
"qt_hpfxpath=$QT_HOST_PREFIX",
|
||||
"qt_hbinpath=$QT_HOST_BINS",
|
||||
@ -3904,6 +3976,10 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
|
||||
#endif
|
||||
};
|
||||
static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
|
||||
|
||||
#ifdef QT_BUILD_QMAKE
|
||||
static const char qt_sysrootify_prefix[] = "qt_ssrtfpfx=$QMAKE_SYSROOTIFY";
|
||||
#endif
|
||||
EOF
|
||||
|
||||
cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
|
||||
|
@ -309,7 +309,7 @@ QLibraryInfo::location(LibraryLocation loc)
|
||||
QString ret = rawLocation(loc, FinalPaths);
|
||||
|
||||
// Automatically prepend the sysroot to target paths
|
||||
if (loc < SysrootPath || loc > LastHostPath) {
|
||||
if ((loc < SysrootPath || loc > LastHostPath) && qt_sysrootify_prefix[12] == 'y') {
|
||||
QString sysroot = rawLocation(SysrootPath, FinalPaths);
|
||||
if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
|
||||
&& (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
|
||||
|
@ -1165,6 +1165,13 @@ void Configure::parseCmdLine()
|
||||
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)
|
||||
@ -1649,8 +1656,10 @@ bool Configure::displayHelp()
|
||||
|
||||
desc( "-prefix <dir>", "This will install everything relative to <dir> (default $QT_INSTALL_PREFIX)\n");
|
||||
|
||||
desc( "-extprefix <dir>", "When -sysroot is used, install everything to <dir>, rather than into SYSROOT/PREFIX.\n");
|
||||
|
||||
desc( "-hostprefix [dir]", "Tools and libraries needed when developing applications are installed in [dir]. "
|
||||
"If [dir] is not given, the current build directory will be used. (default PREFIX)\n");
|
||||
"If [dir] is not given, the current build directory will be used. (default EXTPREFIX)\n");
|
||||
|
||||
desc("You may use these to separate different parts of the install:\n\n");
|
||||
|
||||
@ -3623,6 +3632,13 @@ static QString stripPrefix(const QString &str, const QString &pfx)
|
||||
return str.startsWith(pfx) ? str.mid(pfx.length()) : str;
|
||||
}
|
||||
|
||||
void Configure::substPrefix(QString *path)
|
||||
{
|
||||
QString spfx = dictionary["QT_SYSROOT_PREFIX"];
|
||||
if (path->startsWith(spfx))
|
||||
path->replace(0, spfx.size(), dictionary["QT_EXT_PREFIX"]);
|
||||
}
|
||||
|
||||
void Configure::generateQConfigCpp()
|
||||
{
|
||||
// if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
|
||||
@ -3662,6 +3678,39 @@ void Configure::generateQConfigCpp()
|
||||
if (!dictionary["QT_INSTALL_TESTS"].size())
|
||||
dictionary["QT_INSTALL_TESTS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/tests";
|
||||
|
||||
QChar sysrootifyPrefix = QLatin1Char('y');
|
||||
dictionary["QT_SYSROOT_PREFIX"] = dictionary["QT_INSTALL_PREFIX"];
|
||||
dictionary["QT_SYSROOT_HEADERS"] = dictionary["QT_INSTALL_HEADERS"];
|
||||
dictionary["QT_SYSROOT_LIBS"] = dictionary["QT_INSTALL_LIBS"];
|
||||
dictionary["QT_SYSROOT_ARCHDATA"] = dictionary["QT_INSTALL_ARCHDATA"];
|
||||
dictionary["QT_SYSROOT_LIBEXECS"] = dictionary["QT_INSTALL_LIBEXECS"];
|
||||
dictionary["QT_SYSROOT_BINS"] = dictionary["QT_INSTALL_BINS"];
|
||||
dictionary["QT_SYSROOT_PLUGINS"] = dictionary["QT_INSTALL_PLUGINS"];
|
||||
dictionary["QT_SYSROOT_IMPORTS"] = dictionary["QT_INSTALL_IMPORTS"];
|
||||
dictionary["QT_SYSROOT_QML"] = dictionary["QT_INSTALL_QML"];
|
||||
dictionary["QT_SYSROOT_DATA"] = dictionary["QT_INSTALL_DATA"];
|
||||
dictionary["QT_SYSROOT_DOCS"] = dictionary["QT_INSTALL_DOCS"];
|
||||
dictionary["QT_SYSROOT_TRANSLATIONS"] = dictionary["QT_INSTALL_TRANSLATIONS"];
|
||||
dictionary["QT_SYSROOT_EXAMPLES"] = dictionary["QT_INSTALL_EXAMPLES"];
|
||||
dictionary["QT_SYSROOT_TESTS"] = dictionary["QT_INSTALL_TESTS"];
|
||||
if (dictionary["QT_EXT_PREFIX"].size()) {
|
||||
sysrootifyPrefix = QLatin1Char('n');
|
||||
dictionary["QT_INSTALL_PREFIX"] = dictionary["QT_EXT_PREFIX"];
|
||||
substPrefix(&dictionary["QT_INSTALL_HEADERS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_LIBS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_ARCHDATA"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_LIBEXECS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_BINS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_PLUGINS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_IMPORTS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_QML"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_DATA"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_DOCS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_TRANSLATIONS"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_EXAMPLES"]);
|
||||
substPrefix(&dictionary["QT_INSTALL_TESTS"]);
|
||||
}
|
||||
|
||||
bool haveHpx = false;
|
||||
if (dictionary["QT_HOST_PREFIX"].isEmpty())
|
||||
dictionary["QT_HOST_PREFIX"] = dictionary["QT_INSTALL_PREFIX"];
|
||||
@ -3689,6 +3738,22 @@ void Configure::generateQConfigCpp()
|
||||
<< "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
|
||||
<< endl
|
||||
<< "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
|
||||
<< "#ifndef QT_BUILD_QMAKE" << endl
|
||||
<< " \"qt_prfxpath=" << formatPath(dictionary["QT_SYSROOT_PREFIX"]) << "\"," << endl
|
||||
<< " \"qt_docspath=" << formatPath(dictionary["QT_SYSROOT_DOCS"]) << "\"," << endl
|
||||
<< " \"qt_hdrspath=" << formatPath(dictionary["QT_SYSROOT_HEADERS"]) << "\"," << endl
|
||||
<< " \"qt_libspath=" << formatPath(dictionary["QT_SYSROOT_LIBS"]) << "\"," << endl
|
||||
<< " \"qt_lbexpath=" << formatPath(dictionary["QT_SYSROOT_LIBEXECS"]) << "\"," << endl
|
||||
<< " \"qt_binspath=" << formatPath(dictionary["QT_SYSROOT_BINS"]) << "\"," << endl
|
||||
<< " \"qt_plugpath=" << formatPath(dictionary["QT_SYSROOT_PLUGINS"]) << "\"," << endl
|
||||
<< " \"qt_impspath=" << formatPath(dictionary["QT_SYSROOT_IMPORTS"]) << "\"," << endl
|
||||
<< " \"qt_qml2path=" << formatPath(dictionary["QT_SYSROOT_QML"]) << "\"," << endl
|
||||
<< " \"qt_adatpath=" << formatPath(dictionary["QT_SYSROOT_ARCHDATA"]) << "\"," << endl
|
||||
<< " \"qt_datapath=" << formatPath(dictionary["QT_SYSROOT_DATA"]) << "\"," << endl
|
||||
<< " \"qt_trnspath=" << formatPath(dictionary["QT_SYSROOT_TRANSLATIONS"]) << "\"," << endl
|
||||
<< " \"qt_xmplpath=" << formatPath(dictionary["QT_SYSROOT_EXAMPLES"]) << "\"," << endl
|
||||
<< " \"qt_tstspath=" << formatPath(dictionary["QT_SYSROOT_TESTS"]) << "\"," << endl
|
||||
<< "#else" << endl
|
||||
<< " \"qt_prfxpath=" << formatPath(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl
|
||||
<< " \"qt_docspath=" << formatPath(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl
|
||||
<< " \"qt_hdrspath=" << formatPath(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl
|
||||
@ -3703,7 +3768,6 @@ void Configure::generateQConfigCpp()
|
||||
<< " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl
|
||||
<< " \"qt_xmplpath=" << formatPath(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl
|
||||
<< " \"qt_tstspath=" << formatPath(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl
|
||||
<< "#ifdef QT_BUILD_QMAKE" << endl
|
||||
<< " \"qt_ssrtpath=" << formatPath(dictionary["CFG_SYSROOT"]) << "\"," << endl
|
||||
<< " \"qt_hpfxpath=" << formatPath(dictionary["QT_HOST_PREFIX"]) << "\"," << endl
|
||||
<< " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
|
||||
@ -3718,6 +3782,9 @@ void Configure::generateQConfigCpp()
|
||||
tmpStream << "static const char qt_configure_settings_path_str [256 + 12] = \"qt_stngpath=" << formatPath(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl;
|
||||
|
||||
tmpStream << endl
|
||||
<< "#ifdef QT_BUILD_QMAKE\n"
|
||||
<< "static const char qt_sysrootify_prefix[] = \"qt_ssrtfpfx=" << sysrootifyPrefix << "\";\n"
|
||||
<< "#endif\n\n"
|
||||
<< "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
|
||||
<< "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
|
||||
<< "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl;
|
||||
|
@ -158,6 +158,8 @@ private:
|
||||
int descIndent;
|
||||
int outputWidth;
|
||||
|
||||
void substPrefix(QString *path);
|
||||
|
||||
QString formatPath(const QString &path);
|
||||
QString formatPaths(const QStringList &paths);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user