Skip to content

Commit

Permalink
fix location of config.{opt,status} in top-level builds
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
ossilator committed Aug 25, 2016
1 parent d76a756 commit 1967fc7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
36 changes: 19 additions & 17 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -1917,17 +1925,11 @@ fi
# build makefiles based on the configuration
#-------------------------------------------------------------------------------

( # fork to make the cd stay local

relpathMangled=$relpath
if [ -n "$CFG_TOPLEVEL" ]; then
relpathMangled=`dirname "$relpath"`
cd ..
fi

"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled"
if [ -n "$CFG_TOPLEVEL" ]; then
cd ..
fi

) || exit
"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" || exit

#-------------------------------------------------------------------------------
# finally save the executed command to another script
Expand All @@ -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
Expand Down
23 changes: 12 additions & 11 deletions tools/configure/configureapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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())
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions tools/configure/configureapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Configure

QTextStream outStream;
QString sourcePath, buildPath;
QString sourcePathMangled, buildPathMangled;
QDir sourceDir, buildDir;

QString confStrOffsets[2];
Expand Down

0 comments on commit 1967fc7

Please sign in to comment.