This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Honor DESTDIR in w32api and mingw


[Cross-posted to mingw-dvlpr, 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
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
@@ -26,6 +26,8 @@ srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 
+DESTDIR =
+
 # FIXME: I see no reason to define `objdir';
 # it appears to be unused, and could be removed.
 objdir = .
@@ -204,6 +206,7 @@ FLAGS_TO_PASS:=\
 	RANLIB="$(RANLIB)" \
 	LD="$(LD)" \
 	DLLTOOL="$(DLLTOOL)" \
+	DESTDIR="$(DESTDIR)" \
 	exec_prefix="$(exec_prefix)" \
 	bindir="$(bindir)" \
 	libdir="$(libdir)" \
@@ -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:
@@ -494,37 +497,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
@@ -7,6 +7,8 @@ srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = $(srcdir):$(srcdir)/math:$(srcdir)/stdio:$(srcdir)/complex $(srcdir)/gdtoa
 
+DESTDIR =
+
 # FIXME: I see no reason to define `objdir';
 # it appears to be unused, and could be removed.
 objdir = .
@@ -256,9 +258,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
@@ -7,6 +7,8 @@ VPATH = @srcdir@
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 
+DESTDIR =
+
 # FIXME: I see no reason to define `objdir';
 # it appears to be unused, and could be removed.
 objdir = .
@@ -129,17 +131,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
@@ -14,6 +14,8 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
+DESTDIR =
+
 build_alias = @build@
 host_alias = @host@
 target_alias = @target@
@@ -58,6 +60,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
@@ -15,6 +15,8 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
+DESTDIR =
+
 SUBDIRS := ddk directx
 subdirs := ddk directx
 
@@ -101,6 +103,7 @@ FLAGS_TO_PASS = \
 	RANLIB="$(RANLIB)" \
 	LD="$(LD)" \
 	DLLTOOL="$(DLLTOOL)" \
+	DESTDIR="$(DESTDIR)" \
 	TAR="$(TAR)" \
 	TARFLAGS="$(TARFLAGS)" \
 	TARFILEEXT="$(TARFILEEXT)" \
@@ -213,19 +216,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 +242,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
@@ -14,6 +14,8 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
+DESTDIR =
+
 host_alias = @host@
 build_alias = @build@
 target_alias = @target@
@@ -145,15 +147,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 +163,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
@@ -14,6 +14,8 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
+DESTDIR =
+
 host_alias = @host@
 build_alias = @build@
 target_alias = @target@
@@ -170,15 +172,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 +188,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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]