Browse Source

Automatically set the correct path to the Flameshot executable (#1775)

* Automatically set the correct path to the Flameshot executable.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>

* Export CMake project settings.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>

* Fixed AppImage and Snap builds.
Vitaly Zaitsev 3 years ago
parent
commit
1031980ed1

+ 1 - 2
.github/workflows/Linux-pack.yml

@@ -483,12 +483,11 @@ jobs:
           APPIMAGETOOL_ARCH: x86_64
       - name: Packaging appimage
         run: |
-          sed  -i 's|Exec=/usr/bin/flameshot|Exec=flameshot|g' data/desktopEntry/package/org.flameshot.Flameshot.desktop
           APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
           mkdir -p ${APPIMAGE_DST_PATH}
 
           cd $GITHUB_WORKSPACE
-          cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
+          cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
           make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
 
           $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop

+ 3 - 0
CMakeLists.txt

@@ -62,6 +62,9 @@ set(RUN_IN_PLACE
         CACHE BOOL "Run directly in source directory structure")
 
 option(GENERATE_TS "Regenerate translation source files" OFF)
+option(USE_EXTERNAL_SINGLEAPPLICATION "Use external QtSingleApplication library" OFF)
+option(USE_EXTERNAL_SPDLOG "Use external spdlog library" OFF)
+option(USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON)
 
 include(cmake/StandardProjectSettings.cmake)
 

+ 1 - 1
data/desktopEntry/package/org.flameshot.Flameshot.desktop

@@ -37,7 +37,7 @@ Keywords[nl_NL]=flameshot;schermfoto;screenshot;schermafdruk;vastleggen;schermop
 Keywords[es]=flameshot;screenshot;capture;shutter;captura;
 Keywords[de]=flameshot;screenshot;Bildschirmfoto;Aufnahme;
 Keywords[pt_BR]=flameshot;screenshot;captura de tela;captura;shutter;
-Exec=/usr/bin/flameshot
+Exec=@LAUNCHER_EXECUTABLE@
 Icon=org.flameshot.Flameshot
 Terminal=false
 Type=Application

+ 1 - 0
data/snap/snapcraft.yaml

@@ -51,6 +51,7 @@ parts:
     configflags:
       - '-DCMAKE_BUILD_TYPE=RelWithDebInfo'
       - '-DCMAKE_INSTALL_PREFIX=/usr'
+      - '-DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF'
     source: https://github.com/flameshot-org/flameshot.git
     source-type: git
     override-pull: |

+ 7 - 1
src/CMakeLists.txt

@@ -237,6 +237,12 @@ endforeach ()
 include(GNUInstallDirs)
 set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Flameshot)
 
+if(USE_LAUNCHER_ABSOLUTE_PATH)
+    set(LAUNCHER_EXECUTABLE "${CMAKE_INSTALL_FULL_BINDIR}/flameshot")
+else()
+    set(LAUNCHER_EXECUTABLE "flameshot")
+endif()
+
 # Install binary
 install(TARGETS flameshot
         EXPORT flameshot-targets
@@ -245,7 +251,7 @@ install(TARGETS flameshot
 
 # Install desktop files, completion and dbus files
 configure_file(${CMAKE_SOURCE_DIR}/data/desktopEntry/package/org.flameshot.Flameshot.desktop
-        ${CMAKE_CURRENT_BINARY_DIR}/share/applications/org.flameshot.Flameshot.desktop COPYONLY)
+        ${CMAKE_CURRENT_BINARY_DIR}/share/applications/org.flameshot.Flameshot.desktop @ONLY)
 
 configure_file(${CMAKE_SOURCE_DIR}/data/appdata/org.flameshot.Flameshot.metainfo.xml
         ${CMAKE_CURRENT_BINARY_DIR}/share/metainfo/org.flameshot.Flameshot.metainfo.xml COPYONLY)