[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automake - distcheck fails on install-data-local
From: |
Asaf Dalet |
Subject: |
Re: Automake - distcheck fails on install-data-local |
Date: |
Mon, 23 Feb 2015 09:30:26 +0200 |
Thanks, Tyler. That fixed it.
Once again I was beaten by DESTDIR...
It seems that this variable is only set when running distcheck and not when
running install? am I right?
On Sun, Feb 22, 2015 at 11:01 PM, Tyler Retzlaff <address@hidden>
wrote:
> 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
>>
>
>