Commit 64761ce9 authored by thomie's avatar thomie

Build system: implement `make install-strip` (#1851)

Reviewed by: bgamari

Differential Revision: https://phabricator.haskell.org/D1209
parent 19c6049a
......@@ -24,8 +24,10 @@ Common commands:
Shows the targets available in <dir>
- make install
- make install-strip
Installs GHC, libraries and tools under $(prefix)
Installs GHC, libraries and tools under $(prefix). The install-strip
variant strips executable files while installing them.
- make sdist
- make binary-dist
......@@ -33,13 +35,10 @@ Common commands:
Builds a source or binary distribution respectively
- `make show VALUE=<var>`
Displays the value of make variable <var>
- `make show! VALUE=<var>`
Same as `make show`, but works right after ./configure (it skips reading
package-data.mk files).
Show the value of make variable <var>. The show! variant works right after
./configure (it skips reading package-data.mk files).
- make clean
- make distclean
......@@ -76,9 +75,11 @@ Using `make` in subdirectories
Make documentation in this directory (if any)
- `make show VALUE=var`
- `make show VALUE=<var>`
- `make show! VALUE=<var>`
Show the value of $(var)
Show the value of make variable <var>. The show! variant works right after
./configure (it skips reading package-data.mk files).
- `make <file>`
......
......@@ -31,6 +31,22 @@ default:
install show:
$(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
# Note [install-strip]
#
# install-strip is like install, but it strips the executable files while
# installing them.
#
# From http://www.gnu.org/prep/standards/html_node/Standard-Targets.html:
#
# "install-strip should not strip the executables in the build directory
# which are being copied for installation. It should only strip the copies
# that are installed. "
.PHONY: install-strip
install-strip:
# See Note [install-strip].
$(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
else
.PHONY: default
......@@ -65,6 +81,7 @@ endif
REALGOALS=$(filter-out \
binary-dist \
binary-dist-prep \
install-strip \
sdist sdist-ghc \
sdist-ghc-prep \
sdist-windows-tarballs \
......@@ -125,6 +142,11 @@ else
$(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
endif
.PHONY: install-strip
install-strip:
# See Note [install-strip].
$(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
.PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
# Just running `./boot && ./configure && make sdist` should work, so skip
# phase 0 and 1 and don't build any dependency files.
......
......@@ -807,6 +807,11 @@ endif
define installLibsTo
# $1 = libraries to install
# $2 = directory to install to
#
# The .dll case calls STRIP_CMD explicitly, instead of `install -s`, because
# on Win64, "install -s" calls a strip that doesn't understand 64bit binaries.
# For some reason, this means the DLLs end up non-executable, which means
# executables that use them just segfault.
$(INSTALL_DIR) $2
for i in $1; do \
case $$i in \
......@@ -826,11 +831,14 @@ define installLibsTo
done
endef
install_bins: $(INSTALL_BINS)
install_bins: $(INSTALL_BINS) $(INSTALL_SCRIPTS)
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
for i in $(INSTALL_BINS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
done
for i in $(INSTALL_SCRIPTS); do \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
done
install_libs: $(INSTALL_LIBS)
$(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)")
......@@ -848,11 +856,14 @@ else
"$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc"
endif
install_topdirs: $(INSTALL_TOPDIRS)
install_topdirs: $(INSTALL_TOPDIR_BINS) $(INSTALL_TOPDIR_SCRIPTS)
$(INSTALL_DIR) "$(DESTDIR)$(topdir)"
for i in $(INSTALL_TOPDIRS); do \
for i in $(INSTALL_TOPDIR_BINS); do \
$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(topdir)"; \
done
for i in $(INSTALL_TOPDIR_SCRIPTS); do \
$(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(topdir)"; \
done
install_docs: $(INSTALL_DOCS)
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
......@@ -963,8 +974,10 @@ $(eval $(call bindist-list,.,\
$(libffi_HEADERS) \
$(INSTALL_LIBEXECS) \
$(INSTALL_LIBEXEC_SCRIPTS) \
$(INSTALL_TOPDIRS) \
$(INSTALL_TOPDIR_BINS) \
$(INSTALL_TOPDIR_SCRIPTS) \
$(INSTALL_BINS) \
$(INSTALL_SCRIPTS) \
$(INSTALL_MANPAGES) \
$(INSTALL_DOCS) \
$(INSTALL_LIBRARY_DOCS) \
......
......@@ -66,10 +66,13 @@ $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
endif
ifeq "$$($1_$2_INSTALL)" "YES"
# Don't add to INSTALL_BINS or INSTAL_TOPDIR_BINS, because they will get
# stripped when calling 'make install-strip', and stripping a Perl script
# doesn't work.
ifeq "$$($1_$2_TOPDIR)" "YES"
INSTALL_TOPDIRS += $$($1_$2_INPLACE)
INSTALL_TOPDIR_SCRIPTS += $$($1_$2_INPLACE)
else
INSTALL_BINS += $$($1_$2_INPLACE)
INSTALL_SCRIPTS += $$($1_$2_INPLACE)
endif
endif
......
......@@ -302,7 +302,7 @@ endif
ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES"
INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
else ifeq "$$($1_$2_TOPDIR)" "YES"
INSTALL_TOPDIRS += $1/$2/build/tmp/$$($1_$2_PROG)
INSTALL_TOPDIR_BINS += $1/$2/build/tmp/$$($1_$2_PROG)
else
INSTALL_BINS += $1/$2/build/tmp/$$($1_$2_PROG)
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