summaryrefslogtreecommitdiff
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp5
-rw-r--r--qmake/generators/unix/unixmake.cpp2
-rw-r--r--qmake/generators/win32/winmakefile.cpp1
-rw-r--r--qmake/main.cpp15
4 files changed, 19 insertions, 4 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index b97dc7128a..4568f1d4f2 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1292,7 +1292,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
if (fi.isDir())
cmd = "-$(INSTALL_DIR)";
else if (is_target || fi.isExecutable())
- cmd = "-$(INSTALL_PROGRAM)";
+ cmd = "-$(QINSTALL_PROGRAM)";
else
cmd = "-$(QINSTALL_FILE)";
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
@@ -1318,7 +1318,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += filestr;
}
} else if (installConfigValues.contains("executable")) {
- cmd = QLatin1String("-$(INSTALL_PROGRAM)");
+ cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
} else {
cmd = QLatin1String("-$(QINSTALL_FILE)");
}
@@ -2249,6 +2249,7 @@ MakefileGenerator::writeDefaultVariables(QTextStream &t)
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
t << "QINSTALL_FILE = " << var("QMAKE_QMAKE") << " -install qinstall file" << endl;
+ t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall program" << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 0f5e6dc8c0..b485a7ec84 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -629,7 +629,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
ret += "\n\t";
ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false);
}
- copy_cmd += "-$(INSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
+ copy_cmd += "-$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
}
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
&& project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) {
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index b6dd734bc2..86d388354a 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -531,6 +531,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
t << "QINSTALL_FILE = " << var("QMAKE_QMAKE") << " -install qinstall file" << endl;
+ t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall program" << endl;
t << endl;
t << "####### Output directory\n\n";
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 0b0b5ff128..2bdb5370df 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -236,7 +236,7 @@ static int doLink(int argc, char **argv)
#endif
-static int installFile(const QString &source, const QString &targetFileOrDirectory)
+static int installFile(const QString &source, const QString &targetFileOrDirectory, bool exe = false)
{
QFile sourceFile(source);
@@ -253,6 +253,17 @@ static int installFile(const QString &source, const QString &targetFileOrDirecto
fprintf(stderr, "Error copying %s to %s: %s\n", source.toLatin1().constData(), qPrintable(target), qPrintable(sourceFile.errorString()));
return 3;
}
+
+ if (exe) {
+ QFile targetFile(target);
+ if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |
+ QFileDevice::ExeGroup | QFileDevice::ExeOther)) {
+ fprintf(stderr, "Error setting execute permissions on %s: %s\n",
+ qPrintable(target), qPrintable(targetFile.errorString()));
+ return 3;
+ }
+ }
+
// Copy file times
QString error;
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
@@ -274,6 +285,8 @@ static int doQInstall(int argc, char **argv)
if (!strcmp(argv[0], "file"))
return installFile(source, target);
+ if (!strcmp(argv[0], "program"))
+ return installFile(source, target, /*exe=*/true);
fprintf(stderr, "Error: Unsupported qinstall command type %s\n", argv[0]);
return 3;