[CMake] CPack: .desktop files with tar.gz maker?

Clinton Stimpson clinton at elemtech.com
Fri Nov 7 19:07:47 EST 2014


On Friday, November 07, 2014 03:50:32 PM Eric Wing wrote:
> I have a build and packaging system where I can distribute (mostly)
> standalone apps for Linux desktop. I am using the default CPack
> installer which creates .tar.gz, .Z, and .sh files.
> 
> I like this opposed to the .deb/.rpm package systems because users
> don't need root access to install/use my stuff (and can place
> anywhere), and I only need a single package for all Linux desktops.
> 
> But it's pretty plain-Jane and it would be nice to provide an icon or
> something. So I was wondering if anybody had
> suggestions/advice/strategies on supporting .desktop files. As far as
> I can tell, I need paths to the icon and the executable, which is
> completely variable based on where the user puts it. And I'm not sure
> where this file is supposed to be written to. (Remember that I don't
> use root access.)
> 
> Thanks,
> Eric

Perhaps you can do this:

Include the .desktop file in your installation.

To add, your installer can call
xdg-desktop-menu install <install>/share/applications/MyApp.desktop

To remove, your installer can call
xdg-desktop-menu uninstall <install>/share/applications/MyApp.desktop

If xdg-desktop-menu is called as root, it'll copy the .desktop file to the 
system location.  If it is called as a non-root user, it'll copy the file to 
the user specific desktop area.  xdg-desktop-menu also takes care of refreshing 
the icons in the launcher.

During uninstall, it'll remove the copy.

By the way, we do .rpm and .deb, but also give instructions for users to 
extract the files if they want their own installation directory.

The above .desktop support can be put in a script and added to the postinst 
and prerm scripts for rpm and deb.

This makes things more automatic for the majority of our users (basically 
download-click-and-run).

Clint



More information about the CMake mailing list