Page 1 of 1

Respect DESTDIR during install

Posted: Sun Jul 28, 2013 3:14 pm
by csh
Here's a small patch against the 'Release 7.3' branch to account for the DESTDIR environment variable during install:

https://www.dropbox.com/s/lf58yyn8kdhh15f/destdir.patch

This is essential for MacPorts (see the destroot entry here), but may also be useful for packaging on other platforms.

Re: Respect DESTDIR during install

Posted: Sun Jul 28, 2013 4:59 pm
by csh
One more patch for Python 3 builds:

https://www.dropbox.com/s/5lku2stnznco6 ... -py3.patch

Re: Respect DESTDIR during install

Posted: Mon Jul 29, 2013 9:37 am
by hines
Thanks for the patches. I was unaware of DESTDIR. I do have a question, though, before I commit. In nrn/src/Makefile.am in four places
you replace

Code: Select all

$(prefix)
with

Code: Select all

$(DESTDIR)/$(bindir)
and I am wondering about the extra '/' and whether it should be

Code: Select all

$(DESTDIR)$(bindir)
Just a few weeks ago I had a problem with a path that began with '//'. But I want to verify that your install tests succeed without the extra '/'.

Re: Respect DESTDIR during install

Posted: Mon Jul 29, 2013 9:49 am
by hines
Sorry. For $(prefix) above I meant $(bindir). That is in three places and $(prefix) is in one place.

Re: Respect DESTDIR during install

Posted: Mon Jul 29, 2013 10:29 am
by csh
hines wrote:Thanks for the patches. I was unaware of DESTDIR. I do have a question, though, before I commit. In nrn/src/Makefile.am in four places
you replace

Code: Select all

$(prefix)
with

Code: Select all

$(DESTDIR)/$(bindir)
and I am wondering about the extra '/' and whether it should be

Code: Select all

$(DESTDIR)$(bindir)
Just a few weeks ago I had a problem with a path that began with '//'. But I want to verify that your install tests succeed without the extra '/'.
Yes you're right, these path separators are unnecessary. Updated incremental patches are here (separator fix is at the bottom):

https://www.dropbox.com/s/x8pmkvc2alt9h ... -all.patch

Re: Respect DESTDIR during install

Posted: Mon Jul 29, 2013 11:28 am
by hines
Thanks again. I pushed the patches (slightly modified so that the absence of a DESTDIR does not affect setup.py).
http://www.neuron.yale.edu/hg/neuron/nr ... b4d7b9ecb1

Re: Respect DESTDIR during install

Posted: Mon Jul 29, 2013 11:51 am
by csh
hines wrote:Thanks again. I pushed the patches (slightly modified so that the absence of a DESTDIR does not affect setup.py).
http://www.neuron.yale.edu/hg/neuron/nr ... b4d7b9ecb1
Oops, didn't realize that os.getenv returns None if it can't find the variable, thanks for catching that.

There's also the option to call getenv with a default value:

Code: Select all

destdir = os.getenv("DESTDIR", "")
which might save you 2 lines.