automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automake - distcheck fails on install-data-local


From: Tyler Retzlaff
Subject: Re: Automake - distcheck fails on install-data-local
Date: Sun, 22 Feb 2015 16:01:44 -0500
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi,

On 2/22/2015 3:40 AM, Asaf Dalet wrote:
Hi
I am trying to do a conditional sysconf_DATA, meaning, I want to install my
conf file into $(sysconfdir) only if it is not already installed.

i tried to use install-data-local and it seems to work on a real
installation, but 'make distcheck' fails.
Your target rules aren't obeying DESTDIR.
install-data-local:
        @if test -f "$(sysconfdir)/settings.conf"; then \
          echo settings.conf already exists at $(sysconfdir). not overriding.; \
        else \
          mkdir -p $(sysconfdir); \
          cp $(srcdir)/conf/settings.conf $(sysconfdir)/settings.conf; \
        fi
        echo "conf_dir=$(sysconfdir)" >> "$(sysconfdir)/settings.conf";

When these execute they'll be working on --prefix and --sysconfdir which probably in your project defaults to /usr/local and /usr/local/etc respectively during the make distcheck.

You need to use DESTDIR in your target rules.

Use cp conf/settings.conf $(DESTDIR)$(sysconfdir)/settings.conf

This way when make distcheck performs the install it will copy to DESTDIR and not the running system.

uninstall-local:
        rm -rf $(sysconfdir)
        rm -rf $(docdir)

Definitely you need to fix this. If you were to run distcheck as root you would have just deleted /etc on your system (assuming default --prefix and --sysconfdir)

Instead try something like.

uninstall-local:
    rm -f $(DESTDIR)$(sysconfdir)/settings.conf

Keep in mind you can probably test these things without full make distcheck by doing.

make install DESTDIR=`pwd`/testprefix

Further reading see use of DESTDIR in the examples here.
http://www.gnu.org/software/automake/manual/html_node/Extending.html

Good luck,

Tyler


what's going on...?

Thanks,
Asaf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]