Skip to content

Commit

Permalink
Project tree cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
hipersayanX committed May 19, 2017
1 parent d199bb9 commit a99b43b
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ Makefile*
*.autosave

# QtCtreator Qml

*.qmlproject.user
*.qmlproject.user.*

# QtCtreator CMake

CMakeLists.txt.user

# Project Files

linuxdeployqt
38 changes: 38 additions & 0 deletions commons.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
COMMONS_TARGET = "linuxdeployqt"
DEFAULT_PREFIX = /usr

isEmpty(PREFIX): PREFIX = $${DEFAULT_PREFIX}
isEmpty(EXECPREFIX): EXECPREFIX = $${PREFIX}
isEmpty(BINDIR): BINDIR = $${EXECPREFIX}/bin
isEmpty(SBINDIR): SBINDIR = $${EXECPREFIX}/sbin
isEmpty(LIBEXECDIR): LIBEXECDIR = $${EXECPREFIX}/libexec
isEmpty(DATAROOTDIR): DATAROOTDIR = $${PREFIX}/share
isEmpty(DATDIR): DATDIR = $${DATAROOTDIR}/$${COMMONS_TARGET}
isEmpty(SYSCONFDIR): SYSCONFDIR = $${PREFIX}/etc
isEmpty(SHAREDSTATEDIR): SHAREDSTATEDIR = $${PREFIX}/com
isEmpty(LOCALSTATEDIR): LOCALSTATEDIR = $${PREFIX}/var
isEmpty(INCLUDEDIR): INCLUDEDIR = $${PREFIX}/include
isEmpty(DOCDIR): DOCDIR = $${DATAROOTDIR}/doc/$${COMMONS_TARGET}
isEmpty(INFODIR): INFODIR = $${DATAROOTDIR}/info
isEmpty(HTMLDIR): HTMLDIR = $${DOCDIR}/html
isEmpty(DVIDIR): DVIDIR = $${DOCDIR}/dvi
isEmpty(PDFDIR): PDFDIR = $${DOCDIR}/pdf
isEmpty(PSDIR): PSDIR = $${DOCDIR}/ps
isEmpty(LIBDIR): LIBDIR = $${EXECPREFIX}/lib
isEmpty(LOCALEDIR): LOCALEDIR = $${DATAROOTDIR}/locale
isEmpty(MANDIR): MANDIR = $${DATAROOTDIR}/man
isEmpty(LICENSEDIR): LICENSEDIR = $${DATAROOTDIR}/licenses/$${COMMONS_TARGET}
isEmpty(LOCALDIR): LOCALDIR = $${PREFIX}/local
isEmpty(LOCALLIBDIR): LOCALLIBDIR = $${LOCALDIR}/lib

CONFIG(debug, debug|release) {
COMMONS_BUILD_PATH = build/Qt$${QT_VERSION}/$${QMAKE_CC}/debug
DEFINES += QT_DEBUG
} else {
COMMONS_BUILD_PATH = build/Qt$${QT_VERSION}/$${QMAKE_CC}/release
}

MOC_DIR = $${COMMONS_BUILD_PATH}/moc
OBJECTS_DIR = $${COMMONS_BUILD_PATH}/obj
RCC_DIR = $${COMMONS_BUILD_PATH}/rcc
UI_DIR = $${COMMONS_BUILD_PATH}/ui
26 changes: 24 additions & 2 deletions linuxdeployqt.pro
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
TEMPLATE = subdirs
SUBDIRS = linuxdeployqt
include(commons.pri)

QT += core
QT -= gui

CONFIG += c++11

CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

HEADERS = \
src/shared.h

SOURCES = \
src/main.cpp \
src/shared.cpp

DESTDIR = $${OUT_PWD}
TARGET = $${COMMONS_TARGET}

INSTALLS += target
target.path = $${BINDIR}
File renamed without changes.
8 changes: 5 additions & 3 deletions linuxdeployqt/main.cpp → src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
** $QT_END_LICENSE$
**
****************************************************************************/

#include <QCoreApplication>
#include <QDir>
#include <QProcessEnvironment>
#include "../shared/shared.h"
#include <QRegularExpression>
#include <stdlib.h>
#include <QSettings>
#include <QDirIterator>

#include "shared.h"

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
Expand Down Expand Up @@ -145,7 +147,7 @@ int main(int argc, char **argv)
// Allow binaries next to linuxdeployqt to be found; this is useful for bundling
// this application itself together with helper binaries such as patchelf
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString oldPath = env.value("PATH");
QString oldPath = env.value("PATH");
QString newPath = QCoreApplication::applicationDirPath() + ":" + oldPath;
LogDebug() << newPath;
setenv("PATH",newPath.toUtf8().constData(),1);
Expand Down Expand Up @@ -304,7 +306,7 @@ int main(int argc, char **argv)
qDebug() << "preExistingToplevelIcon:" << preExistingToplevelIcon;
} else {
qDebug() << "iconToBeUsed:" << iconToBeUsed;
QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName();
QString targetIconPath = appDirPath + "/" + QFileInfo(iconToBeUsed).fileName();
if (QFile::copy(iconToBeUsed, targetIconPath)){
qDebug() << "Copied" << iconToBeUsed << "to" << targetIconPath;
QFile::copy(targetIconPath, appDirPath + "/.DirIcon");
Expand Down
44 changes: 23 additions & 21 deletions shared/shared.cpp → src/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/

#include <QCoreApplication>
#include <QString>
#include <QStringList>
Expand All @@ -43,6 +44,7 @@
#include <QJsonValue>
#include <QRegularExpression>
#include <QStandardPaths>

#include "shared.h"

QString appBinaryPath;
Expand Down Expand Up @@ -99,20 +101,20 @@ inline QDebug operator<<(QDebug debug, const AppDirInfo &info)
// on architecture. See "vDSO names" in the notes section of vdso(7)
// for more information.
static bool lddOutputContainsLinuxVDSO(const QString &lddOutput) {
// aarch64, arm, mips, x86_64, x86/x32
if (lddOutput.contains(QStringLiteral("linux-vdso.so.1"))) {
return true;
// ppc32, s390
} else if (lddOutput.contains(QStringLiteral("linux-vdso32.so.1"))) {
return true;
// ppc64, s390x
} else if (lddOutput.contains(QStringLiteral("linux-vdso64.so.1"))) {
return true;
// ia64, sh, i386
} else if (lddOutput.contains(QStringLiteral("linux-gate.so.1"))) {
return true;
}
return false;
// aarch64, arm, mips, x86_64, x86/x32
if (lddOutput.contains(QStringLiteral("linux-vdso.so.1"))) {
return true;
// ppc32, s390
} else if (lddOutput.contains(QStringLiteral("linux-vdso32.so.1"))) {
return true;
// ppc64, s390x
} else if (lddOutput.contains(QStringLiteral("linux-vdso64.so.1"))) {
return true;
// ia64, sh, i386
} else if (lddOutput.contains(QStringLiteral("linux-gate.so.1"))) {
return true;
}
return false;
}

bool copyFilePrintStatus(const QString &from, const QString &to)
Expand Down Expand Up @@ -1016,7 +1018,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
}
} else {
pluginList.append(QStringLiteral("imageformats/") + plugin);
}
}
}
}

Expand All @@ -1026,8 +1028,8 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
foreach (const QString &plugin, xcbglintegrationPlugins) {
pluginList.append(QStringLiteral("xcbglintegrations/") + plugin);
}
}
}

// Also deploy plugins/iconengines/libqsvgicon.so whenever libQt5Svg.so.* is about to be deployed,
// https://github.com/probonopd/linuxdeployqt/issues/36
if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Svg")) {
Expand Down Expand Up @@ -1069,7 +1071,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath

QString sourcePath;
QString destinationPath;

// Qt WebEngine if libQt5WebEngineCore is in use
// https://doc-snapshots.qt.io/qt5-5.7/qtwebengine-deploying.html
// TODO: Rather than hardcode the source paths, somehow get them dynamically
Expand Down Expand Up @@ -1124,7 +1126,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
destinationPath = QDir::cleanPath(dstTranslations + "/qtwebengine_locales");
recursiveCopy(sourcePath, destinationPath);
}

LogNormal() << "pluginList after having detected hopefully all required plugins:" << pluginList;

foreach (const QString &plugin, pluginList) {
Expand All @@ -1143,7 +1145,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
QString relativePath = dir.relativeFilePath(appDirInfo.path + "/" + libraries[0].libraryDestinationDirectory);
relativePath.remove(0, 3); // remove initial '../'
changeIdentification("$ORIGIN/" + relativePath, QFileInfo(destinationPath).canonicalFilePath());

}
}
}
Expand Down Expand Up @@ -1224,7 +1226,7 @@ bool deployQmlImports(const QString &appDirPath, DeploymentInfo deploymentInfo,
argumentList.append(qtToBeBundledInfo.value("QT_INSTALL_QML"));

LogDebug() << "qmlImportsPath (QT_INSTALL_QML):" << qtToBeBundledInfo.value("QT_INSTALL_QML");

// run qmlimportscanner
QProcess qmlImportScanner;
LogDebug() << qmlImportScannerPath << argumentList;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/tests-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ mkdir -p linuxdeployqt.AppDir/usr/bin/
cp /usr/local/bin/{appimagetool,mksquashfs,patchelf,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 ./linuxdeployqt linuxdeployqt.AppDir/usr/bin/
./linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
ls -lh
find *.AppDir
xpra start :99
Expand Down

0 comments on commit a99b43b

Please sign in to comment.