Hi,
The newly introduced rework of (desktop) icons breaks installing to stage dir
Right now the state of the head of the vice-emu repo is that you cannot build and install into stage dir as a non-privileged user as the desktop icon install requires super-user (root) and ignores the stage dir location
Building and installing to stage dirs are usually something that distribution-package-builders do in order to snapshot the full hierarchical structure into an archive (distribution package) without installing.
Below is the last failing parts of an attempt to install into stage dir "/tmp/vice-3.9/" (by setting DESTDIR)
make install-data-hook
make[5]: Entering directory '/tmp/vice-emu-devel/_build.out/gtk/data/common'
xdg-icon-resource install --size 32 /tmp/vice-emu-devel/data/common/vice-x64_32.png vice-x64
xdg-icon-resource install --size 48 /tmp/vice-emu-devel/data/common/vice-x64_48.png vice-x64
xdg-icon-resource install --size 64 /tmp/vice-emu-devel/data/common/vice-x64_64.png vice-x64
xdg-icon-resource install --size 256 /tmp/vice-emu-devel/data/common/vice-x64_256.png vice-x64
...
...
...
xdg-icon-resource install --size 32 /tmp/vice-emu-devel/data/common/vice-vsid_32.png vice-vsid
xdg-icon-resource install --size 48 /tmp/vice-emu-devel/data/common/vice-vsid_48.png vice-vsid
xdg-icon-resource install --size 64 /tmp/vice-emu-devel/data/common/vice-vsid_64.png vice-vsid
xdg-icon-resource install --size 256 /tmp/vice-emu-devel/data/common/vice-vsid_256.png vice-vsid
desktop-file-install /tmp/vice-emu-devel/data/common/x64.desktop
Error on file "/tmp/vice-emu-devel/data/common/x64.desktop": Failed to create file “/usr/share/applications/x8S312”: Permission denied
make[5]: *** [Makefile:982: install-desktop-files] Error 1
make[5]: Leaving directory '/tmp/vice-emu-devel/_build.out/gtk/data/common'
make[4]: *** [Makefile:798: install-data-am] Error 2
make[4]: Leaving directory '/tmp/vice-emu-devel/_build.out/gtk/data/common'
make[3]: *** [Makefile:747: install-am] Error 2
make[3]: Leaving directory '/tmp/vice-emu-devel/_build.out/gtk/data/common'
make[2]: *** [Makefile:459: install-recursive] Error 1
There are several ways to workaround this issue - either:
1) add something similar to option "--dir=$(DESTDIR)/share/applications" to "desktop-file-install" - but only in situations where DESTDIR is actually set... (env var DESKTOP_FILE_INSTALL_DIR works equivalent of the option)
2) setting env-var RPM_BUILD_ROOT before calling "desktop-file-install" will also do the job - but the paths it populates below DESTDIR is a little different the option 1)
see man page of "desktop-file-install" for more info...
br/Uffe
Thanks for reporting this.
Option 1 seems the best since it's distro-agnostic, unlike option 2. I'll experiment a bit with
DESKTOP_FILE_INSTALL_DIRin a VM.Do the icon files end up in the correct place at least? I know
xdg-icon-resourcewill implicitly set its--modeargument to either 'system' or 'user' depending on whether its called as root or a normal user.Quote: "Do the icon files end up in the correct place at least? "
I'm not really if your previous post actually contains a question for me ?
without any of the above workarounds - nothing gets written due to (non-root) permission errors.
I'm also in favour of option 1)
Setting dir to "$(DESTDIR)/share/applications" seems to do the job
That was a question for you indeed =)
It doesn't look like
xdg-icon-resourcetriggers errors, so I'm wondering where the icons end up. I assume since you're not running as root they are installed into$XDG_DATA_HOME/icons/hicolor, e.g.~/.local/share/icons/hicolor/, and not into the staging virtual root of, say,/tmp/vice-3.9-svn/usr/local/share/icons/hicolor/?Ah sorry I was not up-to-par on the implementation details on your change
But you are right - invocations of
xdg-icon-resouceruns without errorFor my non-root staging installs it appears the
xdg-icon-resourceinstalls into~/.local/share/icons/hicolor/<SIZE>x<SIZE>/apps/As it ran without error I did not think more about it...
I guess that it should be directed info the staging dir - as it would be missing from the resulting distribution-packaging... ?
For inclusion in pkgsrc I had already some patches to install the gtk3 desktop files properly in the staging directory. Essentially it uses
--mode systemto get them to the right place (the place where a privileged install would put them even though the install is done as a mere user.This isnt' quite enough for the staging install, it also needs this in the pkgsrc Makefile to move some files around:
Note how I commented "Mess created by xdg-utils". I have a vague recollection that the xdg-tools were behaving in a very annoying way when I was trying to get the staging directory right. I am not even sure it's possible to write something that works equally well for a staging directory as a direct install. (This is why I haven't proposed to make this change to Vice itself) I blame the xdg tools. They are probably just as annoying when handling the icons.
I've committed a possible fix for the installation of
.desktopfiles into a staging directory in r45506.The commit uses
--dir=$(DESTDIR)/usr/share/applications, not$(DESTDIR)/share/applicationslike in the first post.The reason for this is that when I leave out
/usrI'll have to add it toDESTDIRwhen invokingmake, resulting in the non-desktop files ending up in/usr/usrin the staging install directory (I used--prefix=/usrwhen running configure).As far as I can tell, this is how
DESTDIRis used: the "virtual root" of the staged install, when reading the docs of GNUmake.Yes your understanding of
$(DESTDIR)is correct. But I would use--dir=$(DESTDIR)$(PREFIX)/share/applicationsinstead of--dir=$(DESTDIR)/usr/share/applications, so that the value fromconfigure --prefix=/usr/local(or whatever directory) is used.(there is no
/needed between the two variables, because$(PREFIX)always starts with a/, and also because$(DESTDIR)can be empty.)In the second part,
rm -f $(DESTDIR)/share/applications/x64{,dtv,sc}.desktop ;\etc, the/usror$(PREFIX)got lost completely.Ah yes, using
$(DESTDIR)$(PREFIX)would indeed allow for proper handling of--prefix. But since (at least on my Debian system).desktopfiles live in/usr/share/applications(i.e.--prefix=/usr) and/usr/local/share/applicationsdoesn't exist, I wonder if this will break the VICE default of the/usr/localprefix.I tend to use the
/usr/localprefix (like VICE) for non-package manager software (or/optfor stuff I don't want to be available throughPATH), and I think installing the.desktopfiles into/usr/local/share/applicationswould result in Gnome (andupdate-desktop-database) failing to notice the new files.And yes, looks like the
uninstall-desktop-filesrule got mangled during copy/paste/edit =)Looking at the contents of the
XDG_DATA_DIRSenv var on my system, it looks like Gnome will pick up the files from/usr/local/share/applications. The variable contains/usr/share/gnome:/usr/local/share/:/usr/share/when echoed from bash. Hopefully the same is true for non-login shells.Will have to test though.
That sounds promising.
For things like pkgsrc, I am kind of assuming that if somebody is running a desktop environment built to $PREFIX, it will search for desktop files and everything else in $PREFIX/...whatever. "Assuming" because I just run ctwm and not a "desktop environment" at all.
Since SF is having problems, here's a diff of the changes I just tried to commit:
When I get back from work I'll try to commit again.
With commit https://sourceforge.net/p/vice-emu/code/45507
non-root installs into staging area now runs without error...
PS: I know that the icons files are still not handled correct - but at least the install target does not error out :-)
Good to hear at least the .desktop file installation now works correctly =)
The icons will be next, but
xdg-icon-resourcedoesn't have a--dirswitch to control where the icons end up. Looking at the script, it does useXDG_DATA_HOME. so perhaps passing something akin toXDG_DATA_HOME=/tmp/vice-3.9/usr/sharetomake installwill make the icons end up in the correct location.Just tried using
XDG_DATA_HOMEand indeed my cunning plan seems to work. I use/tmp/vice-3.9/buildas my build dir and/tmp/vice-3.9/distas the staging dir, and when running:The icon files end up in
/tmp/vice-3.9/dist/usr/share/icons/hicolor/{32x32,48x48,64x64,256x256}/apps/.I assume your RPM package manager will run post-install hooks running things like
update-desktop-databaseandgtk-update-icon-cacheafter unpacking, in which case this looks like the cleanest solution for the icon files, to me.Whats the status of this? Can we close the ticket? Or is there still something left that needs to be fixed?
Hi,
I just checked up on this issue
The icon files are still not installed into the staging area.
The solution is described above - but it does not seem to be implemented into the install make target
I can see if I can find sometime to produce a patch - if I'm lucky at $WORK - I may have some spare time tomorrow evening :-)
Ok - problems with github prevented me from working - that bought me some time to look at the patch
This fix only kicks in with installing into stage dir (using DESTDIR) - if that is not the case everything works unchanged
Patch attached
applied to r45858 - please test.
Mmmh that said, are the icons actually installed - as in copied into the system somewhere? i cant find them anywhere, except in the sourcetree, after "make install" shrug
nevermind, found them... they are renamed in the process :o)
I can confirm that the current code fulfills my needs (as I made the patch :-D )
Icon files are now installed into the staging dir (and that was what I needed)
Fine, closing :)