fix location of config.{opt,status} in top-level builds

write them to the top-level build dir, not the qtbase build dir.
the old files will be still used for a smooth migration.

Task-number: QTBUG-46974
Change-Id: I6eae678ffc7dfb921ecd9e9012e79e3b915ad3fa
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-08-23 20:03:50 +02:00
parent d76a756b03
commit 1967fc7f63
3 changed files with 32 additions and 28 deletions

36
configure vendored
View File

@ -75,8 +75,12 @@ fi
# do this early so we don't store it in config.status
CFG_TOPLEVEL=
relpathMangled=$relpath
outpathPrefix=
if [ x"$1" = x"-top-level" ]; then
CFG_TOPLEVEL=yes
relpathMangled=`dirname "$relpath"`
outpathPrefix=../
shift
fi
@ -90,11 +94,15 @@ IFS='
for i in "$@"; do
case $i in
-redo|--redo)
if ! test -f config.opt; then
optfile=${outpathPrefix}config.opt
if test -n "$CFG_TOPLEVEL" && ! test -f $optfile; then
optfile=config.opt
fi
if ! test -f $optfile; then
echo >&2 "No config.opt present - cannot redo configuration."
exit 1
fi
for a in `cat config.opt`; do
for a in `cat $optfile`; do
OPT_CMDLINE="$OPT_CMDLINE
$a"
QMAKE_CMDLINE="$QMAKE_CMDLINE
@ -1917,17 +1925,11 @@ fi
# build makefiles based on the configuration
#-------------------------------------------------------------------------------
( # fork to make the cd stay local
if [ -n "$CFG_TOPLEVEL" ]; then
cd ..
fi
relpathMangled=$relpath
if [ -n "$CFG_TOPLEVEL" ]; then
relpathMangled=`dirname "$relpath"`
cd ..
fi
"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled"
) || exit
"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" || exit
#-------------------------------------------------------------------------------
# finally save the executed command to another script
@ -1937,12 +1939,12 @@ if [ $CFG_REDO = no ]; then
-confirm-license"
# skip first line, as it's always empty due to unconditional field separation
echo "$OPT_CMDLINE" | tail -n +2 > "$outpath/config.opt"
echo "$OPT_CMDLINE" | tail -n +2 > config.opt
[ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
echo "#!/bin/sh" > "$outpath/config.status"
echo "$relpath/$relconf -redo \"\$@\"" >> "$outpath/config.status"
chmod +x "$outpath/config.status"
[ -f "config.status" ] && rm -f config.status
echo "#!/bin/sh" > config.status
echo "$relpathMangled/$relconf -redo \"\$@\"" >> config.status
chmod +x config.status
fi
if [ -n "$PREFIX_COMPLAINTS" ]; then

View File

@ -184,9 +184,13 @@ QString Configure::formatPath(const QString &path)
void Configure::parseCmdLine()
{
sourcePathMangled = sourcePath;
buildPathMangled = buildPath;
if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") {
dictionary[ "TOPLEVEL" ] = "yes";
configCmdLine.removeAt(0);
sourcePathMangled = QFileInfo(sourcePath).path();
buildPathMangled = QFileInfo(buildPath).path();
}
int argCount = configCmdLine.size();
@ -1025,12 +1029,6 @@ void Configure::generateMakefiles()
{
QString pwd = QDir::currentPath();
{
QString sourcePathMangled = sourcePath;
QString buildPathMangled = buildPath;
if (dictionary.contains("TOPLEVEL")) {
sourcePathMangled = QFileInfo(sourcePath).path();
buildPathMangled = QFileInfo(buildPath).path();
}
QStringList args;
args << buildPath + "/bin/qmake" << sourcePathMangled;
@ -1180,11 +1178,14 @@ void Configure::readLicense()
void Configure::reloadCmdLine(int idx)
{
if (dictionary[ "REDO" ] == "yes") {
QFile inFile(buildPath + "/config.opt");
QFile inFile(buildPathMangled + "/config.opt");
if (!inFile.open(QFile::ReadOnly)) {
inFile.setFileName(buildPath + "/configure.cache");
if (!inFile.open(QFile::ReadOnly))
return;
inFile.setFileName(buildPath + "/config.opt");
if (!inFile.open(QFile::ReadOnly)) {
inFile.setFileName(buildPath + "/configure.cache");
if (!inFile.open(QFile::ReadOnly))
return;
}
}
QTextStream inStream(&inFile);
while (!inStream.atEnd())
@ -1195,7 +1196,7 @@ void Configure::reloadCmdLine(int idx)
void Configure::saveCmdLine()
{
if (dictionary[ "REDO" ] != "yes") {
QFile outFile(buildPath + "/config.opt");
QFile outFile(buildPathMangled + "/config.opt");
if (outFile.open(QFile::WriteOnly | QFile::Text)) {
QTextStream outStream(&outFile);
for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {

View File

@ -75,6 +75,7 @@ private:
QTextStream outStream;
QString sourcePath, buildPath;
QString sourcePathMangled, buildPathMangled;
QDir sourceDir, buildDir;
QString confStrOffsets[2];