Skip to content

Commit

Permalink
build(cmake): Use GNUInstallDirs to install data and lib directories (L…
Browse files Browse the repository at this point in the history
  • Loading branch information
tgurr authored and e-dong committed Jul 26, 2024
1 parent 0a17e31 commit 5165c0e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
22 changes: 11 additions & 11 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
else()
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/udev/rules.d")
DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/user")
DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")
endif()

# Post install
Expand Down Expand Up @@ -63,19 +63,19 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)

# application icon
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps")

# tray icon
if(${SUNSHINE_TRAY} STREQUAL 1)
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
RENAME "sunshine-tray.svg")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-playing.svg"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-pausing.svg"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")

set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
Expand All @@ -89,17 +89,17 @@ endif()
# desktop file
# todo - validate desktop files with `desktop-file-validate`
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.desktop"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
if(NOT ${SUNSHINE_BUILD_APPIMAGE})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine_terminal.desktop"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
endif()
if(${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine_kms.desktop"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
endif()

# metadata file
# todo - validate file with `appstream-util validate-relax`
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.appdata.xml"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/metainfo")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
2 changes: 2 additions & 0 deletions cmake/packaging/unix.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# unix specific packaging
# put anything here that applies to both linux and macos

include(GNUInstallDirs)

# return here if building a macos package
if(SUNSHINE_PACKAGE_MACOS)
return()
Expand Down
4 changes: 2 additions & 2 deletions packaging/linux/flatpak/sunshine.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Actions=RunInTerminal;KMS;
[Desktop Action RunInTerminal]
Name=Run in Terminal
Icon=application-x-executable
Exec=gio launch @CMAKE_INSTALL_PREFIX@/share/applications/sunshine_terminal.desktop
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_terminal.desktop

[Desktop Action KMS]
Name=Run in Terminal (KMS)
Icon=application-x-executable
Exec=gio launch @CMAKE_INSTALL_PREFIX@/share/applications/sunshine_kms.desktop
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_kms.desktop
2 changes: 1 addition & 1 deletion packaging/linux/sunshine.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Actions=RunInTerminal;
[Desktop Action RunInTerminal]
Name=Run in Terminal
Icon=application-x-executable
Exec=gio launch @CMAKE_INSTALL_PREFIX@/share/applications/sunshine_terminal.desktop
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_terminal.desktop

0 comments on commit 5165c0e

Please sign in to comment.