[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmymoney] /: Adjust some standard paths for AppImage
From:       Łukasz_Wojniłowicz <null () kde ! org>
Date:       2018-09-22 17:49:02
Message-ID: E1g3m1e-0007Pl-59 () code ! kde ! org
[Download RAW message or body]

Git commit a27d1f322e80186aeceb2f9e8723e29fd56847a7 by Łukasz Wojniłowicz.
Committed on 22/09/2018 at 17:48.
Pushed by wojnilowicz into branch 'master'.

Adjust some standard paths for AppImage

Differential Revision: https://phabricator.kde.org/D15604

M  +2    -0    config-kmymoney.h.cmake
M  +31   -6    kmymoney/kmymoney.cpp
M  +8    -4    packaging/linux/appimage/build-image.sh
M  +1    -12   packaging/linux/appimage/build-kmymoney.sh

https://commits.kde.org/kmymoney/a27d1f322e80186aeceb2f9e8723e29fd56847a7

diff --git a/config-kmymoney.h.cmake b/config-kmymoney.h.cmake
index 8611c59aa..23689530c 100644
--- a/config-kmymoney.h.cmake
+++ b/config-kmymoney.h.cmake
@@ -20,3 +20,5 @@
 #cmakedefine ENABLE_SQLCIPHER 1
 
 #cmakedefine ENABLE_GPG 1
+
+#cmakedefine IS_APPIMAGE 1
diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp
index fba59a4c6..4a54ca3c1 100644
--- a/kmymoney/kmymoney.cpp
+++ b/kmymoney/kmymoney.cpp
@@ -1160,9 +1160,26 @@ KMyMoneyApp::KMyMoneyApp(QWidget* parent) :
   layout->setSpacing(6);
 
   {
+#ifndef IS_APPIMAGE
     // find where our custom icons were installed based on an custom icon that we \
                know should exist after installation
     const auto customIconRelativePath = \
                QString(QStringLiteral("icons/hicolor/16x16/actions/account-add.png"));
                
     auto customIconAbsolutePath = \
QStandardPaths::locate(QStandardPaths::AppDataLocation, customIconRelativePath); +    \
if (customIconAbsolutePath.isEmpty()) { +      qWarning("Custom icons were not found \
in any of the following QStandardPaths::AppDataLocation:"); +      for (const auto \
&standardPath : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) + \
qWarning() << standardPath; +    }
+#else
+    // according to \
https://docs.appimage.org/packaging-guide/ingredients.html#open-source-applications + \
// QStandardPaths::AppDataLocation is unreliable on AppImages, so apply workaround \
here in case we fail to find icons +    const auto appImageAppDataLocation = \
QCoreApplication::applicationDirPath() + QLatin1String("/../share/kmymoney/") + \
customIconRelativePath; +    if (QFile::exists(appImageAppDataLocation )) {
+      customIconAbsolutePath = appImageAppDataLocation ;
+    } else {
+      qWarning("Custom icons were not found in the following location:");
+      qWarning() << appImageAppDataLocation ;
+    }
+#endif
 
     // add our custom icons path to icons search path
     if (!customIconAbsolutePath.isEmpty()) {
@@ -1171,10 +1188,6 @@ KMyMoneyApp::KMyMoneyApp(QWidget* parent) :
       auto paths = QIcon::themeSearchPaths();
       paths.append(customIconAbsolutePath);
       QIcon::setThemeSearchPaths(paths);
-    } else {
-      qWarning("Custom icons were not found in any of the following \
                QStandardPaths::AppDataLocation:");
-      for (const auto &standardPath : \
                QStandardPaths::standardLocations(QStandardPaths::AppDataLocation))
-          qWarning() << standardPath;
     }
 
     #if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
@@ -2921,9 +2934,21 @@ void KMyMoneyApp::Private::saveConsistencyCheckResults()
 void KMyMoneyApp::Private::setThemedCSS()
 {
   const QStringList CSSnames {QStringLiteral("kmymoney.css"), \
                QStringLiteral("welcome.css")};
-
   const QString rcDir("/html/");
-  const QStringList defaultCSSDirs = \
QStandardPaths::locateAll(QStandardPaths::AppDataLocation, rcDir, \
QStandardPaths::LocateDirectory); +  QStringList defaultCSSDirs;
+#ifndef IS_APPIMAGE
+  defaultCSSDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, rcDir, \
QStandardPaths::LocateDirectory); +#else
+  // according to https://docs.appimage.org/packaging-guide/ingredients.html#open-source-applications
 +  // QStandardPaths::AppDataLocation is unreliable on AppImages, so apply \
workaround here in case we fail to find icons +  const auto appImageAppDataLocation = \
QCoreApplication::applicationDirPath() + QLatin1String("/../share/kmymoney") + rcDir; \
+  if (QFile::exists(appImageAppDataLocation + CSSnames.first())) { +    \
defaultCSSDirs.append(appImageAppDataLocation); +  } else {
+    qWarning("CSS file was not found in the following location:");
+    qWarning() << appImageAppDataLocation;
+  }
+#endif
 
   // scan the list of directories to find the ones that really
   // contains all files we look for
diff --git a/packaging/linux/appimage/build-image.sh \
b/packaging/linux/appimage/build-image.sh index 548c3a337..55c48391a 100755
--- a/packaging/linux/appimage/build-image.sh
+++ b/packaging/linux/appimage/build-image.sh
@@ -49,18 +49,22 @@ cp -r $DEPS_INSTALL_PREFIX/translations $APPDIR/usr/
 mv $APPDIR/usr/lib/x86_64-linux-gnu/*  $APPDIR/usr/lib
 rm -rf $APPDIR/usr/lib/x86_64-linux-gnu/
 
-# Step 3: Update the rpath in the various plugins we have to make sure they'll be \
                loadable in an Appimage context
-for lib in $PLUGINS/*.so*; do
+# Step 3: Move plugins to loadable location
+mv $PLUGINS $APPDIR/usr/plugins
+
+# Step 4: Update the rpath in the various plugins we have to make sure they'll be \
loadable in an Appimage context +for lib in $APPDIR/usr/plugins/kmymoney/*.so*; do
   patchelf --set-rpath '$ORIGIN/..' $lib;
 done
 
-# Step 4: Build the image!!!
+# Step 5: Build the image!!!
 linuxdeployqt $APPDIR/usr/share/applications/org.kde.kmymoney.desktop \
   -executable=$APPDIR/usr/bin/kmymoney \
   -qmldir=$DEPS_INSTALL_PREFIX/qml \
   -verbose=2 \
   -bundle-non-qt-libs \
-  -appimage
+  -appimage \
+  -exclude-libs=libnss3.so,libnssutil3.so
 
 # Step 5: Find out what version of KMyMoney we built and give the Appimage a proper \
name  cd $BUILD_PREFIX/kmymoney-build
diff --git a/packaging/linux/appimage/build-kmymoney.sh \
b/packaging/linux/appimage/build-kmymoney.sh index 894e2a55a..6f167b483 100755
--- a/packaging/linux/appimage/build-kmymoney.sh
+++ b/packaging/linux/appimage/build-kmymoney.sh
@@ -40,18 +40,7 @@ cmake $KMYMONEY_SOURCES \
     -DCMAKE_BUILD_TYPE=RelWithDebInfo \
     -DBUILD_TESTING=FALSE \
     -DENABLE_WEBENGINE=TRUE \
-    -DENABLE_SQLCIPHER=FALSE \
-    -DENABLE_SQLSTORAGE=FALSE \
-    -DENABLE_KBANKING=FALSE \
-    -DENABLE_ONLINEJOBOUTBOXVIEW=FALSE \
-    -DENABLE_OFXIMPORTER=FALSE \
-    -DENABLE_ADDRESSBOOK=FALSE \
-    -DENABLE_HOLIDAYS=FALSE \
-    -DENABLE_ACTIVITIES=FALSE \
-    -DENABLE_FORECASTVIEW=FALSE \
-    -DENABLE_REPORTSVIEW=FALSE \
-    -DENABLE_BUDGETVIEW=FALSE \
-    -DENABLE_GPG=FALSE
+    -DIS_APPIMAGE=TRUE
 
 # Build and Install KMyMoney (ready for the next phase)
 make -j$CPU_COUNT install


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic