build(cmake): Use GNUInstallDirs to install data and lib directories (#1817)

This commit is contained in:
Timo Gurr 2024-01-01 03:53:16 +01:00 committed by GitHub
parent 44b34d1e23
commit faeeb7ec57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 14 deletions

View File

@ -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
@ -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}, \
@ -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")

View File

@ -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()

View File

@ -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

View File

@ -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