Hi Mathieu, Sorry for the late reply -- been busy, you know how it goes.
On Mon, May 30, 2016 at 04:48:57PM +0200, Mathieu Lirzin wrote: > Wouter Verhelst <w...@uter.be> writes: > > > On Tue, May 24, 2016 at 06:11:47PM +0200, Mathieu Lirzin wrote: > >> > >> ‘systemdsystemunitdir’ seems not affected by DESTDIR because IIUC > >> PKG_CHECK_VAR set it to something like "/lib/systemd/system" instead of > >> "${libdir}/systemd/system". > >> > >> I suppose it would work better to define it manually like > >> this: > >> > >> if SYSTEMD > >> systemdunitdir = $(libdir)/systemd/system > >> systemdunit_DATA = nbd@.service > >> endif > > > > Well. That would work, yes, but it wouldn't work *better*. The whole > > point is that I do not want to hardcode such things, so that if a user > > installs systemd units in </usr/local/brokenstuff/systemd> and the > > pkg-config files are where they need to be, everything works as expected. > > You are right, that would be better. My understanding is that > pkg-config files are supposed to define variables in terms of 'prefix' > as described in pkg-config(1) > > --8<---------------cut here---------------start------------->8--- > prefix=/home/hp/unst # this defines a variable > exec_prefix=${prefix} # defining another variable in terms of the first > libdir=${exec_prefix}/lib > includedir=${prefix}/include > --8<---------------cut here---------------end--------------->8--- > > but “systemd.pc” isn't doing that. I'm not convinced that is the right way to fix this. Yes, perhaps the systemd .pc file could export $prefix-prefixed variables. However, that doesn't help -- it's *systemd*'s prefix it would be prefixing with, not nbd's prefix. If someone installed systemd with --prefix=/opt, and then installed nbd with --prefix=/usr, then in your suggestion, nbd would be installing the systemd unit files into /usr/lib/systemd, where they should really have been installed into /opt/lib/systemd. It's not limited to that kind of stuff, either -- it would also break if someone were to configure systemd with an explicit --libdir=, where the .pc file is generated with AC_CONFIG_FILES. Please remember that I'm installing a file for systemd to use, not a file for nbd to use (in this particular case it's a systemd configuration file, but it could equally well have been a plugin, or an extension, or whatever). > > I was under the impression that automake looks at DESTDIR for every > > foodir it looks at, but apparently that's not the case then? That seems > > broken; after all, I don't think a staging directory should depend on > > whether or not something was part of a given prefix. Is there any > > explanation available somewhere on why this behaviour occurs? Would a > > patch that changes this behaviour be acceptable? > > Every default installation directories are expected to be subdirectories > of the 'prefix' variable. This is verified by ‘make distcheck’ and > specified in GNU coding standards: > > > https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables > > So it is unlikely that a patch is going to be accepted in Automake. Not even for the --foreign mode of automake? > However I guess the default pkg-config file could be fixed in Systemd. That would mean the nbd build will break for everyone who did a non-default build of systemd... not a very attractive proposal. -- < ron> I mean, the main *practical* problem with C++, is there's like a dozen people in the world who think they really understand all of its rules, and pretty much all of them are just lying to themselves too. -- #debian-devel, OFTC, 2016-02-12