diff --git a/.gitignore b/.gitignore index fa24b2ef..6fc7ba5e 100644 --- a/.gitignore +++ b/.gitignore @@ -30,9 +30,14 @@ Makefile* *.autosave # QtCtreator Qml + *.qmlproject.user *.qmlproject.user.* # QtCtreator CMake + CMakeLists.txt.user +# Project Files + +linuxdeployqt diff --git a/commons.pri b/commons.pri new file mode 100644 index 00000000..33601187 --- /dev/null +++ b/commons.pri @@ -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 diff --git a/linuxdeployqt.pro b/linuxdeployqt.pro index 1e2f2d5b..093080ae 100644 --- a/linuxdeployqt.pro +++ b/linuxdeployqt.pro @@ -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} diff --git a/linuxdeployqt/linuxdeployqt.pro b/src/linuxdeployqt.pro similarity index 100% rename from linuxdeployqt/linuxdeployqt.pro rename to src/linuxdeployqt.pro diff --git a/linuxdeployqt/main.cpp b/src/main.cpp similarity index 99% rename from linuxdeployqt/main.cpp rename to src/main.cpp index 0d203ae2..cbd5cb6b 100644 --- a/linuxdeployqt/main.cpp +++ b/src/main.cpp @@ -25,15 +25,17 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include #include #include -#include "../shared/shared.h" #include #include #include #include +#include "shared.h" + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -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); @@ -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"); diff --git a/shared/shared.cpp b/src/shared.cpp similarity index 99% rename from shared/shared.cpp rename to src/shared.cpp index c4e1e8f0..0811e296 100644 --- a/shared/shared.cpp +++ b/src/shared.cpp @@ -25,6 +25,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include #include #include @@ -43,6 +44,7 @@ #include #include #include + #include "shared.h" QString appBinaryPath; @@ -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) @@ -1016,7 +1018,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath } } else { pluginList.append(QStringLiteral("imageformats/") + plugin); - } + } } } @@ -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")) { @@ -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 @@ -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) { @@ -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()); - + } } } @@ -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; diff --git a/shared/shared.h b/src/shared.h similarity index 100% rename from shared/shared.h rename to src/shared.h diff --git a/tests/tests-ci.sh b/tests/tests-ci.sh index 9bd5fa36..619c51e6 100755 --- a/tests/tests-ci.sh +++ b/tests/tests-ci.sh @@ -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