• L
    build: add $(prefix) to SYSTEMD_UNIT_DIR · 00e9d607
    Laine Stump 提交于
    I noticed this problem when adding systemd support to netcf, because I
    setup the configure.ac to automatically prefer using systemd over
    initscripts when possible - although I had copied the
    install-data-local target from the example of libvirt's
    "libvirt-guests" service more or less verbatim, "make distcheck" would
    fail because it was trying to install the service file directly into
    /lib/systemd/system rather than into
    /home/user/some/unimportant/name/lib/systemd/system.
    
    This is caused by the install/uninstall rules for the systemd unit
    files relying on $(DESTDIR) pointing the installed files to the right
    place, but in reality $(DESTDIR) is empty during this part of make
    distcheck - it instead sets $(prefix) with the toplevel directory used
    for its test build/install/uninstall cycle.
    
    (This problem hasn't been seen when running "make distcheck" in
    libvirt because libvirt will never build/install systemd support
    unless explicitly told to do so on the configure commandline, and
    "make distcheck" doesn't put the "--with-initscript=..." option on the
    configure commandline.)
    
    I verified that the same problem does exist in libvirt by modifying
    libvirt's configure.ac to set:
    
      init_systemd=yes
      with_init_script=systemd+redhat
    
    This forces a build/install of the systemd unit files during
    distcheck, which yields an error like this:
    
    /usr/bin/install -c -m 644 virtlockd.service \
      /lib/systemd/system/
    libtool: install: warning: relinking `libvirt-qemu.la'
    /usr/bin/install: cannot remove '/lib/systemd/system/virtlockd.service': Permission denied
    make[4]: *** [install-systemd] Error 1
    
    After adding $(prefix) to all the definitions of SYSTEMD_UNIT_DIR,
    make distcheck now completes successfully with the modified
    configure.ac, and the above lines change to something like this:
    
    /usr/bin/install -c -m 644 virtlockd.service \
      /home/laine/devel/libvirt/libvirt-1.2.1/_inst/lib/systemd/system/
    00e9d607
Makefile.am 13.5 KB