On 2016-05-24, Wouter Verhelst <w...@uter.be> wrote: > I'm adding a systemd unit to my package. To that end, I'm checking if > there is a pkg-config .pc file for systemd which sets a variable > "systemdsystemunitdir", and am trying to install the systemd unit in > that location. [snip configure script computes systemdunitdir from pkg-config] > and then in my Makefile.am: > > if SYSTEMD > systemdunit_DATA = nbd@.service > endif > > (if you need the full files, they're in the git repository at > git.debian.org/users/wouter/nbd.git) > > However, now my "make distcheck" fails, because the "make install" > target disregards DESTDIR and tries to install files in the actual > systemd unit directory, rather than the staging one. Clearly this means > I'm doing something wrong, but I'm not sure what the proper way for > doing this would be.
I suspect it is not the DESTDIR check which is failing -- the problem is that your installation directory ignores prefix. The package must install all files into ${prefix}-relative locations by default. Basically, distcheck is telling you that unprivileged installs will fail because they try to install to /usr somewhere. Here are some basic options, in increasing order of complexity: - Don't install the unit files (user can copy them manually). - Don't autodetect at all: just default to some ${prefix}-relative installation directory and allow the user to change it manually. E.g., make systemdunitdir=/path/to/wherever. - Munge the autodetected path into something relative to ${prefix}. See "Installing to Hard-Coded Locations"[1] in the Automake manual for some more information on this topic. [1] https://www.gnu.org/software/automake/manual/automake.html#Hard_002dCoded-Install-Paths Cheers, Nick