Skip to content

Commit

Permalink
Add option -runtime
Browse files Browse the repository at this point in the history
Using the -runtime option to specify the runtime file path is more friendly to developers in offline development environments and poor network environments.
  • Loading branch information
mahuifa committed Dec 13, 2024
1 parent 0448055 commit f5ee17f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Options:
-verbose=<0-3> : 0 = no output, 1 = error/warning (default),
2 = normal, 3 = debug.
-updateinformation=<update string> : Embed update information STRING; if zsyncmake is installed, generate zsync file
-qtlibinfix=<infix> : Adapt the .so search if your Qt distribution has infix.
-runtime==<path> : Runtime file to use. (-runtime=<path>/runtime)
-version : Print version statement and exit.
linuxdeployqt takes an application as input and makes it
Expand Down
8 changes: 7 additions & 1 deletion tools/linuxdeployqt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ int main(int argc, char **argv)
extern bool copyCopyrightFiles;
extern QString updateInformation;
extern QString qtLibInfix;
extern QString runtime;

// Check arguments
// Due to the structure of the argument parser, we have to check all arguments at first to check whether the user
Expand Down Expand Up @@ -186,7 +187,11 @@ int main(int argc, char **argv)
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
qtLibInfix = QString(argument.mid(index+1));
} else if (argument.startsWith("--")) {
} else if (argument.startsWith("-runtime=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
runtime = QString(argument.mid(index+1));
}else if (argument.startsWith("--")) {
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
return 1;
} else {
Expand Down Expand Up @@ -252,6 +257,7 @@ int main(int argc, char **argv)
qInfo() << " 2 = normal, 3 = debug.";
qInfo() << " -updateinformation=<update string> : Embed update information STRING; if zsyncmake is installed, generate zsync file";
qInfo() << " -qtlibinfix=<infix> : Adapt the .so search if your Qt distribution has infix.";
qInfo() << " -runtime==<path> : Runtime file to use. (-runtime=<path>/runtime)";
qInfo() << " -version : Print version statement and exit.";
qInfo() << "";
qInfo() << "linuxdeployqt takes an application as input and makes it";
Expand Down
9 changes: 8 additions & 1 deletion tools/linuxdeployqt/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ QStringList ignoreGlob;
bool copyCopyrightFiles = true;
QString updateInformation;
QString qtLibInfix;
QString runtime;

using std::cout;
using std::endl;
Expand Down Expand Up @@ -1977,6 +1978,7 @@ bool checkAppImagePrerequisites(const QString &appDirPath)
out << "Icon=default\n";
out << "Comment=Edit this default file\n";
out << "Terminal=true\n";
out << "# Categories=Development\n";
file.close();
}

Expand Down Expand Up @@ -2006,7 +2008,12 @@ int createAppImage(const QString &appDirPath)
updateInfoArgument = QString("-u '%1'").arg(updateInformation);
}

QString appImageCommand = "appimagetool -v '" + appDirPath + "' -n " + updateInfoArgument; // +"' '" + appImagePath + "'";
QString runtimeArgument;
if(!runtime.isEmpty()) {
runtimeArgument = QString(" --runtime-file %1").arg(runtime);
}

QString appImageCommand = "appimagetool -v '" + appDirPath + "' -n " + updateInfoArgument + runtimeArgument; // +"' '" + appImagePath + "'";
LogNormal() << appImageCommand;
int ret = system(appImageCommand.toUtf8().constData());
LogNormal() << "ret" << ret;
Expand Down

0 comments on commit f5ee17f

Please sign in to comment.