Honor DESTDIR in w32api and mingw

View: New views
20 Messages — Rating Filter:   Alert me  

Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[Cross-posted to cygwin-patches, but as both lists are by subscription
only, and I'm subscribed under separate aliases, I can't "link" the two
posts].

For a number of reasons [*], when building w32api and mingw-runtime
"natively" under MinGW/MSYS, DESTDIR is known not to work. However,
that's no reason not to support it when building with a cross-compiler
or when building natively under cygwin.

The attached patch allows DESTDIR installations to succeed, at least in
those configurations where it would work otherwise [*]. As usual, if
DESTDIR is empty there should be no impact on existing behavior.

[*] when prefix is DOS-ized to "C:/foo", ${DESTDIR)$(prefix) is usually
not what you want: /tmp/barC:/foo or C:/TEMPC:/foo. This is a known
issue, and is not what I'm trying to address.

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

        Honor DESTDIR for winsup/mingw and winsup/w32api.
        * 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


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

mingw-destdir.patch (15K) Download Attachment

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In response to comments here:
  http://cygwin.com/ml/cygwin-patches/2009-q4/msg00103.html
revised below.

Who can approve this?  Ok to commit?

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

        Honor DESTDIR for winsup/mingw and winsup/w32api.
        * 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


Index: winsup/mingw/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.in
--- winsup/mingw/Makefile.in 27 Jul 2009 20:27:09 -0000 1.89
+++ winsup/mingw/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -204,6 +204,7 @@ FLAGS_TO_PASS:=\
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  exec_prefix="$(exec_prefix)" \
  bindir="$(bindir)" \
  libdir="$(libdir)" \
@@ -274,7 +275,7 @@ all_dlls_host: $(DLLS)
 
 install_dlls_host:
  for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
  done
 
 _libm_dummy.o:
@@ -494,37 +495,37 @@ info-html:
 install-info: info
 
 install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
- $(mkinstalldirs) $(inst_docdir)
- $(mkinstalldirs) $(mandir)/man$(mansection)
+ $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
 
 install: all install-dirs $(install_dlls_host)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(INSTDOCS); do \
- $(INSTALL_DATA) $(srcdir)/$$i $(inst_docdir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
  done
  for sub in . sys ; do \
  dstdir=$(inst_includedir)/$$sub ; \
- $(mkinstalldirs) $$dstdir ; \
+ $(mkinstalldirs) $(DESTDIR)$$dstdir ; \
  for i in $(srcdir)/include/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$$dstdir/`basename $$i` ; \
  done ; \
  done
 #
 # This provisional hack installs the only manpage we have at present...
 # It simply CANNOT suffice, when we have more manpages to ship.
 #
- $(mkinstalldirs) $(mandir)/man$(mansection)
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
 #
 # End provisional hack.
Index: winsup/mingw/mingwex/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/mingwex/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- winsup/mingw/mingwex/Makefile.in 27 Jul 2009 20:27:09 -0000 1.47
+++ winsup/mingw/mingwex/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -256,9 +256,9 @@ info-html:
 install-info: info
 
 install: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 clean:
Index: winsup/mingw/profile/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/profile/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- winsup/mingw/profile/Makefile.in 27 Jul 2009 20:27:09 -0000 1.17
+++ winsup/mingw/profile/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -129,17 +129,17 @@ info-html:
 install-info: info
 
 install: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/$$sub ; \
  for i in $(srcdir)/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$(inst_includedir)/$$sub/`basename $$i` ; \
  done ; \
  done
 
Index: winsup/w32api/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- winsup/w32api/Makefile.in 6 Dec 2008 02:25:28 -0000 1.47
+++ winsup/w32api/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -58,6 +58,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
Index: winsup/w32api/lib/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/Makefile.in,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.in
--- winsup/w32api/lib/Makefile.in 29 Jan 2008 21:18:49 -0000 1.46
+++ winsup/w32api/lib/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -101,6 +101,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -213,19 +214,19 @@ lib%.a: %.o
 install: install-libraries install-headers install-ddk install-directx
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- $(mkinstalldirs) $(inst_includedir)/GL
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
  for i in $(GL_HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
  done
 
 install-ddk: install-libraries install-headers
@@ -239,15 +240,15 @@ uninstall: uninstall-ddk uninstall-direc
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 uninstall-ddk:
  cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
Index: winsup/w32api/lib/ddk/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/ddk/Makefile.in,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.in
--- winsup/w32api/lib/ddk/Makefile.in 12 Sep 2006 00:29:04 -0000 1.5
+++ winsup/w32api/lib/ddk/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -145,15 +145,15 @@ lib%.a: %.o
 install: install-libraries install-headers
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
@@ -161,15 +161,15 @@ uninstall: uninstall-libraries uninstall
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:
Index: winsup/w32api/lib/directx/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/directx/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- winsup/w32api/lib/directx/Makefile.in 12 Sep 2006 00:29:04 -0000 1.4
+++ winsup/w32api/lib/directx/Makefile.in 15 Oct 2009 20:30:09 -0000
@@ -170,15 +170,15 @@ lib%.a: %.o
 install: install-libraries install-headers
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
@@ -186,15 +186,15 @@ uninstall: uninstall-libraries uninstall
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Chuck,

On Friday 16 October 2009 21:58:41 Charles Wilson wrote:

> In response to comments here:
>   http://cygwin.com/ml/cygwin-patches/2009-q4/msg00103.html
> revised below.
>
> Who can approve this?  Ok to commit?
>
> 2009-10-15  Charles Wilson  <...>
>
> Honor DESTDIR for winsup/mingw and winsup/w32api.
> * 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.

I'm opposed to this.  I've rejected similar patches in the past; why
should I make an exception in your case?  What *problem* does adding
DESTDIR *solve*, that isn't better accommodated by simply overriding
prefix at `make install' time?

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:
> I'm opposed to this.  I've rejected similar patches in the past; why
> should I make an exception in your case?  

I'm not asking for special treatment. I wasn't aware you had
specifically rejected patches like this in the past. I was aware of your
general disdain for DESTDIR.

> What *problem* does adding
> DESTDIR *solve*, that isn't better accommodated by simply overriding
> prefix at `make install' time?

Because you are forcing YOUR build preferences onto OTHER projects.
winsup/cygwin installs fine with DESTDIR.  winsup/cygserver,
winsup/lsaauth/, and winsup/utils do as well.  automake (which you may
despise, but it IS a GNU tool with wide acceptance) supports it.

But if I try to do a 'make install DESTDIR=' from winsup/, it will die
once it reaches winsup/mingw or winsup/w32api, which are both integral
parts not just of mingw, but also of cygwin as represented by those
other four subdirectories.

I don't understand your opposition. If it's there, *you* don't have to
use it, but *I* can.  If it's not there, I can't use it at all, even
though the rest of the 'cygwin' tree supports it.  Why do you hate
cygwin? <g>

Now, as far as actual problems with overriding prefix: of course there
are none; I can install all of winsup including the cygwin bits that
way. But why should I, just because you don't want to use DESTDIR (or,
can't, as in native mingw).

OTHER PROJECTS:

On /other/ projects, I have seen bugs, where if you aren't careful in
overriding directories on the configure line, you end up with the
following in the Makefile:

prefix = /my/prefix
includedir = /my/prefix/override/include
           # rather than $(prefix)/override/include

Obviously, this is user error; if you override something on the
configure line, be sure to also override it on the make install line as
well.  However, there's another issue that often appears (but not here).
 That is, sometimes -- and I'm not sure how, exactly, got to leave soon
-- but you end up with some directory you /don't know about/ hardcoded
to the expanded version of $(prefix), even though -- because you didn't
know it even existed -- you did not specify it on the configure line.
That is:

prefix = /usr
datarootdir = $(prefix)/share
myspecialdir = /usr/share/specialstuff

Like I said, I don't know how this happens, and its arguably a
Makefile.in bug, because it SHOULD have been replaced with something
like $(prefix)/specialstuff in this example.

Now, as you've pointed out in the past, these are bugs, The FSF requires
that reassigning prefix during make install should work.  But DESTDIR is
a commonly-accepted mechanism, too.  And it works for *MOST* of cygwin
-- just not the mingw bits.

Again, I don't understand: if you don't like it or can't use it, you
don't have to. But why do your preferences override existing support for
DESTDIR in the rest of winsup?

--
Chuck

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 16 October 2009 23:57:03 Charles Wilson wrote:
> > What *problem* does adding
> > DESTDIR *solve*, that isn't better accommodated by simply
> > overriding prefix at `make install' time?
>
> Because you are forcing YOUR build preferences onto OTHER
> projects. winsup/cygwin installs fine with DESTDIR.
>  winsup/cygserver, winsup/lsaauth/, and winsup/utils do as well.
>  automake (which you may despise, but it IS a GNU tool with wide
> acceptance) supports it.

Well, the entire concept of DESTDIR is, IMO, an ill conceived botch;
automake may support it, but that support is broken by bad design.
Heck, unlike the mandatory requirement to support relocation of the
installed image, by overriding prefix at `make install' time, the
GNU Coding Standards *don't* require support for DESTDIR; it is
optional.  To me, this suggests that the Standards Committee may
have had reservations about including it at all.

> But if I try to do a 'make install DESTDIR=' from winsup/, it will
> die once it reaches winsup/mingw or winsup/w32api, which are both
> integral parts not just of mingw, but also of cygwin as
> represented by those other four subdirectories.
>
> I don't understand your opposition. If it's there, *you* don't
> have to use it, but *I* can.

But why do you *want* to use it, when you have a perfectly good
alternative, which *does* work reliably on any system?

> If it's not there, I can't use it at
> all, even though the rest of the 'cygwin' tree supports it.  Why
> do you hate cygwin? <g>

I don't hate Cygwin -- I just don't use it; why would I run what is
essentially a slow and klunky Windows hosted emulation of GNU/Linux,
when I can just run a real GNU/Linux system, and benefit from its
greater stability, together with a performance boost measured in
orders of magnitude? :-)

However, my concern is that if I do add support for DESTDIR, in its
present broken form, then we will attract bug reports from those who
expect it to work on native Windows, where of course, *we* know that
it simply cannot work; I would rather say that it is deliberately
unsupported, because it cannot be made to work, on the platform for
which the code is designated.  That said, I will offer you an
accommodation: you convince the automake maintainers to fix their
broken implementation, such that the paradigm becomes

  $(SYSDRIVE)$(DESTDIR)$(prefix)...

and so forth, the autoconf maintainers to provide a standard macro to
set SYSDRIVE appropriately for native Windows hosts, and both to
promote the use of this paradigm among those projects wishing to
support DESTDIR, and I will withdraw my objection.

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:
> But why do you *want* to use it, when you have a perfectly good
> alternative, which *does* work reliably on any system?

'make install prefix=/new/value' doesn't necessary work on every project
for any system (in general; for the GNU src/ tree it does work
universally AFAIK). M-I-P=NV should work for all projects, if folks at
project $FOO follow the GCS, and if it doesn't it's arguably a bug [*].
 Then again, not every project is part of the GNU ecosystem and not
everybody thinks they must adhere to the GCS in all its particulars. In
my experience, more projects support the unofficial DESTDIR method (aka
INST_ROOT, or some other variation) than follow the M-I-P=NV rule
without error.

[*] Typical failure is when $prefix (or, ugh, PREFIX) is not part of --
accidentally removed from -- MAKEFLAGS, or is not part of project $FOO's
analogue of FLAGS_TO_PASS.  Yet another reason why Recursive Make
Considered Harmful, but that's a whole 'nother issue.

But this is a side issue; consider it accepted by the prosecution that
for the GNU src/ tree, M-I-P=NV works universally, assuming that all
such paths specified at ./configure time are also similarly overridden
by the user.

> However, my concern is that if I do add support for DESTDIR, in its
> present broken form, then we will attract bug reports from those who
> expect it to work on native Windows, where of course, *we* know that
> it simply cannot work; I would rather say that it is deliberately
> unsupported, because it cannot be made to work, on the platform for
> which the code is designated.

And, how large is the cohort of people who try to build mingw-runtime
and w32api from CVS?  On native win32 and NOT cygwin?  [YOU don't even
build it natively]  Your argument is not about DESTDIR in the src/winsup
repository; you're treating src/winsup/mingw/ as a beachhead in your
fight against DESTDIR worldwide.  Hence, an accommodation that really isn't:

> That said, I will offer you an
> accommodation: you convince the automake maintainers to fix their
> broken implementation, such that the paradigm becomes
>
>   $(SYSDRIVE)$(DESTDIR)$(prefix)...
>
> and so forth, the autoconf maintainers to provide a standard macro to
> set SYSDRIVE appropriately for native Windows hosts, and both to
> promote the use of this paradigm among those projects wishing to
> support DESTDIR, and I will withdraw my objection.

Which won't help folks who follow our recommendation, on native mingw,
to configure using --prefix=`cd /foo && pwd -W` -- UNLESS said 'standard
configure macro' automatically splits the *user specified* prefix into
two pieces:
   ('C:' or '') and ('/rest/of/path' or '/all/of/path')
This means that when the USER specifies --prefix=C:/bob, the Makefile
would record
   prefix = /bob
   SYSDRIVE = C:
But only automake-generated Makefile.in's would automatically update all
their installation rules to put the two pieces back together. An
end-user that now does M-I-P=NV would get, err, unexpected results if
the specified their staging directory (e.g. the new prefix) with X:. So,
now you need an *Makefile.in* snippet that actually splits $(prefix)
into $(prefix_path_part) and SYSDRIVE, rather than an autoconf macro.

This could be incorporated automatically if the Makefile.in's were
generated by automake, but non-automake projects would all instantly
become broken even for regular non-DESTDIR 'make install' if the
end-user configures as we recommend.

And what of DESTDIR itself?  If SYSDRIVE is taken from the configure
prefix, then 'make install DESTDIR=' won't work if DESTDIR contains X:
-- and might not even work when it doesn't, depending on MSYS mount path
settings, unless I do something odd like

   make install DESTDIR=`cd /tmp/path && pwd -W | sed -e 's%^:%%'` \
      SYSDRIVE=`cd /tmp/path && pwd -W | sed -n -e 's%^\(.:\).*%\1%p`

Unless (automake-generated) Makefile.in's include rules that ALSO split
up DESTDIR into dest_sysdrive and dest_path components, and used the
former to automatically override SYSDRIVE, and then reassembled all
three peices in every installation rule.  Once again, tho, hand-coded
Makefile.in's would be broken, even though they currently work, all
caused by a unilateral autoconf change...

This new "feature" would pretty much force every end-user to change
their exising behavior, and every hand-coded Makefile.in to be modified,
in extremely ugly and awkward ways.  End result: it'll just make DESTDIR
*even harder* to use, and more people will just give up and use M-I-P=NV
-- but I think that's really the point.  A disruptive,
backwards-incompatible change of this sort will never fly upstream, and
I'm sure you know that -- your "accommodation" is actually a poison pill.

This is ridiculous. "I won't let you do X on your platform until you
perform the herculean task of making X work on my platform."  King
Eurystheus would be proud.

At this point it really makes no difference for my use cases; I can
change my build procedure fairly easily.  But I don't believe it is
reasonable of you to leverage src/winsup/mingw/* as part of your war
against DESTDIR.

--
Chuck

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Aaron W. LaFramboise-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> Chuck,
>
> On Friday 16 October 2009 21:58:41 Charles Wilson wrote:
>> In response to comments here:
>>   http://cygwin.com/ml/cygwin-patches/2009-q4/msg00103.html
>> revised below.
>>
>> Who can approve this?  Ok to commit?
>>
>> 2009-10-15  Charles Wilson  <...>
>>
>> Honor DESTDIR for winsup/mingw and winsup/w32api.
>> * winsup/mingw/Makefile.in: Honor DESTDIR and add to
>> FLAGS_TO_PASS.

> I'm opposed to this.  I've rejected similar patches in the past; why
> should I make an exception in your case?  What *problem* does adding
> DESTDIR *solve*, that isn't better accommodated by simply overriding
> prefix at `make install' time?

One data point is that gcc and binutils support DESTDIR just fine, and I
find it to be pretty useful.  For instance, it's nice to be able to
build with one prefix, but install somewhere else.  It's also nice to be
able to do successive installs from the same source into different
folders without having to do a complete rebuild, or if you just want to
stage something before you actually install it.

mingwrt is a lot less sophisticated than the aforementioned, but it
would be nice if supported this just for homogeneity.

> GNU Coding Standards *don't* require support for DESTDIR; it is
> optional

This is a strange thing to say, as the entire standard is pretty much
just recommendations, not requirements.  The standard does say,
"However, it is preferable to support a DESTDIR prefix on the target files."

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aaron W. LaFramboise wrote:

> One data point is that gcc and binutils support DESTDIR just fine, and I
> find it to be pretty useful.  For instance, it's nice to be able to
> build with one prefix, but install somewhere else.  It's also nice to be
> able to do successive installs from the same source into different
> folders without having to do a complete rebuild, or if you just want to
> stage something before you actually install it.

To stick up for Keith's side of the argument, you can do all of that
using the
  $ make install prefix=/tmp/staging
incantation, as well. You just have to be sure that, if when you
configured, you did (e.g.)
  $ ${S}/configure --prefix=/usr \
        --localstatedir=/var \
        --includedir=/usr/include/private
then you MUST do
  $ make install prefix=/tmp/staging/usr \
        localstatedir=/tmp/staging/var \
        includedir=/tmp/staging/usr/include/private

But I think it's good to support both, since the rest of src does.

>> GNU Coding Standards *don't* require support for DESTDIR; it is
>> optional
>
> This is a strange thing to say, as the entire standard is pretty much
> just recommendations, not requirements.  The standard does say,
> "However, it is preferable to support a DESTDIR prefix on the target files."

I hadn't seen that. But the GCS has a lot to say about (paraphrase)
reassigning prefix to a temporary staging directory during make install
shall not trigger a rebuild of target files" nor should the temporary
staging directory be recorded in the installation footprint. Or some
such gobbledygook like that.

--
Chuck

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Index: mingw/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.in
--- mingw/Makefile.in 27 Jul 2009 20:27:09 -0000 1.89
+++ mingw/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -36,6 +36,14 @@ target_alias = @target_alias@
 with_cross_host = @with_cross_host@
 prefix = @prefix@
 conf_prefix = @prefix@
+
+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
+
 host_os = @host_os@
 
 datarootdir = @datarootdir@
@@ -204,6 +212,7 @@ FLAGS_TO_PASS:=\
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  exec_prefix="$(exec_prefix)" \
  bindir="$(bindir)" \
  libdir="$(libdir)" \
@@ -274,7 +283,7 @@ all_dlls_host: $(DLLS)
 
 install_dlls_host:
  for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
  done
 
 _libm_dummy.o:
@@ -494,37 +503,37 @@ info-html:
 install-info: info
 
 install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
- $(mkinstalldirs) $(inst_docdir)
- $(mkinstalldirs) $(mandir)/man$(mansection)
+ $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
 
 install: all install-dirs $(install_dlls_host)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(INSTDOCS); do \
- $(INSTALL_DATA) $(srcdir)/$$i $(inst_docdir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
  done
  for sub in . sys ; do \
  dstdir=$(inst_includedir)/$$sub ; \
- $(mkinstalldirs) $$dstdir ; \
+ $(mkinstalldirs) $(DESTDIR)$$dstdir ; \
  for i in $(srcdir)/include/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$$dstdir/`basename $$i` ; \
  done ; \
  done
 #
 # This provisional hack installs the only manpage we have at present...
 # It simply CANNOT suffice, when we have more manpages to ship.
 #
- $(mkinstalldirs) $(mandir)/man$(mansection)
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
 #
 # End provisional hack.
Index: mingw/mingwex/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/mingwex/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- mingw/mingwex/Makefile.in 27 Jul 2009 20:27:09 -0000 1.47
+++ mingw/mingwex/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -14,6 +14,13 @@ objdir = .
 target_alias = @target_alias@
 prefix = @prefix@
 
+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
+
 datarootdir = @datarootdir@
 program_transform_name = @program_transform_name@
 exec_prefix = @exec_prefix@
@@ -256,9 +263,9 @@ info-html:
 install-info: info
 
 install: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 clean:
Index: mingw/profile/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/profile/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- mingw/profile/Makefile.in 27 Jul 2009 20:27:09 -0000 1.17
+++ mingw/profile/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -14,6 +14,13 @@ objdir = .
 target_alias = @target_alias@
 prefix = @prefix@
 
+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
+
 datarootdir = @datarootdir@
 program_transform_name = @program_transform_name@
 exec_prefix = @exec_prefix@
@@ -129,17 +136,17 @@ info-html:
 install-info: info
 
 install: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/$$sub ; \
  for i in $(srcdir)/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$(inst_includedir)/$$sub/`basename $$i` ; \
  done ; \
  done
 
Index: w32api/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- w32api/Makefile.in 6 Dec 2008 02:25:28 -0000 1.47
+++ w32api/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -19,6 +19,14 @@ host_alias = @host@
 target_alias = @target@
 prefix = @prefix@
 conf_prefix = @prefix@
+
+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
+
 # FIXME: this needs an appropriate AC_SUBST
 host_os = mingw32
 
@@ -58,6 +66,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
Index: w32api/lib/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/Makefile.in,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.in
--- w32api/lib/Makefile.in 29 Jan 2008 21:18:49 -0000 1.46
+++ w32api/lib/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -23,6 +23,14 @@ build_alias = @build@
 target_alias = @target@
 with_cross_host = @with_cross_host@
 prefix = @prefix@
+
+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
+
 includedir:=@includedir@
 
 program_transform_name = @program_transform_name@
@@ -101,6 +109,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -213,19 +222,19 @@ lib%.a: %.o
 install: install-libraries install-headers install-ddk install-directx
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- $(mkinstalldirs) $(inst_includedir)/GL
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
  for i in $(GL_HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
  done
 
 install-ddk: install-libraries install-headers
@@ -239,15 +248,15 @@ uninstall: uninstall-ddk uninstall-direc
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 uninstall-ddk:
  cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
Index: w32api/lib/ddk/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/ddk/Makefile.in,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.in
--- w32api/lib/ddk/Makefile.in 12 Sep 2006 00:29:04 -0000 1.5
+++ w32api/lib/ddk/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -19,6 +19,14 @@ build_alias = @build@
 target_alias = @target@
 with_cross_host = @with_cross_host@
 prefix = @prefix@
+
+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
+
 includedir:=@includedir@
 
 program_transform_name = @program_transform_name@
@@ -145,15 +153,15 @@ lib%.a: %.o
 install: install-libraries install-headers
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
@@ -161,15 +169,15 @@ uninstall: uninstall-libraries uninstall
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:
Index: w32api/lib/directx/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/directx/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- w32api/lib/directx/Makefile.in 12 Sep 2006 00:29:04 -0000 1.4
+++ w32api/lib/directx/Makefile.in 18 Oct 2009 22:52:37 -0000
@@ -19,6 +19,14 @@ build_alias = @build@
 target_alias = @target@
 with_cross_host = @with_cross_host@
 prefix = @prefix@
+
+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
+
 includedir:=@includedir@
 
 program_transform_name = @program_transform_name@
@@ -170,15 +178,15 @@ lib%.a: %.o
 install: install-libraries install-headers
 
 install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 install-headers:
- $(mkinstalldirs) $(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
@@ -186,15 +194,15 @@ uninstall: uninstall-libraries uninstall
 
 uninstall-libraries:
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
 uninstall-headers:
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 18 October 2009 19:47:52 Charles Wilson wrote:
> your "accommodation" is actually a poison pill.

It wasn't intended as such.  I didn't expect you to go with it, but
it was intended, primarily, as an illustration of what is so badly
broken, in the Heath-Robinson kludge that is DESTDIR.  Of course,
this too is a kludge, and introduces its own set of problems, as you
correctly point out.

> I don't believe it is reasonable of you to leverage
> src/winsup/mingw/* as part of your war against DESTDIR.

I'm not waging a war against DESTDIR.  I'm merely expressing an
opinion that DESTDIR is a badly engineered botch; one for which, as
a professional engineer, I don't wish to encourage adoption.

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

Well, it doesn't address the fundamentally bad engineering of
DESTDIR, but I could live with this, except for...

> 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

Yuk!  More nasty kludgy Makefile conditionals.  Okay, I'm not keen on
them, but that isn't sufficient reason to condemn them; however...

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

Why not engineer it so that it can?  (And avoid the proliferation of
conditionals while you're about it?)  Something like the attached,
(with a shorter error message, if preferred), perhaps?

--

Regards,
Keith.

prefix = c:/mingw
localstatedir = c:/mingw/var/foo

install:

need-DESTDIR-compatibility = prefix localstatedir
.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)

check-DESTDIR-compatibility:
        @test -z "$(DESTDIR)" || { status=0; \
          for path in $(need-DESTDIR-compatibility); do \
            $(MAKE) --no-print-directory $$path || status=$$?; \
            done; \
          exit $$status; }

$(need-DESTDIR-compatibility):
        @case $($@) in *:*) \
          $(error DESTDIR is not supported when $@ contains Win32 path `$($@)'; \
          try adding `$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)' to `[overrides ...]', \
          and execute `make install [overrides ...]' instead) ;; \
        esac

install: check-DESTDIR-compatibility
        @echo all DESTDIR checks passed

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> On Sunday 18 October 2009 19:47:52 Charles Wilson wrote:
>> 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.
>
> Well, it doesn't address the fundamentally bad engineering of
> DESTDIR, but I could live with this, except for...
>
...

> Yuk!  More nasty kludgy Makefile conditionals.  Okay, I'm not keen on
> them, but that isn't sufficient reason to condemn them; however...
>
>> 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.
>
> Why not engineer it so that it can?  (And avoid the proliferation of
> conditionals while you're about it?)  Something like the attached,
> (with a shorter error message, if preferred), perhaps?
Well, you can't actually hide an $(error ...) statement inside a shell
script. You have to do 'echo "..." ; exit non-zero' instead, but that's
a minor matter.

How's this (tested on mingw and cygwin):

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

        Honor DESTDIR for winsup/mingw and winsup/w32api.
        Detect and report error if installation paths are win32
        format, but DESTDIR is 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

Index: mingw/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.in
--- mingw/Makefile.in 27 Jul 2009 20:27:09 -0000 1.89
+++ mingw/Makefile.in 22 Oct 2009 20:43:27 -0000
@@ -90,6 +90,7 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include/mingw
 inst_libdir:=$(tooldir)/lib/mingw
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 ifneq (,$(with_cross_host))
 #
@@ -104,11 +105,13 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include
 inst_libdir:=$(tooldir)/lib
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 inst_bindir:=$(bindir)
 inst_includedir:=$(includedir)
 inst_libdir:=$(libdir)
 inst_docdir:=$(prefix)/doc/runtime
+need-DESTDIR-compatibility = prefix bindir includedir libdir mandir
 endif
 endif
 
@@ -204,6 +207,7 @@ FLAGS_TO_PASS:=\
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  exec_prefix="$(exec_prefix)" \
  bindir="$(bindir)" \
  libdir="$(libdir)" \
@@ -274,7 +278,7 @@ all_dlls_host: $(DLLS)
 
 install_dlls_host:
  for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
  done
 
 _libm_dummy.o:
@@ -493,25 +497,44 @@ info-html:
 
 install-info: info
 
-install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
- $(mkinstalldirs) $(inst_docdir)
- $(mkinstalldirs) $(mandir)/man$(mansection)
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+   for path in $(need-DESTDIR-compatibility); do \
+     $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+     test 0 -eq $$status || break ;\
+   done; \
+   exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+   echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+   try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+   and execute \`make install [overrides ...]\' instead. ;\
+   exit 2 ;; \
+ esac
+
+install-dirs: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
 
 install: all install-dirs $(install_dlls_host)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(INSTDOCS); do \
- $(INSTALL_DATA) $(srcdir)/$$i $(inst_docdir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
  done
  for sub in . sys ; do \
- dstdir=$(inst_includedir)/$$sub ; \
+ dstdir=$(DESTDIR)$(inst_includedir)/$$sub ; \
  $(mkinstalldirs) $$dstdir ; \
  for i in $(srcdir)/include/$$sub/*.h ; do \
   $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
@@ -521,10 +544,10 @@ install: all install-dirs $(install_dlls
 # This provisional hack installs the only manpage we have at present...
 # It simply CANNOT suffice, when we have more manpages to ship.
 #
- $(mkinstalldirs) $(mandir)/man$(mansection)
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
 #
 # End provisional hack.
Index: mingw/mingwex/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/mingwex/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- mingw/mingwex/Makefile.in 27 Jul 2009 20:27:09 -0000 1.47
+++ mingw/mingwex/Makefile.in 22 Oct 2009 20:43:27 -0000
@@ -255,10 +255,30 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+   for path in $(need-DESTDIR-compatibility); do \
+     $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+     test 0 -eq $$status || break ;\
+   done; \
+   exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+   echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+   try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+   and execute \`make install [overrides ...]\' instead. ;\
+   exit 2 ;; \
+ esac
+
+install: all check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 clean:
Index: mingw/profile/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/profile/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- mingw/profile/Makefile.in 27 Jul 2009 20:27:09 -0000 1.17
+++ mingw/profile/Makefile.in 22 Oct 2009 20:43:27 -0000
@@ -128,18 +128,38 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+   for path in $(need-DESTDIR-compatibility); do \
+     $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+     test 0 -eq $$status || break ;\
+   done; \
+   exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+   echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+   try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+   and execute \`make install [overrides ...]\' instead. ;\
+   exit 2 ;; \
+ esac
+
+install: all check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/$$sub ; \
  for i in $(srcdir)/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$(inst_includedir)/$$sub/`basename $$i` ; \
  done ; \
  done
 
Index: w32api/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- w32api/Makefile.in 6 Dec 2008 02:25:28 -0000 1.47
+++ w32api/Makefile.in 22 Oct 2009 20:43:28 -0000
@@ -58,6 +58,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -89,7 +90,7 @@ test:
 
 install uninstall:
  for i in $(SUBDIRS); do \
- (cd $$i; $(MAKE) $@); \
+ (cd $$i; $(MAKE) $@ $(FLAGS_TO_PASS)); \
  done
 
 ifdef SNAPDATE
Index: w32api/lib/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/Makefile.in,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.in
--- w32api/lib/Makefile.in 29 Jan 2008 21:18:49 -0000 1.46
+++ w32api/lib/Makefile.in 22 Oct 2009 20:43:28 -0000
@@ -101,6 +101,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -208,24 +209,45 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+  for path in $(need-DESTDIR-compatibility); do \
+    $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+    test 0 -eq $$status || break ;\
+  done; \
+  exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+  echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+  try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+  and execute \`make install [overrides ...]\' instead. ;\
+  exit 2 ;; \
+ esac
+
 .PHONY: install install-libraries install-headers install-ddk
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers install-ddk install-directx
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- $(mkinstalldirs) $(inst_includedir)/GL
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
  for i in $(GL_HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
  done
 
 install-ddk: install-libraries install-headers
@@ -237,17 +259,19 @@ install-directx: install-libraries insta
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 uninstall-ddk:
  cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
Index: w32api/lib/ddk/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/ddk/Makefile.in,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.in
--- w32api/lib/ddk/Makefile.in 12 Sep 2006 00:29:04 -0000 1.5
+++ w32api/lib/ddk/Makefile.in 22 Oct 2009 20:43:28 -0000
@@ -141,35 +141,58 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+  for path in $(need-DESTDIR-compatibility); do \
+    $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+    test 0 -eq $$status || break ;\
+  done; \
+ exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+  echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+  try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+  and execute \`make install [overrides ...]\' instead. ;\
+  exit 2 ;; \
+ esac
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:
Index: w32api/lib/directx/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/directx/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- w32api/lib/directx/Makefile.in 12 Sep 2006 00:29:04 -0000 1.4
+++ w32api/lib/directx/Makefile.in 22 Oct 2009 20:43:28 -0000
@@ -166,35 +166,58 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: check-DESTDIR-compatibility $(need-DESTDIR-compatibility)
+
+check-DESTDIR-compatibility:
+ @test -z "$(DESTDIR)" || { status=0; \
+  for path in $(need-DESTDIR-compatibility); do \
+    $(MAKE) --no-print-directory $$path  DESTDIR="$(DESTDIR)" || status=$$?; \
+    test 0 -eq $$status || break ;\
+  done; \
+  exit $$status; }
+
+$(need-DESTDIR-compatibility):
+ @case "$($@)" in *:*) \
+  echo DESTDIR is not supported when $@ contains Win32 path \`$($@)\'\; \
+  try adding \`$@=$(shell echo '$($@)' | sed s,:,:$(DESTDIR),)\' to \`[overrides ...]\', \
+  and execute \`make install [overrides ...]\' instead. ;\
+  exit 2 ;; \
+ esac
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: check-DESTDIR-compatibility
+ @echo all DESTDIR checks passed
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 22 October 2009 23:33:29 Charles Wilson wrote:
> Well, you can't actually hide an $(error ...) statement inside a
> shell script. You have to do 'echo "..." ; exit non-zero' instead,
> but that's a minor matter.

I thought that too, but I *did* test the sample Makefile I posted, on
both Ubuntu-8.04 and MSYS/Win2K; GNU Make 3.81 in both cases, and in
both it did DTRT.  Maybe it wouldn't work with an earlier version?  
However, neither make's own Texinfo documentation, nor my copy of
Robert Mecklenburg's `Managing Projects with GNU Make' (O'Reilly,
3rd edition), suggest that it wouldn't.

> How's this (tested on mingw and cygwin):
>
> 2009-10-22  Charles Wilson  <...>
>
>         Honor DESTDIR for winsup/mingw and winsup/w32api.
>         Detect and report error if installation paths are win32
>         format, but DESTDIR is non-empty.
>
>         * winsup/mingw/Makefile.in: Honor DESTDIR and add to
>         FLAGS_TO_PASS.
>         * winsup/mingw/mingwex/Makefile.in: Honor DESTDIR.
>  ...

I would write the ChangeLog entries in the `modified files' section
something like:

        * winsup/mingw/Makefile.in:
        (DESTDIR): Honor per convention; add it to...
        (FLAGS_TO_PASS): this.
        (need-DESTDIR-compatibility): New macro; define it.
        (check-DESTDIR-compatibility): New dependency goal.
        (install-dirs): Require it.
        ...

so that we capture the addition of the `DESTDIR-compatibility' code,
and identify the existing goals it affects.

> +check-DESTDIR-compatibility:
> + ...
> +        test 0 -eq $$status || break ;\

Adding this `test' to the actions for `check-DESTDIR-compatibility'
means that you capture and report only the first of possibly more
than one DESTDIR incompatibility per `make' run; omit it, as I did,
and you capture them all in a single run, which I think is better.

> +install-dirs: check-DESTDIR-compatibility
> +       @echo all DESTDIR checks passed

The `echo' command is redundant here; I would drop it.  (I only had
it in my example, to exercise the minimal test case).

Otherwise, it looks fine to me.  Thanks.

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> On Thursday 22 October 2009 23:33:29 Charles Wilson wrote:
>> Well, you can't actually hide an $(error ...) statement inside a
>> shell script. You have to do 'echo "..." ; exit non-zero' instead,
>> but that's a minor matter.
>
> I thought that too, but I *did* test the sample Makefile I posted, on
> both Ubuntu-8.04 and MSYS/Win2K; GNU Make 3.81 in both cases, and in
> both it did DTRT.  Maybe it wouldn't work with an earlier version?  
> However, neither make's own Texinfo documentation, nor my copy of
> Robert Mecklenburg's `Managing Projects with GNU Make' (O'Reilly,
> 3rd edition), suggest that it wouldn't.

Odd. All of Cygwin's make-3.81-2, MSYS make (3.81, stock from
MSYS-1.0.11), mingw32-make, and mandriva make 3.81-2mdv2008.0 fail in
this simple case:

all:
        @echo "here"
        @if test -z ""; then \
                echo "empty";\
        else \
                $(error Unexpected);\
        fi


$ make
Makefile:2: *** Unexpected.  Stop.

Note that I don't even see "here" -- the error statement is triggered
during initial parsing of the makefile, not during the execution of the
'all:' rule.  AFAICT, the only things that "guard" an $(error ...) are
makefile conditionals, which is what we're trying avoid.

Maybe the make documentation needs an update...

> I would write the ChangeLog entries in the `modified files' section
> something like:
>
> * winsup/mingw/Makefile.in:
> (DESTDIR): Honor per convention; add it to...
> (FLAGS_TO_PASS): this.
> (need-DESTDIR-compatibility): New macro; define it.
> (check-DESTDIR-compatibility): New dependency goal.
> (install-dirs): Require it.
> ...

OK.

> so that we capture the addition of the `DESTDIR-compatibility' code,
> and identify the existing goals it affects.
>
>> +check-DESTDIR-compatibility:
>> + ...
>> +        test 0 -eq $$status || break ;\
>
> Adding this `test' to the actions for `check-DESTDIR-compatibility'
> means that you capture and report only the first of possibly more
> than one DESTDIR incompatibility per `make' run; omit it, as I did,
> and you capture them all in a single run, which I think is better.

I put it in deliberately, because of the wacky way mingw/'s install
directories are computed (tooldir vs. prefix); do we really want to tell
everybody they should "redefine" tooldir -- which they may have never
heard of, unless they are in the habit of building binutils and gcc --
when all they really need to do is redefine prefix?

Plus, you get false positives: if you have defined prefix as C:\MinGW,
but have NOT actually defined includedir or libdir to anything special,
then you get three error messages, where each suggests to explicitly
override the affected variable. However, in mingw/ and w32api/ this is
not necessary: by default, the includedir and libdir variables end up
looking like this:

includedir = $(prefix)/include # sometimes $(tooldir)/include
libdir = $(prefix)/lib # or maybe exec_prefix, but then /that's/
                       # defined in terms of prefix

Which means you really don't NEED to explicitly define includedir or
libdir on the 'make install' line.

I'll change it back if you insist, but I really think bailing out after
the first error is /less/ confusing to end-users.

>> +install-dirs: check-DESTDIR-compatibility
>> +       @echo all DESTDIR checks passed
>
> The `echo' command is redundant here; I would drop it.  (I only had
> it in my example, to exercise the minimal test case).

Oh, OK. Sure.

FYI, Ralf W. suggested the following:
>> > +$(need-DESTDIR-compatibility):
>> > + @case "$($@)" in *:*) \
>
> Wouldn't ?:* suffice?  Not that I'd like anyone to use a path with a
> colon stuck in the middle of it on unix, but it certainly wouldn't be a
> Win32 path.

Is that change ok with you?

--
Chuck



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 23 October 2009 19:40:05 Charles Wilson wrote:

> > I thought that too, but I *did* test the sample Makefile I
> > posted, on both Ubuntu-8.04 and MSYS/Win2K; GNU Make 3.81 in
> > both cases, and in both it did DTRT.  Maybe it wouldn't work
> > with an earlier version? However, neither make's own Texinfo
> > documentation, nor my copy of Robert Mecklenburg's `Managing
> > Projects with GNU Make' (O'Reilly, 3rd edition), suggest that it
> > wouldn't.
>
> Odd. All of Cygwin's make-3.81-2, MSYS make (3.81, stock from
> MSYS-1.0.11), mingw32-make, and mandriva make 3.81-2mdv2008.0 fail
> in this simple case:
>
> [...snip...]
>
> Note that I don't even see "here" -- the error statement is
> triggered during initial parsing of the makefile, not during the
> execution of the 'all:' rule.
The abort is triggered at the point where make is forced to expand
the `$(error ...)' macro; since it is subject to recursive expansion,
that isn't necessarily when the Makefile is read; it is when the goal
which forces the expansion, (or an immediate assignment which does
likewise), is actioned.

> AFAICT, the only things that "guard" an $(error ...) are makefile
> conditionals, which is what we're trying avoid.

That's one scenario, but it *isn't* the only way...

> Maybe the make documentation needs an update...

Maybe.  What is there is accurate, but may be lacking in detail,
particularly in respect of the inability to achieve a conditional
abort within shell commands.  The Texinfo manual does offer an
example where the recursive evaluation occurs directly within the
commands associated with a goal which isn't actioned, (but doesn't
make it clear that it's conditional on the entire goal rather than
commands themselves), and that works just fine.  In fact, my example
*appeared* to work for this very reason -- the individual goals for
`$(need-DESTDIR-compatibility)' were never actioned if `$(DESTDIR)'
was empty, resulting in apparently correct behaviour; however, I had
neglected to test for a non-empty `$(DESTDIR)' coupled with normal
*nix definitions for `$(prefix)' et al. :-(  Of course, the abort is
falsely triggered for this "valid" usage, even though the `case'
command would have prevented it, had it been executed.

> >> +check-DESTDIR-compatibility:
> >> +     ...
> >> +        test 0 -eq $$status || break ;\
> >
> > Adding this `test' to the actions for
> > `check-DESTDIR-compatibility' means that you capture and report
> > only the first of possibly more than one DESTDIR incompatibility
> > per `make' run; omit it, as I did, and you capture them all in a
> > single run, which I think is better.
>
> I put it in deliberately, because of the wacky way mingw/'s
> install directories are computed (tooldir vs. prefix);
Indeed.  That's something else I think could do with an overhaul.

> do we
> really want to tell everybody they should "redefine" tooldir --
> which they may have never heard of, unless they are in the habit
> of building binutils and gcc -- when all they really need to do is
> redefine prefix?
>
> Plus, you get false positives:

I'd overlooked that likely scenario...

> if you have defined prefix as
> C:\MinGW, but have NOT actually defined includedir or libdir to
> anything special, then you get three error messages,

I agree, that would be bad; we definitely don't want such behaviour.

> I'll change it back if you insist, but I really think bailing out
> after the first error is /less/ confusing to end-users.

On reflection, I agree; no need to change it back.

> FYI, Ralf W. suggested the following:
> >> > +$(need-DESTDIR-compatibility):
> >> > +   @case "$($@)" in *:*) \
> >
> > Wouldn't ?:* suffice?  Not that I'd like anyone to use a path
> > with a colon stuck in the middle of it on unix, but it certainly
> > wouldn't be a Win32 path.
>
> Is that change ok with you?

Yes.  I'd considered it myself, and like Ralf, I wouldn't want to see
a colon embedded in a *nix path either; thus I left it as `*:*', even
though `?:*' is strictly a more accurate representation of our needs.
If you prefer the stricter accuracy, that's okay with me.

Taking all of the above on board, the updated example attached shows
one correct way to do this, while still using the `$(error ...)'
macro -- the `fail-DESTDIR-compatibility' goal, which invokes the
`$(error ...)' macro, is only ever invoked by a recursive `$(MAKE)';
(of course, using `echo' instead of `$(error ...)', the diagnostic
could be placed directly within the `$(need-DESTDIR-compatibility)'
commands, so obviating the need for the recursive `$(MAKE)' anyway).

--

Regards,
Keith.

prefix = c:/mingw
localstatedir = ${prefix}/var/foo

install:

need-DESTDIR-compatibility = prefix localstatedir
.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility

$(need-DESTDIR-compatibility):
        @test -z "$(DESTDIR)" || case $($@) in ?:*) \
          $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
          esac

fail-DESTDIR-compatibility:
        $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
        try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)

install: $(need-DESTDIR-compatibility)
        @echo all DESTDIR checks passed

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> On Friday 23 October 2009 19:40:05 Charles Wilson wrote:
>> Note that I don't even see "here" -- the error statement is
>> triggered during initial parsing of the makefile, not during the
>> execution of the 'all:' rule.
>
> The abort is triggered at the point where make is forced to expand
> the `$(error ...)' macro; since it is subject to recursive expansion,
> that isn't necessarily when the Makefile is read; it is when the goal
> which forces the expansion, (or an immediate assignment which does
> likewise), is actioned.

Ack.

>> AFAICT, the only things that "guard" an $(error ...) are makefile
>> conditionals, which is what we're trying avoid.
>
> That's one scenario, but it *isn't* the only way...
>
>> Maybe the make documentation needs an update...
>
> Maybe.  What is there is accurate, but may be lacking in detail,
> particularly in respect of the inability to achieve a conditional
> abort within shell commands.

I see.

> The Texinfo manual does offer an
> example where the recursive evaluation occurs directly within the
> commands associated with a goal which isn't actioned, (but doesn't
> make it clear that it's conditional on the entire goal rather than
> commands themselves), and that works just fine.  In fact, my example
> *appeared* to work for this very reason -- the individual goals for
> `$(need-DESTDIR-compatibility)' were never actioned if `$(DESTDIR)'
> was empty, resulting in apparently correct behaviour; however, I had
> neglected to test for a non-empty `$(DESTDIR)' coupled with normal
> *nix definitions for `$(prefix)' et al. :-(  Of course, the abort is
> falsely triggered for this "valid" usage, even though the `case'
> command would have prevented it, had it been executed.

Ok, I think I get it.

>>>> +check-DESTDIR-compatibility:
>>>> +     ...
>>>> +        test 0 -eq $$status || break ;\
>>> Adding this `test' to the actions for
>>> `check-DESTDIR-compatibility' means that you capture and report
>>> only the first of possibly more than one DESTDIR incompatibility
>>> per `make' run; omit it, as I did, and you capture them all in a
>>> single run, which I think is better.
>> I put it in deliberately, because of the wacky way mingw/'s
>> install directories are computed (tooldir vs. prefix);
>
> Indeed.  That's something else I think could do with an overhaul.

Big giant agree on that one.  Something that came up on the cygwin lists
in passing was the old proposal that mingwrt and w32api move out of the
src tree.  That is, stay on *sourceware* cvs, but outside the src/ repo.
 Personally I have misgivings about this -- I think it would complicate
building cygwin itself -- but cgf et. al. seem ok with it and implied
that "the mingw folks" wouldn't mind that eventuality either.

I can certainly see where "the mingw folks" ('scuse me, I need to go put
on my mingw hat)..."we" would benefit: no more ickiness associated with
the bizarre CC settings inherited from building cygwin "inside" the src
tree, no more ugly "tooldir" junk derived from the old "cygnus-style"
autohackery of the src tree, etc etc.

But that's all FAR outside the simple task I was trying to address here,
which has (sadly) ballooned somewhat...

And, of course, if "we" *were* to move mingwrt and w32api out of the
src/ tree ... then the whole argument for allowing/warning/etc about
DESTDIR: "we should support it if we can because mingwrt/w32api is
inside src/ and the rest of src/ supports it" goes poof.  Well, we can
always rip this back out, if that ever happens.  We'd probably rewrite
the Makefile.in's from scratch anyway, in that case...

>> I'll change it back if you insist, but I really think bailing out
>> after the first error is /less/ confusing to end-users.
>
> On reflection, I agree; no need to change it back.

OK.

>> FYI, Ralf W. suggested the following:
>>>>> +$(need-DESTDIR-compatibility):
>>>>> +   @case "$($@)" in *:*) \
>>> Wouldn't ?:* suffice?  Not that I'd like anyone to use a path
>>> with a colon stuck in the middle of it on unix, but it certainly
>>> wouldn't be a Win32 path.
>> Is that change ok with you?
>
> Yes.  I'd considered it myself, and like Ralf, I wouldn't want to see
> a colon embedded in a *nix path either; thus I left it as `*:*', even
> though `?:*' is strictly a more accurate representation of our needs.
> If you prefer the stricter accuracy, that's okay with me.

I think ?:* makes it slightly more obvious (for those who grok shell
glob patterns, anyway) what we're trying to exclude.  OTOH, even on unix
a path with an embedded ':' is ... nonstandard. You can't include them
in path*lists* like PATH, for instance.  But it's not our job to protect
the user against THAT.  So...meh.

> Taking all of the above on board, the updated example attached shows
> one correct way to do this, while still using the `$(error ...)'
> macro -- the `fail-DESTDIR-compatibility' goal, which invokes the
> `$(error ...)' macro, is only ever invoked by a recursive `$(MAKE)';
> (of course, using `echo' instead of `$(error ...)', the diagnostic
> could be placed directly within the `$(need-DESTDIR-compatibility)'
> commands, so obviating the need for the recursive `$(MAKE)' anyway).

I prefer to stick with the $(error ) macro, even if it requires to use
an extra recursive make invocation.  At least this way, you're
guaranteed the "beginning part" of the error message will be in a
standard form, regardless of i18n settings.

I'll post a revised version soon.

--
Chuck

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charles Wilson wrote:

> I'll post a revised version soon.

Attached (uncompressed, and gzipped for the archives). Tested on both
mingw and cygwin.

--
Chuck


Index: mingw/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.in
--- mingw/Makefile.in 27 Jul 2009 20:27:09 -0000 1.89
+++ mingw/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -90,6 +90,7 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include/mingw
 inst_libdir:=$(tooldir)/lib/mingw
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 ifneq (,$(with_cross_host))
 #
@@ -104,11 +105,13 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include
 inst_libdir:=$(tooldir)/lib
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 inst_bindir:=$(bindir)
 inst_includedir:=$(includedir)
 inst_libdir:=$(libdir)
 inst_docdir:=$(prefix)/doc/runtime
+need-DESTDIR-compatibility = prefix bindir includedir libdir mandir
 endif
 endif
 
@@ -204,6 +207,7 @@ FLAGS_TO_PASS:=\
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  exec_prefix="$(exec_prefix)" \
  bindir="$(bindir)" \
  libdir="$(libdir)" \
@@ -274,7 +278,7 @@ all_dlls_host: $(DLLS)
 
 install_dlls_host:
  for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
  done
 
 _libm_dummy.o:
@@ -493,25 +497,36 @@ info-html:
 
 install-info: info
 
-install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
- $(mkinstalldirs) $(inst_docdir)
- $(mkinstalldirs) $(mandir)/man$(mansection)
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install-dirs: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
 
 install: all install-dirs $(install_dlls_host)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(INSTDOCS); do \
- $(INSTALL_DATA) $(srcdir)/$$i $(inst_docdir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
  done
  for sub in . sys ; do \
- dstdir=$(inst_includedir)/$$sub ; \
+ dstdir=$(DESTDIR)$(inst_includedir)/$$sub ; \
  $(mkinstalldirs) $$dstdir ; \
  for i in $(srcdir)/include/$$sub/*.h ; do \
   $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
@@ -521,10 +536,10 @@ install: all install-dirs $(install_dlls
 # This provisional hack installs the only manpage we have at present...
 # It simply CANNOT suffice, when we have more manpages to ship.
 #
- $(mkinstalldirs) $(mandir)/man$(mansection)
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
 #
 # End provisional hack.
Index: mingw/mingwex/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/mingwex/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- mingw/mingwex/Makefile.in 27 Jul 2009 20:27:09 -0000 1.47
+++ mingw/mingwex/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -255,10 +255,22 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 clean:
Index: mingw/profile/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/profile/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- mingw/profile/Makefile.in 27 Jul 2009 20:27:09 -0000 1.17
+++ mingw/profile/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -128,18 +128,30 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/$$sub ; \
  for i in $(srcdir)/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$(inst_includedir)/$$sub/`basename $$i` ; \
  done ; \
  done
 
Index: w32api/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- w32api/Makefile.in 6 Dec 2008 02:25:28 -0000 1.47
+++ w32api/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -58,6 +58,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -89,7 +90,7 @@ test:
 
 install uninstall:
  for i in $(SUBDIRS); do \
- (cd $$i; $(MAKE) $@); \
+ (cd $$i; $(MAKE) $@ $(FLAGS_TO_PASS)); \
  done
 
 ifdef SNAPDATE
Index: w32api/lib/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/Makefile.in,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.in
--- w32api/lib/Makefile.in 29 Jan 2008 21:18:49 -0000 1.46
+++ w32api/lib/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -101,6 +101,7 @@ FLAGS_TO_PASS = \
  RANLIB="$(RANLIB)" \
  LD="$(LD)" \
  DLLTOOL="$(DLLTOOL)" \
+ DESTDIR="$(DESTDIR)" \
  TAR="$(TAR)" \
  TARFLAGS="$(TARFLAGS)" \
  TARFILEEXT="$(TARFILEEXT)" \
@@ -208,24 +209,36 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 .PHONY: install install-libraries install-headers install-ddk
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers install-ddk install-directx
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- $(mkinstalldirs) $(inst_includedir)/GL
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
  for i in $(GL_HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
  done
 
 install-ddk: install-libraries install-headers
@@ -237,17 +250,17 @@ install-directx: install-libraries insta
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 uninstall-ddk:
  cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
Index: w32api/lib/ddk/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/ddk/Makefile.in,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.in
--- w32api/lib/ddk/Makefile.in 12 Sep 2006 00:29:04 -0000 1.5
+++ w32api/lib/ddk/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -141,35 +141,47 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:
Index: w32api/lib/directx/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/directx/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- w32api/lib/directx/Makefile.in 12 Sep 2006 00:29:04 -0000 1.4
+++ w32api/lib/directx/Makefile.in 28 Oct 2009 04:24:17 -0000
@@ -166,35 +166,47 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" DESTDIR="$(DESTDIR)" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

mingw-destdir.patch6.gz (2K) Download Attachment

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 28 October 2009 03:28:26 Charles Wilson wrote:
> I prefer to stick with the $(error ) macro, even if it requires to
> use an extra recursive make invocation.

This is my preference too, (although I'm not vehemently opposed to
the alternative).

> At least this way, you're
> guaranteed the "beginning part" of the error message will be in a
> standard form, regardless of i18n settings.

Exactly.

> > I'll post a revised version soon.
>
> Attached (uncompressed, and gzipped for the archives). Tested on
> both mingw and cygwin.

Looks good.  Just one (very) minor (but recurring) issue:

+         $(MAKE) --no-print-directory \
                reject="$@" DESTDIR="$(DESTDIR)" \
                fail-DESTDIR-compatibility ;; \

We're assuming GNU Make here, right?  (There's a comment saying that
it is a necessary requirement, and we freely use features which make
it so).  Any macros defined on the command line, as DESTDIR *must*
be, should be passed automatically to the recursive sub-make,
(unless explicitly overridden, which DESTDIR *never* should be).  
Thus, explicitly passing DESTDIR seems sort of redundant.  If you
fear that it may not be properly passed, shouldn't that fear also
extend to the value of the macro represented by `$@'?  If so, then
don't you also need to add an explicit `$@="$($@)"' to the passed
macro definitions?

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> Looks good.  Just one (very) minor (but recurring) issue:
>
> +         $(MAKE) --no-print-directory \
> reject="$@" DESTDIR="$(DESTDIR)" \
> fail-DESTDIR-compatibility ;; \
>
> We're assuming GNU Make here, right?  (There's a comment saying that
> it is a necessary requirement, and we freely use features which make
> it so).  Any macros defined on the command line, as DESTDIR *must*
> be, should be passed automatically to the recursive sub-make,

I didn't know that.

> (unless explicitly overridden, which DESTDIR *never* should be).  
> Thus, explicitly passing DESTDIR seems sort of redundant.  If you
> fear that it may not be properly passed, shouldn't that fear also
> extend to the value of the macro represented by `$@'?  If so, then
> don't you also need to add an explicit `$@="$($@)"' to the passed
> macro definitions?

So...Ok, with that change (removing DESTDIR="${DESTDIR)" throughout)?

--
Chuck



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 28 October 2009 22:09:12 Charles Wilson wrote:
> > We're assuming GNU Make here, right?  (There's a comment saying
> > that it is a necessary requirement, and we freely use features
> > which make it so).  Any macros defined on the command line, as
> > DESTDIR *must* be, should be passed automatically to the
> > recursive sub-make,
>
> I didn't know that.

Quoting from the official `GNU Make' Texinfo manual:

  $ info make Variables/Recursion
  ...
     The special variable `MAKEFLAGS' is always exported [*]
  (unless you unexport it).  ...

     `make' automatically passes down variable values that were
  defined on the command line, by putting them in the `MAKEFLAGS'
  variable.  *Note Options/Recursion::.
  ...

[*] In this context, `exported' and `passed down' are synonymous.

> So...Ok, with that change (removing DESTDIR="${DESTDIR)"
> throughout)?

Yes; (I guess you don't need it in `FLAGS_TO_PASS' either, since it's
already implicit in `MAKEFLAGS').  Please feel free to commit, when
you are ready.

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

Re: Honor DESTDIR in w32api and mingw

by Charles Wilson-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall wrote:

> Yes; (I guess you don't need it in `FLAGS_TO_PASS' either, since it's
> already implicit in `MAKEFLAGS').  Please feel free to commit, when
> you are ready.

As committed:

mingw ChangeLog
2009-10-29  Charles Wilson  <...>

        Honor DESTDIR for winsup/mingw and winsup/w32api.
        Detect and report error if installation paths are win32
        format, but DESTDIR is non-empty.

        * Makefile.in (DESTDIR): Honor per convention.
        (need-DESTDIR-compatibility): New macro; define it and a
        corresponding rule.
        (fail-DESTDIR-compatibility): New dependency goal.
        (install-dirs): Require need-DESTDIR-compatibility.
        * mingwex/Makefile.in (DESTDIR): Honor per convention.
        (need-DESTDIR-compatibility): New macro; define it and a
        corresponding rule.
        (fail-DESTDIR-compatibility): New dependency goal.
        (install): Require need-DESTDIR-compatibility.
        * profile/Makefile.in: Ditto.

w32api ChangeLog
2009-10-29  Charles Wilson  <...>

        Honor DESTDIR for winsup/mingw and winsup/w32api.
        Detect and report error if installation paths are win32
        format, but DESTDIR is non-empty.

        * Makefile.in (install, uninstall): Use FLAGS_TO_PASS
        when invoking make in subdirs.
        * lib/Makefile.in (DESTDIR): Honor per convention.
        (need-DESTDIR-compatibility): New macro; define it and a
        corresponding rule.
        (fail-DESTDIR-compatibility): New dependency goal.
        (install-libraries, install-headers, uninstall-libraries,
        uninstall-headers): Require need-DESTDIR-compatibility.
        * lib/ddk/Makefile.in: Ditto.
        * lib/directx/Makefile.in: Ditto.

--
Chuck

Index: mingw/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.in
--- mingw/Makefile.in 27 Jul 2009 20:27:09 -0000 1.89
+++ mingw/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -90,6 +90,7 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include/mingw
 inst_libdir:=$(tooldir)/lib/mingw
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 ifneq (,$(with_cross_host))
 #
@@ -104,11 +105,13 @@ inst_bindir:=$(tooldir)/bin
 inst_includedir:=$(tooldir)/include
 inst_libdir:=$(tooldir)/lib
 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
+need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
 else
 inst_bindir:=$(bindir)
 inst_includedir:=$(includedir)
 inst_libdir:=$(libdir)
 inst_docdir:=$(prefix)/doc/runtime
+need-DESTDIR-compatibility = prefix bindir includedir libdir mandir
 endif
 endif
 
@@ -274,7 +277,7 @@ all_dlls_host: $(DLLS)
 
 install_dlls_host:
  for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
  done
 
 _libm_dummy.o:
@@ -493,25 +496,36 @@ info-html:
 
 install-info: info
 
-install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
- $(mkinstalldirs) $(inst_docdir)
- $(mkinstalldirs) $(mandir)/man$(mansection)
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install-dirs: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+ $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
 
 install: all install-dirs $(install_dlls_host)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(INSTDOCS); do \
- $(INSTALL_DATA) $(srcdir)/$$i $(inst_docdir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
  done
  for sub in . sys ; do \
- dstdir=$(inst_includedir)/$$sub ; \
+ dstdir=$(DESTDIR)$(inst_includedir)/$$sub ; \
  $(mkinstalldirs) $$dstdir ; \
  for i in $(srcdir)/include/$$sub/*.h ; do \
   $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
@@ -521,10 +535,10 @@ install: all install-dirs $(install_dlls
 # This provisional hack installs the only manpage we have at present...
 # It simply CANNOT suffice, when we have more manpages to ship.
 #
- $(mkinstalldirs) $(mandir)/man$(mansection)
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
- $(INSTALL_DATA) $(srcdir)/man/dirname.man $(mandir)/man$(mansection)/`\
+ $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
   echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
 #
 # End provisional hack.
Index: mingw/mingwex/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/mingwex/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- mingw/mingwex/Makefile.in 27 Jul 2009 20:27:09 -0000 1.47
+++ mingw/mingwex/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -255,10 +255,22 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
 clean:
Index: mingw/profile/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/profile/Makefile.in,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.in
--- mingw/profile/Makefile.in 27 Jul 2009 20:27:09 -0000 1.17
+++ mingw/profile/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -128,18 +128,30 @@ info-html:
 
 install-info: info
 
-install: all
- $(mkinstalldirs) $(inst_libdir)
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
+install: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
  for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/$$sub ; \
  for i in $(srcdir)/$$sub/*.h ; do \
-  $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
+  $(INSTALL_DATA) $$i $(DESTDIR)$(inst_includedir)/$$sub/`basename $$i` ; \
  done ; \
  done
 
Index: w32api/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/Makefile.in,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.in
--- w32api/Makefile.in 6 Dec 2008 02:25:28 -0000 1.47
+++ w32api/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -89,7 +89,7 @@ test:
 
 install uninstall:
  for i in $(SUBDIRS); do \
- (cd $$i; $(MAKE) $@); \
+ (cd $$i; $(MAKE) $@ $(FLAGS_TO_PASS)); \
  done
 
 ifdef SNAPDATE
Index: w32api/lib/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/Makefile.in,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.in
--- w32api/lib/Makefile.in 29 Jan 2008 21:18:49 -0000 1.46
+++ w32api/lib/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -208,24 +208,36 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 .PHONY: install install-libraries install-headers install-ddk
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers install-ddk install-directx
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- $(mkinstalldirs) $(inst_includedir)/GL
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
  for i in $(GL_HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
  done
 
 install-ddk: install-libraries install-headers
@@ -237,17 +249,17 @@ install-directx: install-libraries insta
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 uninstall-ddk:
  cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
Index: w32api/lib/ddk/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/ddk/Makefile.in,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.in
--- w32api/lib/ddk/Makefile.in 12 Sep 2006 00:29:04 -0000 1.5
+++ w32api/lib/ddk/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -141,35 +141,47 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:
Index: w32api/lib/directx/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/w32api/lib/directx/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- w32api/lib/directx/Makefile.in 12 Sep 2006 00:29:04 -0000 1.4
+++ w32api/lib/directx/Makefile.in 29 Oct 2009 18:14:42 -0000
@@ -166,35 +166,47 @@ lib%.a: %.o
  $(AR) rc $@ $*.o
  $(RANLIB) $@
 
+need-DESTDIR-compatibility = prefix libdir includedir
+.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
+
+$(need-DESTDIR-compatibility):
+ @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
+  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
+ esac
+
+fail-DESTDIR-compatibility:
+ $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
+ try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
+
 # install headers and libraries in a target specified directory.
 install: install-libraries install-headers
 
-install-libraries: all
- $(mkinstalldirs) $(inst_libdir)
+install-libraries: all $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
  for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
  done
 
-install-headers:
- $(mkinstalldirs) $(inst_includedir)
+install-headers: $(need-DESTDIR-compatibility)
+ $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
  for i in $(HEADERS); do \
- $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(inst_includedir)/$$i ; \
+ $(INSTALL_DATA) $(srcdir)/../../include/directx/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
  done
 
 # uninstall headers and libraries from a target specified directory
 uninstall: uninstall-libraries uninstall-headers
 
-uninstall-libraries:
+uninstall-libraries: $(need-DESTDIR-compatibility)
  @for i in $(LIBS); do \
- rm -f $(inst_libdir)/$$i ; \
+ rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
  done
- rmdir $(inst_libdir)
+ rmdir $(DESTDIR)$(inst_libdir)
 
-uninstall-headers:
+uninstall-headers: $(need-DESTDIR-compatibility)
  @for i in $(HEADERS); do \
- rm -r $(inst_includedir)/$$i ; \
+ rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
  done
- rmdir $(inst_includedir)
+ rmdir $(DESTDIR)$(inst_includedir)
 
 
 dist:


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-dvlpr mailing list
MinGW-dvlpr@...
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr

mingw-destdir.patch7a.gz (2K) Download Attachment