Вопрос

I am trying to create and install package (.deb & .rpm too) for an application I am developing, using CMake and CPack. The package gets created nice and well, however I don't get an entry in the KDE menu after running the dpkg -i mypackage.deb.

Here are the steps I am doing:

Excerpt from CMakeLists.txt:

SET(CMAKE_INSTALL_PREFIX /opt/ddm)
SET(DDM_DESKTOP_DIR     ${CMAKE_INSTALL_PREFIX}/${DDM_DATA_SUBDIR}/applications/)
SET(DDM_PIXMAPS_DIR     ${CMAKE_INSTALL_PREFIX}/${DDM_DATA_SUBDIR}/pixmaps/)

INSTALL (FILES share/ddm.desktop DESTINATION ${DDM_DESKTOP_DIR})
INSTALL (FILES share/ddm.xml DESTINATION ${DDM_DESKTOP_DIR})

# Copy the ddm pixmap
INSTALL (FILES share/ddm.png DESTINATION ${DDM_PIXMAPS_DIR})

# try to set up the menu system
find_program(XDG-MIME_EXECUTABLE xdg-mime)
find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)

INSTALL(CODE "
  execute_process(COMMAND ${XDG-MIME_EXECUTABLE} install --novendor ${DDM_DESKTOP_DIR}/ddm.xml)
  execute_process(COMMAND ${XDG-DESKTOP-MENU_EXECUTABLE} install --novendor ${DDM_DESKTOP_DIR}/ddm.desktop)
  execute_process(COMMAND ${XDG-MIME_EXECUTABLE} default ${DDM_DESKTOP_DIR}/ddm.desktop application/x-ddm-item)
  "
)
# Debian packages
INCLUDE (${CMAKE_MODULE_PATH}/DpkgBuild.cmake)
IF(DPKG_FOUND AND NOT WIN32)
    SET(CPACK_GENERATOR "DEB")
    SET(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
    SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
    SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
    SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
    SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
    SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_REQUIRES})
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-gui ( >= 4.6 ), libqt4-xml ( >= 4.6 ), libqt4-sql-mysql, libmysqlclient18, libqt4-dbus, libqt4-network, libqt4-sql, libqt4-sql-mysql, libqt4-xml, libqtcore4, libqtgui4, libqtwebkit4") # Specify dependencies here
    SET(CPACK_SET_DESTDIR TRUE)
ENDIF(DPKG_FOUND AND NOT WIN32)

SET(CPACK_PACKAGE_EXECUTABLES "ddm" "DDM")
INCLUDE(CPack)

The ddm.desktop looks like:

[Desktop Entry]
Version=0.1
Name=Database Deployment Manager
Comment=Database Deployment manager
Exec=/opt/ddm/bin/ddm %U
Icon=ddm
Terminal=false
Type=Application
Categories=Qt;Development
MimeType=application/x-ddm-item;
GenericName=Database Deployment Manager

And the ddm.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
 <mime-type type="application/x-ddm-item">
    <sub-class-of type="text/xml"/>
    <sub-class-of type="application/xml"/>
    <comment>Database Deployment Manager solution file</comment>
    <icon>ddm</icon>
    <glob pattern=".dmx" weight="50" />
    <magic priority="90">
          <match type="string" offset="2" value="!DOCTYPE DBM"/>
    </magic>
    <root-XML localName="ddm" />
  </mime-type>
 </mime-info>

what happens now is that when I run the sudo make install the application installs itself in the menu (But without an icon) but when I run the dpk -i package.deb the application installs itself but does not create any kde menu entry...

Any idea what am I doing wrongly?

Это было полезно?

Решение

Problem solved: KDE is looking for icons and .desktop files at the following locations.

SET(DDM_DESKTOP_DIR     "/usr/share/applications/")
SET(DDM_PIXMAPS_DIR     "/usr/share/icons/")

This did solve the problem.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top