From 9507ce64d244719d38a4c4e67980d0ea921ab706 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 27 Mar 2018 10:30:23 +0200 Subject: [PATCH] Set install prefix in Exec= line of .desktop file + register icon and menu entry when installing RPM package. --- CMakeLists.txt | 4 +++- assets/{linphone.desktop => linphone.desktop.cmake} | 2 +- build/rpm/linphone.spec.cmake | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) rename assets/{linphone.desktop => linphone.desktop.cmake} (93%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f04f8a93..ba8277dac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -420,7 +420,9 @@ foreach (target ${TARGET_NAME} ${TESTER_TARGET_NAME}) ) endforeach () -install(FILES "assets/linphone.desktop" +configure_file("assets/linphone.desktop.cmake" "linphone.desktop" @ONLY) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/linphone.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications" ) install(FILES "${ASSETS_DIR}/images/linphone_logo.svg" diff --git a/assets/linphone.desktop b/assets/linphone.desktop.cmake similarity index 93% rename from assets/linphone.desktop rename to assets/linphone.desktop.cmake index 42dd51d8f..b2743f2dc 100644 --- a/assets/linphone.desktop +++ b/assets/linphone.desktop.cmake @@ -3,7 +3,7 @@ Name=Linphone GenericName=SIP Phone Comment=Linphone is a libre SIP client Type=Application -Exec=linphone %u +Exec=@CMAKE_INSTALL_PREFIX@/linphone %u Icon=linphone Terminal=false Categories=Network;Telephony; diff --git a/build/rpm/linphone.spec.cmake b/build/rpm/linphone.spec.cmake index 4861a456b..0f4ba5e6d 100644 --- a/build/rpm/linphone.spec.cmake +++ b/build/rpm/linphone.spec.cmake @@ -57,8 +57,15 @@ make install DESTDIR=%{buildroot} %clean rm -rf $RPM_BUILD_ROOT -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig +%post + /sbin/ldconfig + xdg-icon-resource install --novendor --mode system --context apps %{_datarootdir}/icons/hicolor/scalable/apps/linphone.svg linphone; + xdg-desktop-menu install --novendor --mode system %{_datarootdir}/applications/linphone.desktop + +%postun + xdg-desktop-menu uninstall --mode system linphone.desktop + xdg-icon-resource uninstall --mode system linphone + /sbin/ldconfig %files %defattr(-,root,root,-)