[commit: ghc] master: Build system: implement `make install-strip` (#1851) (64761ce)
git at git.haskell.org
git at git.haskell.org
Fri Sep 4 13:59:36 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/64761ce9a899954a12d8e3ae8b400c5ad9648137/ghc
>---------------------------------------------------------------
commit 64761ce9a899954a12d8e3ae8b400c5ad9648137
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Sat Aug 15 17:45:57 2015 +0200
Build system: implement `make install-strip` (#1851)
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D1209
>---------------------------------------------------------------
64761ce9a899954a12d8e3ae8b400c5ad9648137
MAKEHELP.md | 17 +++++++++--------
Makefile | 22 ++++++++++++++++++++++
ghc.mk | 21 +++++++++++++++++----
rules/build-perl.mk | 7 +++++--
rules/build-prog.mk | 2 +-
5 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/MAKEHELP.md b/MAKEHELP.md
index 3b58292..8537cf9 100644
--- a/MAKEHELP.md
+++ b/MAKEHELP.md
@@ -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>`
diff --git a/Makefile b/Makefile
index e6a1bc5..217205c 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
diff --git a/ghc.mk b/ghc.mk
index e51eb94..b146d5a 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -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) \
diff --git a/rules/build-perl.mk b/rules/build-perl.mk
index b943e16..5a1660c 100644
--- a/rules/build-perl.mk
+++ b/rules/build-perl.mk
@@ -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
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 1029fdd..f09a8c1 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -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
More information about the ghc-commits
mailing list