Commit f65bf755 authored by Ian Lynagh's avatar Ian Lynagh

Make installation on *nix work for paths with spaces in their name

This means we can remove some conditional stuff from the Makefiles,
and means the testsuite doesn't have to work out whether or not it's
on Windows.
parent 723eb70f
......@@ -17,14 +17,14 @@ install: install_driver_ghci
.PHONY: install_driver_ghci
install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
install_driver_ghci:
$(INSTALL_DIR) $(DESTDIR)$(bindir)
"$(RM)" $(RM_OPTS) $(WRAPPER)
$(CREATE_SCRIPT) $(WRAPPER)
echo '#!$(SHELL)' >> $(WRAPPER)
echo 'exec $(bindir)/ghc-$(ProjectVersion) --interactive $${1+"$$@"}' >> $(WRAPPER)
$(EXECUTABLE_FILE) $(WRAPPER)
"$(RM)" $(RM_OPTS) $(DESTDIR)$(bindir)/ghci
$(LN_S) ghci-$(ProjectVersion) $(DESTDIR)$(bindir)/ghci
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
"$(RM)" $(RM_OPTS) "$(WRAPPER)"
$(CREATE_SCRIPT) "$(WRAPPER)"
echo '#!$(SHELL)' >> "$(WRAPPER)"
echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive $${1+"$$@"}' >> "$(WRAPPER)"
$(EXECUTABLE_FILE) "$(WRAPPER)"
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghci"
$(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci"
else # Windows...
......
......@@ -721,30 +721,30 @@ install: install_packages install_libs install_libexecs install_headers \
install_topdirs install_topdir_scripts
install_bins: $(INSTALL_BINS)
$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
for i in $(INSTALL_BINS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(bindir) ; \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
if test "$(darwin_TARGET_OS)" = "1"; then \
sh mk/fix_install_names.sh $(ghclibdir) $(DESTDIR)$(bindir)/$$i ; \
sh mk/fix_install_names.sh $(ghclibdir) "$(DESTDIR)$(bindir)/$$i" ; \
fi ; \
done
install_libs: $(INSTALL_LIBS)
$(INSTALL_DIR) $(DESTDIR)$(ghclibdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)"
for i in $(INSTALL_LIBS); do \
case $$i in \
*.a) \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)"; \
$(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
*.dll) \
$(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir) ;; \
$(INSTALL_DATA) -s $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)" ;; \
*.so) \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir) ;; \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)" ;; \
*.dylib) \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
install_name_tool -id $(DESTDIR)$(ghclibdir)/`basename $$i` $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
$(INSTALL_SHLIB) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)"; \
install_name_tool -id "$(DESTDIR)$(ghclibdir)/`basename $$i`" "$(DESTDIR)$(ghclibdir)/`basename $$i`" ;; \
*) \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
$(INSTALL_DATA) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)"; \
esac; \
done
......@@ -752,9 +752,9 @@ install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS)
ifeq "$(INSTALL_LIBEXEC_SCRIPTS)" ""
@:
else
$(INSTALL_DIR) $(DESTDIR)$(ghclibexecdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)"
for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibexecdir); \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
done
endif
......@@ -762,48 +762,48 @@ install_libexecs: $(INSTALL_LIBEXECS)
ifeq "$(INSTALL_LIBEXECS)" ""
@:
else
$(INSTALL_DIR) $(DESTDIR)$(ghclibexecdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)"
for i in $(INSTALL_LIBEXECS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(ghclibexecdir); \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
done
endif
install_topdir_scripts: $(INSTALL_TOPDIR_SCRIPTS)
$(INSTALL_DIR) $(DESTDIR)$(topdir)
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
for i in $(INSTALL_TOPDIR_SCRIPTS); do \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(topdir); \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(topdir)"; \
done
install_topdirs: $(INSTALL_TOPDIRS)
$(INSTALL_DIR) $(DESTDIR)$(topdir)
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
for i in $(INSTALL_TOPDIRS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(topdir); \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(topdir)"; \
done
install_headers: $(INSTALL_HEADERS)
$(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
for i in $(INSTALL_HEADERS); do \
$(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghcheaderdir); \
$(INSTALL_HEADER) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghcheaderdir)"; \
done
install_docs: $(INSTALL_HEADERS)
$(INSTALL_DIR) $(DESTDIR)$(docdir)
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
ifneq "$(INSTALL_DOCS)" ""
for i in $(INSTALL_DOCS); do \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i $(DESTDIR)$(docdir); \
$(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
$(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html"
$(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html"
ifneq "$(INSTALL_LIBRARY_DOCS)" ""
for i in $(INSTALL_LIBRARY_DOCS); do \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i $(DESTDIR)$(docdir)/html/libraries/; \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \
done
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`; \
$(INSTALL_DIR) $(INSTALL_OPTS) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
$(INSTALL_DOC) $(INSTALL_OPTS) $$i/* "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
done
endif
......@@ -839,21 +839,21 @@ ALL_INSTALLED_PACKAGES = $(addprefix libraries/,$(INSTALLED_PACKAGES)) \
install_packages: install_libexecs
install_packages: libffi/package.conf.install rts/package.conf.install
$(INSTALL_DIR) $(DESTDIR)$(topdir)
"$(RM)" -r $(RM_OPTS) $(INSTALLED_PACKAGE_CONF)
$(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
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
"$(RM)" -r $(RM_OPTS) "$(INSTALLED_PACKAGE_CONF)"
$(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, $(ALL_INSTALLED_PACKAGES),\
"$(GHC_CABAL_INPLACE)" install \
$(INSTALLED_GHC_REAL) \
$(INSTALLED_GHC_PKG_REAL) \
$(DESTDIR)$(topdir) \
"$(INSTALLED_GHC_REAL)" \
"$(INSTALLED_GHC_PKG_REAL)" \
"$(DESTDIR)$(topdir)" \
$p $(INSTALL_DISTDIR_$p) \
'$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries' \
$(RelocatableBuild) &&) true
$(foreach p, $(HIDDEN_PACKAGES),\
$(INSTALLED_GHC_PKG_REAL) --global-conf $(INSTALLED_PACKAGE_CONF) \
"$(INSTALLED_GHC_PKG_REAL)" --global-conf "$(INSTALLED_PACKAGE_CONF)" \
hide $p &&) true
# -----------------------------------------------------------------------------
......
......@@ -153,8 +153,8 @@ ifeq "$(Windows)" "NO"
install: install_ghc_link
.PNONY: install_ghc_link
install_ghc_link:
"$(RM)" $(RM_OPTS) $(DESTDIR)$(bindir)/ghc
$(LN_S) ghc-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc"
$(LN_S) ghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc"
else
# On Windows we install the main binary as $(bindir)/ghc.exe
# To get ghc-<version>.exe we have a little C program in driver/ghc
......
exec $executablename -B$topdir ${1+"$@"}
exec "$executablename" -B"$topdir" ${1+"$@"}
......@@ -186,10 +186,10 @@ install: install_includes
.PHONY: install_includes
install_includes :
$(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)"
for d in $(includes_subdirs); do \
$(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)/$$d; \
$(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; \
$(INSTALL_HEADER) $(INSTALL_OPTS) includes/$$i "$(DESTDIR)$(ghcheaderdir)/$$i"; \
done
......@@ -784,12 +784,6 @@ ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
#
################################################################################
ifeq "$(Windows)" "YES"
BIN_DIST_INST_SUBDIR = "install dir"
else
# I very much doubt that paths with spaces will work on Unix
BIN_DIST_INST_SUBDIR = installed
endif
BIN_DIST_INST_DIR = $(TOP)/bindisttest/$(BIN_DIST_INST_SUBDIR)
......@@ -133,8 +133,8 @@ INSTALL_GROUP =
# Invocations of `install' for the four different classes
# of targets:
#
CREATE_SCRIPT = create () { touch $$1 && chmod 755 $$1 ; } && create
CREATE_DATA = create () { touch $$1 && chmod 644 $$1 ; } && create
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
......
......@@ -361,9 +361,9 @@ install : install_rts
.PHONY: install_rts
install_rts:
$(INSTALL_DIR) $(DESTDIR)$(ghclibdir)
$(INSTALL_DIR) $(DESTDIR)$(ghclibdir)/include
"$(CP)" $(ALL_RTS_LIBS) $(DESTDIR)$(ghclibdir)
$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)"
$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)/include"
"$(CP)" $(ALL_RTS_LIBS) "$(DESTDIR)$(ghclibdir)"
# -----------------------------------------------------------------------------
# cleaning
......
......@@ -35,10 +35,10 @@ all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG)
$$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE)
"$$(RM)" $$(RM_OPTS) $$@
echo '#!$$(SHELL)' >> $$@
echo 'executablename=$$(TOP)/$$<' >> $$@
echo 'datadir=$$(TOP)/$$(INPLACE_LIB)' >> $$@
echo 'bindir=$$(TOP)/$$(INPLACE_BIN)' >> $$@
echo 'topdir=$$(TOP)/$$(INPLACE_TOPDIR)' >> $$@
echo 'executablename="$$(TOP)/$$<"' >> $$@
echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
$$(EXECUTABLE_FILE) $$@
endif
......@@ -59,15 +59,15 @@ install: 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)
"$$(RM)" $$(RM_OPTS) $$(WRAPPER)
$$(CREATE_SCRIPT) $$(WRAPPER)
echo '#!$$(SHELL)' >> $$(WRAPPER)
echo 'executablename=$$(ghclibexecdir)/$$($1_$2_PROG)' >> $$(WRAPPER)
echo 'datadir=$$(datadir)' >> $$(WRAPPER)
echo 'bindir=$$(bindir)' >> $$(WRAPPER)
echo 'topdir=$$(topdir)' >> $$(WRAPPER)
cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$(WRAPPER)
$$(EXECUTABLE_FILE) $$(WRAPPER)
"$$(RM)" $$(RM_OPTS) "$$(WRAPPER)"
$$(CREATE_SCRIPT) "$$(WRAPPER)"
echo '#!$$(SHELL)' >> "$$(WRAPPER)"
echo 'executablename="$$(ghclibexecdir)/$$($1_$2_PROG)"' >> "$$(WRAPPER)"
echo 'datadir="$$(datadir)"' >> "$$(WRAPPER)"
echo 'bindir="$$(bindir)"' >> "$$(WRAPPER)"
echo 'topdir="$$(topdir)"' >> "$$(WRAPPER)"
cat $$($1_$2_SHELL_WRAPPER_NAME) >> "$$(WRAPPER)"
$$(EXECUTABLE_FILE) "$$(WRAPPER)"
endif # $1_$2_INSTALL_SHELL_WRAPPER
......
#!/bin/sh
PKGCONF=$topdir/package.conf.d
exec $executablename --global-conf $PKGCONF ${1+"$@"}
PKGCONF="$topdir/package.conf.d"
exec "$executablename" --global-conf "$PKGCONF" ${1+"$@"}
......@@ -100,8 +100,8 @@ install: install_utils/ghc-pkg_link
.PNONY: install_utils/ghc-pkg_link
install_utils/ghc-pkg_link:
$(INSTALL_DIR) $(DESTDIR)$(bindir)
"$(RM)" $(RM_OPTS) $(DESTDIR)$(bindir)/ghc-pkg
$(LN_S) ghc-pkg-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc-pkg
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc-pkg"
$(LN_S) ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc-pkg"
endif
......@@ -32,7 +32,7 @@ install_runhaskell: install_bins
"$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext) $(DESTDIR)$(bindir)/runhaskell$(exeext)
else
install_runhaskell:
"$(RM)" $(RM_OPTS) $(DESTDIR)$(bindir)/runhaskell
$(LN_S) runghc $(DESTDIR)$(bindir)/runhaskell
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/runhaskell"
$(LN_S) runghc "$(DESTDIR)$(bindir)/runhaskell"
endif
#!/bin/sh
exec $executablename -f $bindir/ghc ${1+"$@"}
exec "$executablename" -f "$bindir/ghc" ${1+"$@"}
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