Martin Höher 7 years ago
parent
commit
2cafb878a6
  1. 5
      .qmake.conf
  2. 12
      BUILDING.md
  3. 76
      README.md
  4. 3
      linuxdeployqt.pro
  5. 2
      linuxdeployqt/linuxdeployqt.pro
  6. 1
      src/src.pro
  7. 5
      sync.profile
  8. 4
      tests/tests-ci.sh
  9. 11
      tests/tests.pro
  10. 17
      tools/linuxdeployqt/linuxdeployqt.pro
  11. 9
      tools/linuxdeployqt/main.cpp
  12. 137
      tools/linuxdeployqt/shared.cpp
  13. 0
      tools/linuxdeployqt/shared.h
  14. 4
      tools/tools.pro

5
.qmake.conf

@ -0,0 +1,5 @@
load(qt_build_config)
CONFIG += warning_clean exceptions
MODULE_VERSION = 0.5.0

12
BUILDING.md

@ -1,8 +1,8 @@
# Building from source
If you just would like to bundle your application, it is normally not necessary that you build `linuxdeployqt` yourself. Instead, download __linuxdeployqt-x86_64.AppImage__ from the [Releases](https://github.com/probonopd/linuxdeployqt/releases) page and `chmod a+x` it. This bundle, by the way, has been generated using `linuxdeployqt` itself as part of our Travis CI continuous build pipeline.
If you just would like to bundle your application for x86_64 platforms, it is normally not necessary that you build `linuxdeployqt` yourself. Instead, download __linuxdeployqt-x86_64.AppImage__ from the [Releases](https://github.com/probonopd/linuxdeployqt/releases) page and `chmod a+x` it. This bundle, by the way, has been generated using `linuxdeployqt` itself as part of our Travis CI continuous build pipeline.
So, if you still think you would like to compile from source, here are the steps:
So, if you are on another platform (e.g. i686, ARM) or would like to compile from source, here are the steps:
* Get and build linuxdeployqt e.g., using Qt 5.7.0 (you could use this [Qt Creator AppImage](https://bintray.com/probono/AppImages/QtCreator#files) for this)
@ -12,10 +12,16 @@ git clone https://github.com/probonopd/linuxdeployqt.git
# Then build in Qt Creator, or use
export PATH=$(readlink -f /tmp/.mount_QtCreator-*-x86_64/*/gcc_64/bin/):$PATH
cd linuxdeployqt
qmake linuxdeployqt.pro
qmake
make
```
* Optional if you want to install `linuxdeployqt` into your Qt installation, and make it a part of your Qt just like any other tool (qmake, etc.)
```
sudo make install
```
* Build and install [patchelf](https://nixos.org/patchelf.html) (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to `install_name_tool` on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/
```

76
README.md

@ -1,4 +1,4 @@
# linuxdeployqt [![Build Status](https://travis-ci.org/probonopd/linuxdeployqt.svg?branch=master)](https://travis-ci.org/probonopd/linuxdeployqt) [![discourse](https://img.shields.io/badge/forum-discourse-orange.svg)](http://discourse.appimage.org/t/linuxdeployqt-new-linux-deployment-tool-for-qt/57) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/probonopd/AppImageKit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![irc](https://img.shields.io/badge/IRC-%23AppImage%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=AppImage)
# linuxdeployqt [![Build Status](https://travis-ci.org/probonopd/linuxdeployqt.svg?branch=master)](https://travis-ci.org/probonopd/linuxdeployqt) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/93b4a359057e412b8a7673b4b61d7cb7)](https://www.codacy.com/app/probonopd/linuxdeployqt?utm_source=github.com&utm_medium=referral&utm_content=probonopd/linuxdeployqt&utm_campaign=Badge_Grade) [![discourse](https://img.shields.io/badge/forum-discourse-orange.svg)](http://discourse.appimage.org/t/linuxdeployqt-new-linux-deployment-tool-for-qt/57) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/probonopd/AppImageKit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![irc](https://img.shields.io/badge/IRC-%23AppImage%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=AppImage)
This Linux Deployment Tool for Qt, `linuxdeployqt`, takes an application as input and makes it self-contained by copying in the Qt libraries and plugins that the application uses into a bundle. This can optionally be put into an [AppImage](http://appimage.org/), and, using [fpm](https://github.com/probonopd/linuxdeployqt/issues/9), into cross-distro deb and rpm packages.
@ -18,8 +18,43 @@ Please download __linuxdeployqt-x86_64.AppImage__ from the [Releases](https://gi
## Usage
```
Usage: linuxdeployqt app-binary [options]
Options:
-verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
-no-plugins : Skip plugin deployment
-appimage : Create an AppImage
-no-strip : Don't run 'strip' on the binaries
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
-executable=<path> : Let the given executable use the deployed libraries too
-qmldir=<path> : Scan for QML imports to bundle from the given directory, determined by Qt's qmlimportscanner
-always-overwrite : Copy files even if the target file exists
-qmake=<path> : The qmake executable to use
-no-translations : Skip deployment of translations
linuxdeployqt takes an application as input and makes it
self-contained by copying in the Qt libraries and plugins that
the application uses.
```
#### Simplest example
Given that a desktop file should be provided with an AppImage, `linuxdeployqt` can use that to determine the parameters of the build.
`linuxdeployqt ./path/to/appdir/usr/share/application_name.desktop`
Where the _desktop_ file specifies the executable to be run (with `EXEC=`), the name of the applications and an icon.
See [desktop file specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).
For a more detailed example, see "Using linuxdeployqt with Travis CI" below.
#### Checking library inclusion
Open in Qt Creator and build your application. Run it from the command line and inspect it with `ldd` to make sure the correct libraries from the correct locations are getting loaded, as `linuxdeployqt` will use `ldd` internally to determine from where to copy libraries into the bundle.
#### QMake configuration
__Important:__ By default, `linuxdeployqt` deploys the Qt instance that qmake on the $PATH points to, so make sure that it is the correct one. Verify that qmake finds the correct Qt instance like this before running the `linuxdeployqt` tool:
```
@ -28,9 +63,13 @@ qmake -v
QMake version 3.0
Using Qt version 5.7.0 in /tmp/.mount_QtCreator-5.7.0-x86_64/5.7/gcc_64/lib
```
If this does not show the correct path to your Qt instance that you want to be bundled, then adjust your `$PATH` to find the correct `qmake`.
Alternatively, use the `-qmake` command line option to point the tool directly to the qmake executable to be used.
#### Remove unecessary files
Before running linuxdeployqt it may be wise to delete unneeded files that you do not wish to distribute from the build directory. These may be autogenerated during the build. You can delete them like so:
```
@ -39,25 +78,6 @@ find $HOME/build-*-*_Qt_* \( -name "moc_*" -or -name "*.o" -or -name "qrc_*" -or
Alternatively, you could use `$DESTDIR`.
```
Usage: linuxdeployqt app-binary [options]
Options:
-verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
-no-plugins : Skip plugin deployment
-appimage : Create an AppImage
-no-strip : Don't run 'strip' on the binaries
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
-executable=<path> : Let the given executable use the deployed libraries too
-qmldir=<path> : Scan for QML imports in the given path
-always-overwrite : Copy files even if the target file exists
-no-translations : Skip deployment of translations
linuxdeployqt takes an application as input and makes it
self-contained by copying in the Qt libraries and plugins that
the application uses.
```
## Using linuxdeployqt with Travis CI
A common use case for `linuxdeployqt` is to use it on Travis CI after the `make` command. The following example illustrates how to use `linuxdeployqt` with Travis CI. Create a `.travis.yml` file similar to this one (be sure to customize it, e.g., change `APPNAME` to the name of your application as it is spelled in the `Name=` entry of the `.desktop` file):
@ -69,24 +89,24 @@ sudo: require
dist: trusty
before_install:
- sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
- sudo add-apt-repository ppa:beineri/opt-qt59-trusty -y
- sudo apt-get update -qq
install:
- sudo apt-get -y install qt58base
- sudo apt-get -y install qt59base
- source /opt/qt*/bin/qt*-env.sh
script:
- qmake PREFIX=/usr
- make -j$(nproc)
- make INSTALL_ROOT=appdir install ; find appdir/
after_success:
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage
after_success:
- find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
- curl --upload-file ./APPNAME*.AppImage https://transfer.sh/APPNAME-git.$(git rev-parse --short HEAD)-x86_64.AppImage
```
@ -95,8 +115,14 @@ When you save your change, then Travis CI should build and upload an AppImage fo
For this to work, you need to enable Travis CI for your repository as [described here](https://travis-ci.org/getting_started) __prior to merging this__, if you haven't already done so.
By default, qmake `.pro` files generated by Qt Creator unfortunately don't support `make install` out of the box. In this case you will get
```
make: Nothing to be done for `install'.
find: `appdir/': No such file or directory
```
Note that if `qmake` does not allow for `make install` or does not install the desktop file and icon, then change it similar to https://github.com/probonopd/FeedTheMonkey/blob/master/FeedTheMonkey.pro.
If `qmake` does not allow for `make install` or does not install the desktop file and icon, then you need to change your `.pro` file it similar to https://github.com/probonopd/FeedTheMonkey/blob/master/FeedTheMonkey.pro.
```
- make INSTALL_ROOT=appdir install ; find appdir/

3
linuxdeployqt.pro

@ -1,2 +1 @@
TEMPLATE = subdirs
SUBDIRS = linuxdeployqt
load(qt_parts)

2
linuxdeployqt/linuxdeployqt.pro

@ -1,2 +0,0 @@
QT = core
SOURCES += main.cpp ../shared/shared.cpp

1
src/src.pro

@ -0,0 +1 @@
TEMPLATE = aux

5
sync.profile

@ -0,0 +1,5 @@
%modules = (
);
%moduleheaders = (
);

4
tests/tests-ci.sh

@ -10,8 +10,8 @@ mkdir -p linuxdeployqt.AppDir/usr/bin/
cp /usr/bin/patchelf /usr/local/bin/{appimagetool,mksquashfs,zsyncmake} linuxdeployqt.AppDir/usr/bin/
find linuxdeployqt.AppDir/
export VERSION=continuous
cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/
./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
cp ./bin/linuxdeployqt linuxdeployqt.AppDir/usr/bin/
./bin/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
ls -lh
find *.AppDir
xpra start :99

11
tests/tests.pro

@ -0,0 +1,11 @@
TEMPLATE = subdirs
SUBDIRS += \
QtQuickControls2Application \
QtWebEngineApplication \
QtWidgetsApplication
DISTFILES += \
tests-ci.sh \
tests-environment.sh \
tests.sh

17
tools/linuxdeployqt/linuxdeployqt.pro

@ -0,0 +1,17 @@
option(host_build)
QT = core
CONFIG += console
TARGET = linuxdeployqt
VERSION = $$MODULE_VERSION
DEFINES += BUILD_LINUXDEPLOYQT
load(qt_tool)
HEADERS += shared.h
SOURCES += main.cpp \
shared.cpp
DEFINES -= QT_USE_QSTRINGBUILDER #leads to compile errors if not disabled

9
linuxdeployqt/main.cpp → tools/linuxdeployqt/main.cpp

@ -28,7 +28,7 @@
#include <QCoreApplication>
#include <QDir>
#include <QProcessEnvironment>
#include "../shared/shared.h"
#include "shared.h"
#include <QRegularExpression>
#include <stdlib.h>
#include <QSettings>
@ -188,7 +188,7 @@ int main(int argc, char **argv)
if (QDir().exists(appBinaryPath)) {
qDebug() << "app-binary:" << appBinaryPath;
} else {
qDebug() << "Error: Could not find app-binary" << appBinaryPath;
LogError() << "Error: Could not find app-binary" << appBinaryPath;
return 1;
}
@ -202,6 +202,11 @@ int main(int argc, char **argv)
QString relativePrefix = fhsPrefix.replace(appDirPath+"/", "");
relativeBinPath = relativePrefix + "/bin/" + appName;
}
if(appDirPath == "/"){
LogError() << "'/' is not a valid AppDir. Please refer to the documentation.";
LogError() << "Consider adding INSTALL_ROOT or DESTDIR to your install steps.";
return 1;
}
qDebug() << "appDirPath:" << appDirPath;
qDebug() << "relativeBinPath:" << relativeBinPath;

137
shared/shared.cpp → tools/linuxdeployqt/shared.cpp

@ -50,18 +50,18 @@ bool runStripEnabled = true;
bool bundleAllButCoreLibs = false;
bool fhsLikeMode = false;
QString fhsPrefix;
bool alwaysOwerwriteEnabled = false;
QStringList librarySearchPath;
bool appstoreCompliant = false;
static bool alwaysOwerwriteEnabled = false;
static QStringList librarySearchPath;
static bool appstoreCompliant = false;
int logLevel = 1;
bool qtDetected = 0;
bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may encounter "not found" messages, continue anyway
bool deployLibrary = false;
static int qtDetected = 0;
static bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may encounter "not found" messages, continue anyway
static bool deployLibrary = false;
using std::cout;
using std::endl;
QMap<QString,QString> qtToBeBundledInfo;
static QMap<QString,QString> qtToBeBundledInfo;
enum QtModule
#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_CC_MSVC)
@ -202,7 +202,7 @@ QDebug operator<<(QDebug debug, const LibraryInfo &info)
return debug;
}
QString bundleLibraryDirectory;
static QString bundleLibraryDirectory;
inline QDebug operator<<(QDebug debug, const AppDirInfo &info)
{
@ -298,6 +298,14 @@ LddInfo findDependencyInfo(const QString &binaryPath)
}
foreach (QString outputLine, outputLines) {
if(outputLine.contains("libQt5")){
qtDetected = 5;
}
if(outputLine.contains("libQtCore.so.4")){
qtDetected = 4;
}
// LogDebug() << "ldd outputLine:" << outputLine;
if ((outputLine.contains("not found")) && (qtDetectionComplete == 1)){
LogError() << "ldd outputLine:" << outputLine.replace("\t", "");
@ -374,7 +382,7 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
*/
QStringList excludelist;
excludelist << "libasound.so.2" << "libcom_err.so.2" << "libcrypt.so.1" << "libc.so.6" << "libdl.so.2" << "libdrm.so.2" << "libexpat.so.1" << "libfontconfig.so.1" << "libgcc_s.so.1" << "libgdk_pixbuf-2.0.so.0" << "libgdk-x11-2.0.so.0" << "libgio-2.0.so.0" << "libglib-2.0.so.0" << "libGL.so.1" << "libgobject-2.0.so.0" << "libgpg-error.so.0" << "libgssapi_krb5.so.2" << "libgtk-x11-2.0.so.0" << "libhcrypto.so.4" << "libhx509.so.5" << "libICE.so.6" << "libidn.so.11" << "libk5crypto.so.3" << "libkeyutils.so.1" << "libkrb5.so.26" << "libkrb5.so.3" << "libkrb5support.so.0" << "libm.so.6" << "libnss3.so" << "libnssutil3.so" << "libp11-kit.so.0" << "libpangoft2-1.0.so.0" << "libpangocairo-1.0.so.0" << "libpango-1.0.so.0" << "libpcre.so.3" << "libpthread.so.0" << "libresolv.so.2" << "libroken.so.18" << "librt.so.1" << "libselinux.so.1" << "libSM.so.6" << "libstdc++.so.6" << "libusb-1.0.so.0" << "libuuid.so.1" << "libwind.so.0" << "libX11.so.6" << "libxcb.so.1" << "libz.so.1";
excludelist << "libasound.so.2" << "libcom_err.so.2" << "libcrypt.so.1" << "libc.so.6" << "libdl.so.2" << "libdrm.so.2" << "libexpat.so.1" << "libfontconfig.so.1" << "libgcc_s.so.1" << "libgdk_pixbuf-2.0.so.0" << "libgdk-x11-2.0.so.0" << "libgio-2.0.so.0" << "libglib-2.0.so.0" << "libGL.so.1" << "libgobject-2.0.so.0" << "libgpg-error.so.0" << "libgssapi_krb5.so.2" << "libgtk-x11-2.0.so.0" << "libICE.so.6" << "libidn.so.11" << "libk5crypto.so.3" << "libkeyutils.so.1" << "libm.so.6" << "libnss3.so" << "libnssutil3.so" << "libp11-kit.so.0" << "libpangoft2-1.0.so.0" << "libpangocairo-1.0.so.0" << "libpango-1.0.so.0" << "libpthread.so.0" << "libresolv.so.2" << "librt.so.1" << "libselinux.so.1" << "libSM.so.6" << "libstdc++.so.6" << "libusb-1.0.so.0" << "libuuid.so.1" << "libX11.so.6" << "libxcb.so.1" << "libz.so.1";
LogDebug() << "excludelist:" << excludelist;
if (! trimmed.contains("libicu")) {
if (containsHowOften(excludelist, QFileInfo(trimmed).completeBaseName())) {
@ -577,53 +585,6 @@ QList<LibraryInfo> getQtLibrariesForPaths(const QStringList &paths, const QStrin
return result;
}
QStringList getBinaryDependencies(const QString executablePath,
const QString &path,
const QList<QString> &additionalBinariesContainingRpaths)
{
QStringList binaries;
const QList<DylibInfo> dependencies = findDependencyInfo(path).dependencies;
bool rpathsLoaded = false;
QSet<QString> rpaths;
// return bundle-local dependencies. (those starting with @executable_path)
foreach (const DylibInfo &info, dependencies) {
QString trimmedLine = info.binaryPath;
if (trimmedLine.startsWith("@executable_path/")) {
QString binary = QDir::cleanPath(executablePath + trimmedLine.mid(QStringLiteral("@executable_path/").length()));
if (binary != path)
binaries.append(binary);
} else if (trimmedLine.startsWith("@rpath/")) {
if (!rpathsLoaded) {
rpaths = getBinaryRPaths(path, true, executablePath);
foreach (const QString &binaryPath, additionalBinariesContainingRpaths) {
QSet<QString> binaryRpaths = getBinaryRPaths(binaryPath, true);
rpaths += binaryRpaths;
}
rpathsLoaded = true;
}
bool resolved = false;
foreach (const QString &rpath, rpaths) {
QString binary = QDir::cleanPath(rpath + "/" + trimmedLine.mid(QStringLiteral("@rpath/").length()));
LogDebug() << "Checking for" << binary;
if (QFile::exists(binary)) {
binaries.append(binary);
resolved = true;
break;
}
}
if (!resolved && !rpaths.isEmpty()) {
LogError() << "Cannot resolve rpath" << trimmedLine;
LogError() << " using" << rpaths;
}
}
}
return binaries;
}
// copies everything _inside_ sourcePath to destinationPath
bool recursiveCopy(const QString &sourcePath, const QString &destinationPath)
{
@ -717,26 +678,28 @@ QString copyDylib(const LibraryInfo &library, const QString path)
return dylibDestinationBinaryPath;
}
void runPatchelf(QStringList options)
QString runPatchelf(QStringList options)
{
QProcess patchelftool;
LogDebug() << "options:" << options;
patchelftool.start("patchelf", options);
if (!patchelftool.waitForStarted()) {
if(patchelftool.errorString().contains("execvp: No such file or directory")){
if(patchelftool.errorString().contains("No such file or directory")){
LogError() << "Could not start patchelf.";
LogError() << "Make sure it is installed on your $PATH, e.g., in /usr/local/bin.";
LogError() << "You can get it from https://nixos.org/patchelf.html.";
} else {
LogError() << "Could not start patchelftool. Process error is" << patchelftool.errorString();
LogError() << "Could not start patchelf tool. Process error is" << patchelftool.errorString();
}
exit(1);
}
patchelftool.waitForFinished();
if (patchelftool.exitCode() != 0) {
LogError() << "runPatchelf:" << patchelftool.readAllStandardError();
LogError() << "runPatchelf:" << patchelftool.readAllStandardOutput();
// LogError() << "runPatchelf:" << patchelftool.readAllStandardOutput();
// exit(1); // Do not exit because this could be a script that patchelf can't work on
}
return(patchelftool.readAllStandardOutput().trimmed());
}
bool patchQtCore(const QString &path, const QString &variable, const QString &value)
@ -789,6 +752,21 @@ bool patchQtCore(const QString &path, const QString &variable, const QString &va
void changeIdentification(const QString &id, const QString &binaryPath)
{
LogNormal() << "Checking rpath in" << binaryPath;
QString oldRpath = runPatchelf(QStringList() << "--print-rpath" << binaryPath);
LogDebug() << "oldRpath:" << oldRpath;
if (oldRpath.startsWith("/")){
LogDebug() << "Old rpath in" << binaryPath << "starts with /, hence adding it to LD_LIBRARY_PATH";
// FIXME: Split along ":" characters, check each one, only append to LD_LIBRARY_PATH if not already there
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString oldPath = env.value("LD_LIBRARY_PATH");
if (not oldPath.contains(oldRpath)){
QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path
// FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory
LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath;
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
}
}
LogNormal() << "Changing rpath in" << binaryPath << "to" << id;
runPatchelf(QStringList() << "--set-rpath" << id << binaryPath);
@ -1014,15 +992,6 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
// Find out whether Qt is a dependency of the application to be bundled
LddInfo lddInfo = findDependencyInfo(appBinaryPath);
foreach (const DylibInfo dep, lddInfo.dependencies) {
LogDebug() << "dep.binaryPath" << dep.binaryPath;
if(dep.binaryPath.contains("libQt5")){
qtDetected = 5;
}
if(dep.binaryPath.contains("libQtCore.so.4")){
qtDetected = 4;
}
}
if(qtDetected != 0){
@ -1032,21 +1001,22 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
// Use the qmake executable passed in by the user:
QString qmakePath = qmake;
// If we did not get a qmake, first try to find "qmake", which is the
// upstream name of the binary in both Qt4 and Qt5:
if (qmakePath.isEmpty()) {
qmakePath = QStandardPaths::findExecutable("qmake");
}
// But openSUSE has qmake for Qt 4 and qmake-qt5 for Qt 5
// Try to find a version specific qmake first
// openSUSE has qmake for Qt 4 and qmake-qt5 for Qt 5
// Qt 4 on Fedora comes with suffix -qt4
// http://www.geopsy.org/wiki/index.php/Installing_Qt_binary_packages
if(qmakePath.isEmpty()){
if(qtDetected == 5){
qmakePath = QStandardPaths::findExecutable("qmake-qt5");
}
if(qtDetected == 4){
LogDebug() << "qmake 5";
} else if(qtDetected == 4){
qmakePath = QStandardPaths::findExecutable("qmake-qt4");
LogDebug() << "qmake 4";
}
if(qmakePath == ""){
// The upstream name of the binary is "qmake", for Qt 4 and Qt 5
qmakePath = QStandardPaths::findExecutable("qmake");
}
}
@ -1055,6 +1025,7 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
exit(1);
}
LogNormal() << "Using qmake: " << qmakePath;
QString output = captureOutput(qmakePath + " -query");
LogDebug() << "-query output from qmake:" << output;
@ -1089,10 +1060,14 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
/* From now on let ldd exit if it doesn't find something */
qtDetectionComplete = 1;
QString libraryPath;
if(fhsLikeMode == false){
changeIdentification("$ORIGIN/lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath());
libraryPath = QFileInfo(applicationBundle.binaryPath).dir().filePath("lib/" + bundleLibraryDirectory);
} else {
changeIdentification("$ORIGIN/../lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath());
libraryPath = QFileInfo(applicationBundle.binaryPath).dir().filePath("../lib/" + bundleLibraryDirectory);
}
foreach (const QString &executable, QStringList() << applicationBundle.binaryPath << additionalExecutables) {
changeIdentification("$ORIGIN/" + QFileInfo(executable).dir().relativeFilePath(libraryPath) + "/" + bundleLibraryDirectory, QFileInfo(executable).canonicalFilePath());
}
applicationBundle.libraryPaths = findAppLibraries(appDirPath);
LogDebug() << "applicationBundle.libraryPaths:" << applicationBundle.libraryPaths;
@ -1629,7 +1604,7 @@ void deployTranslations(const QString &appDirPath, quint64 usedQtModules)
LogDebug() << "Deploying translations...";
QString qtTranslationsPath = qtToBeBundledInfo.value("QT_INSTALL_TRANSLATIONS");
if (qtTranslationsPath.isEmpty() || !QFile::exists(qtTranslationsPath)) {
LogError() << "Qt translations path could not be determined";
LogDebug() << "Qt translations path could not be determined, maybe there are no translations?";
return;
}

0
shared/shared.h → tools/linuxdeployqt/shared.h

4
tools/tools.pro

@ -0,0 +1,4 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += linuxdeployqt
Loading…
Cancel
Save