Commit 57e2a81c authored by Ian Lynagh's avatar Ian Lynagh

On Cygwin, use a Cygwin-style path for /bin/install's destination

cygwin's /bin/install doesn't set file modes correctly if the
destination path is a C: style path:

$ /bin/install -c -m 644 foo /cygdrive/c/cygwin/home/ian/foo2
$ /bin/install -c -m 644 foo c:/cygwin/home/ian/foo3
$ ls -l foo*
-rw-r--r-- 1 ian None 0 2011-01-06 18:28 foo
-rw-r--r-- 1 ian None 0 2011-01-06 18:29 foo2
-rwxrwxrwx 1 ian None 0 2011-01-06 18:29 foo3

This causes problems for bindisttest/checkBinaries.sh which then
thinks that e.g. the userguide HTML files are binaries.

We therefore use a /cygdrive path if we are on cygwin
parent af6b7e5d
......@@ -47,9 +47,9 @@ install: install_man
.PHONY: install_man
install_man: $(MAN_PATH)
$(INSTALL_DIR) "$(DESTDIR)$(mandir)"
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"
$(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PATH) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"
$(call INSTALL_DIR,"$(DESTDIR)$(mandir)")
$(call INSTALL_DIR,"$(DESTDIR)$(mandir)/man$(MAN_SECTION)")
$(call INSTALL_MAN,$(INSTALL_OPTS),$(MAN_PATH),"$(DESTDIR)$(mandir)/man$(MAN_SECTION)")
endif
$(eval $(call clean-target,docs/man,,$(MAN_PATH) docs/man/flags.xsl docs/man/flags.xml))
......
......@@ -17,7 +17,7 @@ install: install_driver_ghci
.PHONY: install_driver_ghci
install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
install_driver_ghci:
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
"$(RM)" $(RM_OPTS) "$(WRAPPER)"
$(CREATE_SCRIPT) "$(WRAPPER)"
echo '#!$(SHELL)' >> "$(WRAPPER)"
......@@ -52,7 +52,7 @@ install : install_driver_ghcii
install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
install_driver_ghcii:
$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(call INSTALL_DIR,$(DESTDIR)$(bindir))
"$(RM)" $(RM_OPTS) $(GHCII_SCRIPT)
echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
......
......@@ -836,26 +836,26 @@ install: install_docs
endif
install_bins: $(INSTALL_BINS)
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
for i in $(INSTALL_BINS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \
done
install_libs: $(INSTALL_LIBS)
$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(ghclibdir)")
for i in $(INSTALL_LIBS); do \
case $$i in \
*.a) \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)"; \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \
$(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
*.dll) \
$(INSTALL_DATA) -s $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)" ;; \
$(call INSTALL_DATA,-s $(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ;; \
*.so) \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)" ;; \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ;; \
*.dylib) \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)";; \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)");; \
*) \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)"; \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \
esac; \
done
......@@ -863,9 +863,9 @@ install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS)
ifeq "$(INSTALL_LIBEXEC_SCRIPTS)" ""
@:
else
$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)")
for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
$(call INSTALL_SCRIPT,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)"); \
done
endif
......@@ -873,9 +873,9 @@ install_libexecs: $(INSTALL_LIBEXECS)
ifeq "$(INSTALL_LIBEXECS)" ""
@:
else
$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)")
for i in $(INSTALL_LIBEXECS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)"); \
done
# We rename ghc-stage2, so that the right program name is used in error
# messages etc.
......@@ -883,38 +883,38 @@ else
endif
install_topdirs: $(INSTALL_TOPDIRS)
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
for i in $(INSTALL_TOPDIRS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(topdir)"; \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(topdir)"); \
done
install_headers: $(INSTALL_HEADERS)
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)")
for i in $(INSTALL_HEADERS); do \
$(INSTALL_HEADER) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghcheaderdir)"; \
$(call INSTALL_HEADER,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghcheaderdir)"); \
done
install_docs: $(INSTALL_DOCS)
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)")
ifneq "$(INSTALL_DOCS)" ""
for i in $(INSTALL_DOCS); do \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)"; \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(docdir)"); \
done
endif
$(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html"
$(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html"
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html")
$(call INSTALL_DOC,$(INSTALL_OPTS),docs/index.html,"$(DESTDIR)$(docdir)/html")
ifneq "$(INSTALL_LIBRARY_DOCS)" ""
$(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html/libraries"
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html/libraries")
for i in $(INSTALL_LIBRARY_DOCS); do \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(docdir)/html/libraries/"); \
done
$(INSTALL_DATA) $(INSTALL_OPTS) libraries/prologue.txt "$(DESTDIR)$(docdir)/html/libraries/"
$(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/"
$(call INSTALL_DATA,$(INSTALL_OPTS),libraries/prologue.txt,"$(DESTDIR)$(docdir)/html/libraries/")
$(call INSTALL_SCRIPT,$(INSTALL_OPTS),libraries/gen_contents_index,"$(DESTDIR)$(docdir)/html/libraries/")
endif
ifneq "$(INSTALL_HTML_DOC_DIRS)" ""
for i in $(INSTALL_HTML_DOC_DIRS); do \
$(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i/* "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
$(call INSTALL_DIR,"$(DESTDIR)$(docdir)/html/`basename $$i`"); \
$(call INSTALL_DOC,$(INSTALL_OPTS),$$i/*,"$(DESTDIR)$(docdir)/html/`basename $$i`"); \
done
endif
......@@ -948,9 +948,9 @@ INSTALL_DISTDIR_compiler = stage2
# Now we can do the installation
install_packages: install_libexecs
install_packages: libffi/package.conf.install rts/package.conf.install
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
"$(RM)" $(RM_OPTS_REC) "$(INSTALLED_PACKAGE_CONF)"
$(INSTALL_DIR) "$(INSTALLED_PACKAGE_CONF)"
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
"$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update libffi/package.conf.install
"$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
$(foreach p, $(INSTALLED_PKG_DIRS), \
......
......@@ -186,10 +186,10 @@ install: install_includes
.PHONY: install_includes
install_includes :
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)")
for d in $(includes_subdirs); do \
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)/$$d"; \
$(call INSTALL_DIR,"$(DESTDIR)$(ghcheaderdir)/$$d"); \
done
for i in $(subst includes/,,$(includes_H_FILES) $(includes_H_CONFIG) $(includes_H_PLATFORM)); do \
$(INSTALL_HEADER) $(INSTALL_OPTS) includes/$$i "$(DESTDIR)$(ghcheaderdir)/$$i"; \
$(call INSTALL_HEADER,$(INSTALL_OPTS),includes/$$i,"$(DESTDIR)$(ghcheaderdir)/$$i"); \
done
......@@ -132,14 +132,39 @@ INSTALL_GROUP =
#
CREATE_SCRIPT = create () { touch "$$1" && chmod 755 "$$1" ; } && create
CREATE_DATA = create () { touch "$$1" && chmod 644 "$$1" ; } && create
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_SCRIPT = $(INSTALL) -m 755
INSTALL_SHLIB = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_HEADER = $(INSTALL) -m 644
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_DOC = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
# These takes 3 arguments:
# $1 = flags
# $2 = files
# $3 = dest
INSTALL_PROGRAM = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_SCRIPT = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_SHLIB = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_DATA = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_HEADER = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_MAN = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
INSTALL_DOC = $(INSTALL) -m 644 $1 $2 $(call MK_INSTALL_DEST,$3)
# Only 1 argument, the directory to create:
INSTALL_DIR = $(INSTALL) -m 755 -d $(call MK_INSTALL_DEST,$1)
# cygwin's /bin/install doesn't set file modes correctly if the
# destination path is a C: style path:
#
# $ /bin/install -c -m 644 foo /cygdrive/c/cygwin/home/ian/foo2
# $ /bin/install -c -m 644 foo c:/cygwin/home/ian/foo3
# $ ls -l foo*
# -rw-r--r-- 1 ian None 0 2011-01-06 18:28 foo
# -rw-r--r-- 1 ian None 0 2011-01-06 18:29 foo2
# -rwxrwxrwx 1 ian None 0 2011-01-06 18:29 foo3
#
# This causes problems for bindisttest/checkBinaries.sh which then
# thinks that e.g. the userguide HTML files are binaries.
#
# We therefore use a /cygdrive path if we are on cygwin
ifeq '$(shell cygpath "c:/" 2> /dev/null)' ''
MK_INSTALL_DEST = $1
else
MK_INSTALL_DEST = "$(shell cygpath $1)"
endif
#
# runhaskell and hsc2hs are special, in that other compilers besides
......
......@@ -60,8 +60,8 @@ install: install_$1_$2
.PHONY: install_$1_$2
install_$1_$2: $1/$2/$$($1_$2_PROG)
$$(INSTALL_DIR) "$$($1_$2_INSTALL_IN)"
$$(INSTALL_SCRIPT) $$(INSTALL_OPTS) $$< "$$($1_$2_INSTALL_IN)"
$$(call INSTALL_DIR,"$$($1_$2_INSTALL_IN)")
$$(call INSTALL_SCRIPT,$$(INSTALL_OPTS),$$<,"$$($1_$2_INSTALL_IN)")
endif
endif
......
......@@ -63,7 +63,7 @@ install: install_$1_$2_wrapper
.PHONY: install_$1_$2_wrapper
install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
install_$1_$2_wrapper:
$$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
$$(call INSTALL_DIR,"$$(DESTDIR)$$(bindir)")
"$$(RM)" $$(RM_OPTS) "$$(WRAPPER)"
$$(CREATE_SCRIPT) "$$(WRAPPER)"
echo '#!$$(SHELL)' >> "$$(WRAPPER)"
......
......@@ -99,7 +99,7 @@ install: install_utils/ghc-pkg_link
.PNONY: install_utils/ghc-pkg_link
install_utils/ghc-pkg_link:
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc-pkg"
$(LN_S) ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc-pkg"
endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment