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

Eric Wing ewmailing at gmail.com
Sun Nov 9 07:22:08 EST 2014


On 11/7/14, Clinton Stimpson <clinton at elemtech.com> wrote:
> 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
>
>

Thanks for the information. Based on that, I wrote a script that is
bundled with the contents and when run, will generate the correct
.desktop file with the correct absolute paths needed and invoke
xdg-desktop-menu install.

I noticed that the CPack tarball generator also generates a
self-extracting .sh ball. Is there anyway to hook into that to add a
postinst like stage so I can invoke my script?

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/


More information about the CMake mailing list