automake
[Top][All Lists]
Advanced

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

Re: Are there shell equivalents to PREFIX etc.?


From: Nick Bowler
Subject: Re: Are there shell equivalents to PREFIX etc.?
Date: Mon, 28 Mar 2016 16:49:45 -0400

Hi Andy,

(Note that your mailer seems to have completely mangled all whitespace,
particularly the newlines, in your make snippet.  This makes it very
hard to read.  I have tried to manually correct it in the quoted text).

On 2016-03-28, Andy Falanga (afalanga) <address@hidden> wrote:
> My question is, I hope, quite simple.  I have a case where I made some
> distribution, installation and uninstall hooks in my Makefile.am:
>
>   EXTRA_DIST = setupenv.sh bootstrap tests
>
>   dist-hook:
>       rm -rf $$(find $(distdir)/tests -name \*.swp -o -name \*.pyc)
>
>   install-exec-hook:
>       mkdir -p $(prefix)/unit_tests/unittest2
>       for f in tests/*.py; do \
>         cp $$f $(prefix)/unit_tests; \
>       done
>       for f in tests/unittest2/*.py; do \
>         cp $$f $(prefix)/unit_tests/unittest2; \
>       done
>
>    uninstall-hook:
>       rm -r $(prefix)/unit_tests
>
> Ordinarily, this works just fine.  However, when building the RPM for
> this software, the prefix is set to an alternative location in /opt.  I
> would have thought that the rules I've written would have worked with
> the RPM build system.  This isn't quite the case though.  When executing
> my install hook, the mkdir command fails because the common user doesn't
> have permissions to make directories in /opt/..... .

I suspect your immediate problem is simply that your rules are not
respecting ${DESTDIR}.  See the Automake manual, section 12.4 "Staged
Installs"[1].  The RPM packager is almost certainly using this feature,
so you need to support it.  "make distcheck" tries to check that your
package properly supports this function, and probably would have caught
this issue.

Basically, all filenames that point to installed file locations must
start with ${DESTDIR}, for example:

  install-exec-hook:
        mkdir -p ${DESTDIR}${pkgdatadir}/foo
        cp ${srcdir}/file1 ${DESTDIR}${pkgdatadir}/foo

Fixing this is probably enough to make the RPM packager happy.

Note that your rule should most likely also specify ${srcdir} on the
source filename (unless these are generated files), otherwise VPATH
installations may fail (distcheck should catch this too).

As an aside, packages generally should not install files directly in
${prefix}; consider defining a separate directory variable, such as:

  unittestdir = ${prefix}/unit_tests

Finally, these files look to me like they really belong in a
package-specific installation directory by default, such as:

  unittestdir = ${pkglibexecdir}/unit_tests

[1] https://gnu.org/software/automake/manual/automake.html#Staged-Installs

Hope that helps,
  Nick



reply via email to

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