Honor DESTDIR in w32api and mingw

Charles Wilson cygwin@cwilson.fastmail.fm
Sun Oct 18 23:27:00 GMT 2009


Dave Korn wrote:
> Yes, I think everything that lives in the /src repository should
> consider itself obliged to adhere to the common conventions. ... That
> ought to be able to accommodate everyone's wishes, no?

With regards to the limited issue of DESTDIR (not all the other issues
surrounding mingw/ and w32api/ as subdirs of the winsup tree), the
following revised patch ought to make everybody happy.


We'll see what Keith says -- I've pasted a copy of my latest message to
mingw-dvlpr, below:

Keith Marshall wrote:
> I would rather say that it [DESTDIR] is deliberately
> unsupported, because it cannot be made to work, on the platform for 
> which the code is designated.

The real issue is that when configured such that prefix (or any other
configured directory like includedir) contains X:, then DESTDIR won't work.

If prefix does not contain X:, then DESTDIR will work whether it does or
does not itself contain Y: -- subject to the usual caveats about does
the destination exist, do you have permission to write or create
directories there, etc.

And if neither prefix nor DESTDIR contain X:, as is the usual case when
win32 is not involved, then DESTDIR will work (subject to the usual
caveats).

So, how about we flag that with an explicit error message, thus making
it clear that the answer to "Doctor, it hurts when I do this" is "Don't
do that then -- it is *not supported*"

$ make -n install DESTDIR=/tmp/foo prefix=C:/bob
Makefile:26: *** DESTDIR not supported when prefix contains win32 path:
C:/bob.  Stop.

This is the key bit of code, repeated in all 7 makefiles:

prefix_drive:=$(shell echo "$(prefix)" | sed -n -e 's|\(^.:\).*$$|\1|p')
ifneq (,$(DESTDIR))
ifneq (,$(prefix_drive))
$(error DESTDIR not supported when prefix contains win32 path: $(prefix))
endif
endif


I could extend the error message, as below if desired:

$ make -n install DESTDIR=/tmp/foo prefix=C:/bob
Makefile:44: *** DESTDIR not supported when $(prefix) contains win32
path: C:/bob. Try this instead: 'make install prefix=/tmp/foo/bob'.  Stop.

Which would look like this:

prefix_drive:=$(shell echo "$(prefix)" | sed -n -e 's|\(^.:\).*$$|\1|p')
ifneq (,$(DESTDIR))
ifneq (,$(prefix_drive))
prefix_path:=$(shell echo "$(prefix)" | sed -e 's|^.:||')
$(error DESTDIR not supported when $$(prefix) contains win32 path:
$(prefix). Try this instead: 'make install prefix=$(DESTDIR)$(prefix_path)')
endif
endif




I suppose it's possible for prefix to contain a posix-style path, but
some OTHER configured directory to be win32-style. This error-checking
won't catch that.  But if somebody does "--prefix=/foo
--includedir=C:\bar" and then they ALSO try to do a DESTDIR
install...frankly, if they complain about that on the list we should
break out the giant clue-bat and metaphorically beat them with it. That
setup is just...pathological.


Anyway, this allows for mingw/ and winsup/ to support DESTDIR like the
rest of src -- for those platforms and configurations where it will
actually work; while making it clear that for win32ish configuration
"Don't Do That".

Revised patch attached.

2009-10-18  Charles Wilson  <...>

	Honor DESTDIR for winsup/mingw and winsup/w32api.
	Error if $(prefix) contains win32 path but DESTDIR non-empty.
	* winsup/mingw/Makefile.in: Honor DESTDIR and add to
	FLAGS_TO_PASS.
	* winsup/mingw/mingwex/Makefile.in: Honor DESTDIR.
	* winsup/mingw/profile/Makefile.in: Honor DESTDIR.
	* winsup/w32api/Makefile.in Honor DESTDIR and add to
	FLAGS_TO_PASS.
	* winsup/w32api/lib/Makefile.in: Honor DESTDIR and add to
	FLAGS_TO_PASS.
	* winsup/w32api/lib/ddk/Makefile.in: Honor DESTDIR.
	* w32api/lib/directx/Makefile.in: Honor DESTDIR.

--
Chuck
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mingw-destdir.patch3
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20091018/b9c7f480/attachment.ksh>


More information about the Cygwin-patches mailing list