summaryrefslogtreecommitdiff
path: root/mk/install.mk.in
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-01-06 22:30:30 +0000
committerIan Lynagh <igloo@earth.li>2011-01-06 22:30:30 +0000
commit57e2a81c589103b50da80a9e378b1a11285bd521 (patch)
tree5974b3fbc3c88abac38e35a7d790f972b404a363 /mk/install.mk.in
parentaf6b7e5d76247e9577ab6b9ad8c70dd90df1105d (diff)
downloadhaskell-57e2a81c589103b50da80a9e378b1a11285bd521.tar.gz
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
Diffstat (limited to 'mk/install.mk.in')
-rw-r--r--mk/install.mk.in41
1 files changed, 33 insertions, 8 deletions
diff --git a/mk/install.mk.in b/mk/install.mk.in
index 4d20310107..3d74158982 100644
--- a/mk/install.mk.in
+++ b/mk/install.mk.in
@@ -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