From 6fad088ed31c142965b488cc13be29c92e1a7fa0 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 13:19:01 +0100 Subject: [PATCH 01/18] Started FHS-like mode; not quite working yet --- linuxdeployqt/main.cpp | 54 +++++++++++++++++++++++++++++++----------- shared/shared.cpp | 31 ++++++++---------------- shared/shared.h | 3 +++ 3 files changed, 53 insertions(+), 35 deletions(-) diff --git a/linuxdeployqt/main.cpp b/linuxdeployqt/main.cpp index dfae9d5..de2f5f9 100644 --- a/linuxdeployqt/main.cpp +++ b/linuxdeployqt/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); - QString appBinaryPath; + extern QString appBinaryPath; if (argc > 1) { appBinaryPath = QString::fromLocal8Bit(argv[1]); @@ -91,34 +91,58 @@ int main(int argc, char **argv) return 1; } - QDir dir; - // QString appDir = QDir::cleanPath(appFile + "/../" + appName + ".AppDir"); QString appDir = QDir::cleanPath(appBinaryPath + "/../"); - if (QDir().exists(appDir) == false) { qDebug() << "Error: Could not find AppDir" << appDir; return 1; } - QString appDirPath = appDir; - - QFile appRun(appDir + "/AppRun"); - - if(appRun.exists()){ - appRun.remove(); - } - QFile::link(appName, appDir + "/AppRun"); - bool plugins = true; bool appimage = false; extern bool runStripEnabled; extern bool bundleAllButCoreLibs; + extern bool fhsLikeMode; + extern QString fhsPrefix; extern bool alwaysOwerwriteEnabled; extern QStringList librarySearchPath; QStringList additionalExecutables; bool qmldirArgumentUsed = false; QStringList qmlDirs; + /* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr. + * In this case, we want to construct an AppDir in /path/to. */ + if (QDir().exists((QDir::cleanPath(appBinaryPath + "/../../bin"))) == true) { + fhsPrefix = QDir::cleanPath(appBinaryPath + "/../../"); + qDebug() << "FHS-like mode with PREFIX, fhsPrefix:" << fhsPrefix; + fhsLikeMode = true; + } else { + qDebug() << "Not using FHS-like mode, appBinaryPath:" << appBinaryPath; + } + + QString appDirPath; + if(fhsLikeMode == false){ + appDirPath = appDir; + } else { + appDirPath = QDir::cleanPath(fhsPrefix + "/../"); + } + qDebug() << "appDirPath:" << appDirPath; + + QString relativeBinPath; + if(fhsLikeMode == false){ + relativeBinPath = appName; + } else { + QString relativePrefix = fhsPrefix.replace(appDirPath+"/", ""); + relativeBinPath = relativePrefix + "/bin/" + appName; + } + qDebug() << "relativeBinPath:" << relativeBinPath; + + QFile appRun(appDirPath + "/AppRun"); + if(appRun.exists()){ + appRun.remove(); + } + + QFile::link(relativeBinPath, appDirPath + "/AppRun"); + for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); if (argument == QByteArray("-no-plugins")) { @@ -175,8 +199,10 @@ int main(int argc, char **argv) } if (appimage) { - if(checkAppImagePrerequisites(appDirPath) == false) + if(checkAppImagePrerequisites(appDirPath) == false){ + LogError() << "checkAppImagePrerequisites failed\n"; return 1; + } } DeploymentInfo deploymentInfo = deployQtLibraries(appDirPath, additionalExecutables); diff --git a/shared/shared.cpp b/shared/shared.cpp index 6578f5f..6b43b7b 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -44,9 +44,11 @@ #include #include "shared.h" - +QString appBinaryPath; bool runStripEnabled = true; bool bundleAllButCoreLibs = false; +bool fhsLikeMode = false; +QString fhsPrefix; bool alwaysOwerwriteEnabled = false; QStringList librarySearchPath; bool appstoreCompliant = false; @@ -81,7 +83,7 @@ QDebug operator<<(QDebug debug, const LibraryInfo &info) return debug; } -const QString bundleLibraryDirectory = "lib"; // the same directory as the main executable; could define a relative subdirectory here +QString bundleLibraryDirectory; inline QDebug operator<<(QDebug debug, const AppDirInfo &info) { @@ -217,6 +219,9 @@ int containsHowOften(QStringList haystack, QString needle) { LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath, const QSet &rpaths) { + bundleLibraryDirectory= "lib"; // relative to bundle + LogDebug() << "bundleLibraryDirectory:" << bundleLibraryDirectory; + LibraryInfo info; QString trimmed = line.trimmed(); @@ -338,21 +343,6 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath, return info; } -QString findAppBinary(const QString &appDirPath) -{ - QString binaryPath; - - // FIXME: Do without the need for an AppRun symlink - // by passing appBinaryPath from main.cpp here - binaryPath = appDirPath + "/" + "AppRun"; - - if (QFile::exists(binaryPath)) - return binaryPath; - - LogError() << "Could not find bundle binary for" << appDirPath << "at" << binaryPath; - exit(1); -} - QStringList findAppLibraries(const QString &appDirPath) { QStringList result; @@ -648,7 +638,7 @@ void runStrip(const QString &binaryPath) void stripAppBinary(const QString &bundlePath) { - runStrip(findAppBinary(bundlePath)); + runStrip(appBinaryPath); } /* @@ -742,7 +732,7 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a applicationBundle.path = appDirPath; LogDebug() << "applicationBundle.path:" << applicationBundle.path; - applicationBundle.binaryPath = findAppBinary(appDirPath); + applicationBundle.binaryPath = appBinaryPath; LogDebug() << "applicationBundle.binaryPath:" << applicationBundle.binaryPath; // Determine the location of the Qt to be bundled @@ -967,7 +957,7 @@ void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo) { AppDirInfo applicationBundle; applicationBundle.path = appDirPath; - applicationBundle.binaryPath = findAppBinary(appDirPath); + applicationBundle.binaryPath = appBinaryPath; const QString pluginDestinationPath = appDirPath + "/" + "plugins"; deployPlugins(applicationBundle, deploymentInfo.pluginPath, pluginDestinationPath, deploymentInfo); @@ -1139,7 +1129,6 @@ void changeQtLibraries(const QList libraries, const QStringList &bi void changeQtLibraries(const QString appPath, const QString &qtPath) { - const QString appBinaryPath = findAppBinary(appPath); const QStringList libraryPaths = findAppLibraries(appPath); const QList libraries = getQtLibrariesForPaths(QStringList() << appBinaryPath << libraryPaths, appPath, getBinaryRPaths(appBinaryPath, true)); if (libraries.isEmpty()) { diff --git a/shared/shared.h b/shared/shared.h index 60c0fd9..4347002 100644 --- a/shared/shared.h +++ b/shared/shared.h @@ -40,8 +40,11 @@ extern int logLevel; #define LogNormal() if (logLevel < 2) {} else qDebug() << "Log:" #define LogDebug() if (logLevel < 3) {} else qDebug() << "Log:" +extern QString appBinaryPath; extern bool runStripEnabled; extern bool bundleAllButCoreLibs; +extern bool fhsLikeMode; +extern QString fhsPrefix; class LibraryInfo { From 05f2f03a888752c1c5c6f843080e0d6bbe319a22 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 13:37:52 +0100 Subject: [PATCH 02/18] Continue FHS-like mode --- linuxdeployqt/main.cpp | 10 +++------- shared/shared.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/linuxdeployqt/main.cpp b/linuxdeployqt/main.cpp index de2f5f9..356c55c 100644 --- a/linuxdeployqt/main.cpp +++ b/linuxdeployqt/main.cpp @@ -120,20 +120,16 @@ int main(int argc, char **argv) } QString appDirPath; - if(fhsLikeMode == false){ - appDirPath = appDir; - } else { - appDirPath = QDir::cleanPath(fhsPrefix + "/../"); - } - qDebug() << "appDirPath:" << appDirPath; - QString relativeBinPath; if(fhsLikeMode == false){ + appDirPath = appDir; relativeBinPath = appName; } else { + appDirPath = QDir::cleanPath(fhsPrefix + "/../"); QString relativePrefix = fhsPrefix.replace(appDirPath+"/", ""); relativeBinPath = relativePrefix + "/bin/" + appName; } + qDebug() << "appDirPath:" << appDirPath; qDebug() << "relativeBinPath:" << relativeBinPath; QFile appRun(appDirPath + "/AppRun"); diff --git a/shared/shared.cpp b/shared/shared.cpp index 6b43b7b..ece28f1 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -219,7 +219,12 @@ int containsHowOften(QStringList haystack, QString needle) { LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath, const QSet &rpaths) { - bundleLibraryDirectory= "lib"; // relative to bundle + if(fhsLikeMode == false){ + bundleLibraryDirectory= "lib"; // relative to bundle + } else { + QString relativePrefix = fhsPrefix.replace(appDirPath+"/", ""); + bundleLibraryDirectory = relativePrefix + "/lib/"; + } LogDebug() << "bundleLibraryDirectory:" << bundleLibraryDirectory; LibraryInfo info; @@ -764,7 +769,11 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); } - changeIdentification("$ORIGIN/" + bundleLibraryDirectory, applicationBundle.binaryPath); + if(fhsLikeMode == false){ + changeIdentification("$ORIGIN/" + bundleLibraryDirectory, applicationBundle.binaryPath); + } else { + changeIdentification("$ORIGIN/../lib/" + bundleLibraryDirectory, applicationBundle.binaryPath); + } applicationBundle.libraryPaths = findAppLibraries(appDirPath); LogDebug() << "applicationBundle.libraryPaths:" << applicationBundle.libraryPaths; From 118823a9afde842b0582589fc3cd5352b39505e8 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 13:43:38 +0100 Subject: [PATCH 03/18] Use latest appimagetool --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22e23ad..2a6363b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,7 @@ before_install: - make -j7 - sudo make install - cd - - - ID=$(wget -q https://api.travis-ci.org/repos/probonopd/appimagetool/builds -O - | head -n 1 | sed -e 's|}|\n|g' | grep '"result":0' | head -n 1 | sed -e 's|,|\n|g' | grep '"id"' | cut -d ":" -f 2) - - URL=$(wget -q "http://archive.travis-ci.org/jobs/$((ID+1))/log.txt" -O - | grep -o "https://transfer.sh/.*/appimagetool" | tail -n 1 | sed -e 's|\r||g') - - if [ -z "$URL" ] ; then URL=$(wget -q "http://archive.travis-ci.org/jobs/$((ID+2))/log.txt" -O - | grep -o "https://transfer.sh/.*/appimagetool" | tail -n 1 | sed -e 's|\r||g') ; fi - - sudo wget -c "$URL" -O /usr/local/bin/appimagetool + - sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool - sudo chmod a+x /usr/local/bin/appimagetool install: From e594e6f678d92b65ad3bfb775c5644b18decab64 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 13:48:14 +0100 Subject: [PATCH 04/18] Use uploadtool --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2a6363b..389baba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,10 @@ script: - export VERSION=$(git describe --always) - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt -verbose=3 -appimage - ls -lh - - curl --upload-file ./linuxdeployqt-*.AppImage https://transfer.sh/linuxdeployqt-$VERSION-x86_64.appimage + - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + - bash ./upload.sh ./linuxdeployqt-*.AppImage + +branches: + except: + - # Do not build tags that we create when we upload to GitHub Releases + - /^(?i:continuous)$/ From 50c73383e4a7fdea32c793a4c7fae3824fa6d76d Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 14:09:50 +0100 Subject: [PATCH 05/18] Place qt.conf next to executable --- shared/shared.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index ece28f1..0716667 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -940,7 +940,7 @@ void createQtConf(const QString &appDirPath) "Qml2Imports = qml\n"; QString filePath = appDirPath + "/"; // Is picked up when placed next to the main executable - QString fileName = filePath + "qt.conf"; + QString fileName = appBinaryPath + "/../qt.conf"; QDir().mkpath(filePath); @@ -1034,7 +1034,7 @@ bool deployQmlImports(const QString &appDirPath, DeploymentInfo deploymentInfo, LogDebug() << qmlImportScannerPath << argumentList; qmlImportScanner.start(qmlImportScannerPath, argumentList); if (!qmlImportScanner.waitForStarted()) { - LogError() << "Could not start qmlimpoortscanner. Process error is" << qmlImportScanner.errorString(); + LogError() << "Could not start qmlimportscanner. Process error is" << qmlImportScanner.errorString(); return false; } qmlImportScanner.waitForFinished(); @@ -1152,6 +1152,12 @@ void changeQtLibraries(const QString appPath, const QString &qtPath) bool checkAppImagePrerequisites(const QString &appDirPath) { + if(fhsLikeMode == true){ + /* In FHS-like mode, we assume that there will be a desktop file + * and icon file that appimagetool will be able to pick up */ + return true; + } + QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.desktop"), QDir::Files, QDirIterator::Subdirectories); if (!iter.hasNext()) { From 4ab586dcbbb3238db688f97e734e0a99c03a169e Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 19 Nov 2016 19:07:15 +0100 Subject: [PATCH 06/18] Update README.md [ci skip] --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b571fb1..32cd53f 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,11 @@ tar xf patchelf-0.9.tar.bz2 ( cd patchelf-0.9/ && ./configure && make && sudo make install ) ``` -* Optional if you want to generate AppImages: Download [AppImageAssistant](https://github.com/probonopd/AppImageKit/releases) and put it into your $PATH, e.g., into `/usr/local/bin`. Make sure it is renamed to `AppImageAssistant` and is `chmod a+x` +* Optional if you want to generate AppImages: Download [appimagetool](https://github.com/probonopd/AppImageKit/releases) and put it into your $PATH, e.g., into `/usr/local/bin`. Make sure it is renamed to `appimagetool` and is `chmod a+x` ``` -wget https://github.com/probonopd/AppImageKit/releases/download/6/AppImageAssistant_6-x86_64.AppImage -O AppImageAssistant -chmod a+x AppImageAssistant -sudo mv AppImageAssistant /usr/local/bin/ +sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool +sudo chmod a+x /usr/local/bin/appimagetool ``` ## Usage From 62b49fafc8510fef46b99eae5d8f04cff589ee27 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 13:34:15 +0100 Subject: [PATCH 07/18] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 389baba..24a3d0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ script: - cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt - - export VERSION=$(git describe --always) + - export VERSION=continuous - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt -verbose=3 -appimage - ls -lh - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh From 45387d0ab894ad3e20037034f74d67d5f5f7b8c8 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 13:48:58 +0100 Subject: [PATCH 08/18] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 24a3d0e..6092b5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ script: - mkdir -p linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt + - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ - export VERSION=continuous - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt -verbose=3 -appimage - ls -lh From c8b651e37f9c1e2db887875c05ceb6ad2754a206 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 13:51:26 +0100 Subject: [PATCH 09/18] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6092b5e..f3969c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ script: - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ - export VERSION=continuous - - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt -verbose=3 -appimage + - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt -verbose=3 -appimage - ls -lh - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - bash ./upload.sh ./linuxdeployqt-*.AppImage From e0c442aea5577e13e6abcb684785149789d81943 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 13:59:25 +0100 Subject: [PATCH 10/18] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3969c0..c7698b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,8 @@ script: - mkdir -p linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ + - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt + - find linuxdeployqt.AppDir/ - export VERSION=continuous - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt -verbose=3 -appimage - ls -lh From 289d7087b702c145efb482e3f7d266434e976d2e Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 14:16:49 +0100 Subject: [PATCH 11/18] patchelf from git --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7698b9..31fe501 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,8 @@ os: linux before_install: - sudo add-apt-repository --yes ppa:beineri/opt-qt57-trusty - sudo apt-get update -qq - - wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2 - - tar xf patchelf-0.9.tar.bz2 - - cd patchelf-*/ + - git clone https://github.com/NixOS/patchelf.git + - cd patchelf - ./configure - make -j7 - sudo make install From 6ea1dca27392bac0cec146276883c09b7e970c24 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 20 Nov 2016 14:19:52 +0100 Subject: [PATCH 12/18] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 31fe501..0e6ab08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ before_install: - sudo add-apt-repository --yes ppa:beineri/opt-qt57-trusty - sudo apt-get update -qq - git clone https://github.com/NixOS/patchelf.git - - cd patchelf + - cd patchelf + - bash ./bootstrap.sh - ./configure - make -j7 - sudo make install From d0622452513c588412f66f2bfb53237bda16b96a Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 4 Dec 2016 11:27:31 +0100 Subject: [PATCH 13/18] Deploy imageformats --- shared/shared.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index 0716667..429ffba 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -825,8 +825,9 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5Svg")) { pluginList.append(QStringLiteral("imageformats/") + plugin); } + } else { pluginList.append(QStringLiteral("imageformats/") + plugin); - } + } } } From 42e84d710eb219c270cf22f9bfa5488158b7548b Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 4 Dec 2016 13:12:46 +0100 Subject: [PATCH 14/18] strip linuxdeployqt.AppDir/usr/bin/* To find out whether patchelf cripples unstripped binaries --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e6ab08..03374ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: - cd patchelf - bash ./bootstrap.sh - ./configure - - make -j7 + - make -j2 - sudo make install - cd - - sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool @@ -23,13 +23,13 @@ install: script: - source /opt/qt57/bin/qt57-env.sh - /opt/qt57/bin/qmake linuxdeployqt.pro - - make -j7 + - make -j2 - mkdir -p linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt - - find linuxdeployqt.AppDir/ - - export VERSION=continuous + - strip linuxdeployqt.AppDir/usr/bin/* || continue + - export VERSION=continuousfhs - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt -verbose=3 -appimage - ls -lh - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh From 6df6777931ea8f26554e17b48edd668cf96fdaa2 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 13 Feb 2017 01:26:36 +0100 Subject: [PATCH 15/18] Use patchelf_0.8.orig.tar.gz as per https://github.com/probonopd/linuxdeployqt/issues/47#issuecomment-279249006 --- .travis.yml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03374ff..9242585 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,33 +5,38 @@ dist: trusty os: linux before_install: - - sudo add-apt-repository --yes ppa:beineri/opt-qt57-trusty + - sudo add-apt-repository --yes ppa:beineri/opt-qt58-trusty - sudo apt-get update -qq - - git clone https://github.com/NixOS/patchelf.git - - cd patchelf - - bash ./bootstrap.sh - - ./configure - - make -j2 - - sudo make install - - cd - + - wget -c "http://archive.ubuntu.com/ubuntu/pool/universe/p/patchelf/patchelf_0.8.orig.tar.gz" + - tar xf patchelf_0.8.orig.tar.gz + - ( cd patchelf-0.8/ && ./configure && make j2 && sudo make install ) +# - git clone https://github.com/NixOS/patchelf.git +# - cd patchelf +# - bash ./bootstrap.sh +# - ./configure +# - make -j2 +# - sudo make install +# - cd - - sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool - sudo chmod a+x /usr/local/bin/appimagetool install: - - sudo apt-get -y install qt57base binutils + - sudo apt-get -y install qt58base binutils script: - - source /opt/qt57/bin/qt57-env.sh - - /opt/qt57/bin/qmake linuxdeployqt.pro + - source /opt/qt*/bin/qt*-env.sh + - /opt/qt*/bin/qmake linuxdeployqt.pro - make -j2 - mkdir -p linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/ - cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/ - - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt - - strip linuxdeployqt.AppDir/usr/bin/* || continue + - find linuxdeployqt.AppDir/ - export VERSION=continuousfhs + - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ + - strip linuxdeployqt.AppDir/usr/bin/* || continue - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt -verbose=3 -appimage - ls -lh + - find *.AppDir - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - bash ./upload.sh ./linuxdeployqt-*.AppImage From ae53d70f099628d62da14d06bf5398c8f0af3355 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 13 Feb 2017 01:28:30 +0100 Subject: [PATCH 16/18] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9242585..73421b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - sudo apt-get update -qq - wget -c "http://archive.ubuntu.com/ubuntu/pool/universe/p/patchelf/patchelf_0.8.orig.tar.gz" - tar xf patchelf_0.8.orig.tar.gz - - ( cd patchelf-0.8/ && ./configure && make j2 && sudo make install ) + - ( cd patchelf-0.8/ && ./configure && make -j2 && sudo make install ) # - git clone https://github.com/NixOS/patchelf.git # - cd patchelf # - bash ./bootstrap.sh From e567ec5282c4883715e40fc62d1c37e535a7c976 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 13 Feb 2017 18:53:33 +0100 Subject: [PATCH 17/18] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 73421b2..5e0861d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ script: - find linuxdeployqt.AppDir/ - export VERSION=continuousfhs - cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/ - - strip linuxdeployqt.AppDir/usr/bin/* || continue +# - strip linuxdeployqt.AppDir/usr/bin/* || continue - ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/linuxdeployqt -verbose=3 -appimage - ls -lh - find *.AppDir From c643d6a5094f1dafcf0dc82c33d11d24ec622876 Mon Sep 17 00:00:00 2001 From: probonopd Date: Tue, 14 Feb 2017 22:55:45 +0100 Subject: [PATCH 18/18] Do not run strip on files that contain rpath starting with $ Workaround for NixOS/patchelf#10? --- shared/shared.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/shared/shared.cpp b/shared/shared.cpp index 429ffba..b7dd355 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -613,6 +613,36 @@ void runStrip(const QString &binaryPath) // Since we might have a symlink, we need to find its target first QString resolvedPath = QFileInfo(binaryPath).canonicalFilePath(); + LogDebug() << "Determining whether to run strip:"; + LogDebug() << " checking whether" << resolvedPath << "has an rpath set"; + LogDebug() << "patchelf" << "--print-rpath" << resolvedPath; + QProcess patchelfread; + patchelfread.start("patchelf", QStringList() << "--print-rpath" << resolvedPath); + if (!patchelfread.waitForStarted()) { + if(patchelfread.errorString().contains("execvp: No such file or directory")){ + LogError() << "Could not start patchelf."; + LogError() << "Make sure it is installed on your $PATH."; + } else { + LogError() << "Could not start patchelf. Process error is" << patchelfread.errorString(); + } + exit(1); + } + patchelfread.waitForFinished(); + + if (patchelfread.exitCode() != 0){ + LogError() << "Error reading rpath with patchelf" << QFileInfo(resolvedPath).completeBaseName() << ":" << patchelfread.readAllStandardError(); + LogError() << "Error reading rpath with patchelf" << QFileInfo(resolvedPath).completeBaseName() << ":" << patchelfread.readAllStandardOutput(); + exit(1); + } + + QString rpath = patchelfread.readAllStandardOutput(); + + if (rpath.startsWith("$")){ + LogDebug() << "Already contains rpath starting with $, hence not stripping"; + LogDebug() << patchelfread.readAllStandardOutput(); + return; + } + LogDebug() << "Using strip:"; LogDebug() << " stripping" << resolvedPath; QProcess strip;