Respect DESTDIR during install

Post Reply
csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Respect DESTDIR during install

Post by csh » Sun Jul 28, 2013 3:14 pm

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.

csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Re: Respect DESTDIR during install

Post by csh » Sun Jul 28, 2013 4:59 pm

One more patch for Python 3 builds:

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

hines
Site Admin
Posts: 1528
Joined: Wed May 18, 2005 3:32 pm

Re: Respect DESTDIR during install

Post by hines » Mon Jul 29, 2013 9:37 am

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 '/'.

hines
Site Admin
Posts: 1528
Joined: Wed May 18, 2005 3:32 pm

Re: Respect DESTDIR during install

Post by hines » Mon Jul 29, 2013 9:49 am

Sorry. For $(prefix) above I meant $(bindir). That is in three places and $(prefix) is in one place.

csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Re: Respect DESTDIR during install

Post by csh » Mon Jul 29, 2013 10:29 am

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

hines
Site Admin
Posts: 1528
Joined: Wed May 18, 2005 3:32 pm

Re: Respect DESTDIR during install

Post by hines » Mon Jul 29, 2013 11:28 am

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

csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Re: Respect DESTDIR during install

Post by csh » Mon Jul 29, 2013 11:51 am

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.

Post Reply